Senior & Expert RoR Developers Discussion Forum by Nyros Technologies

HIRE Ruby on Rails Expert Developers Programmers Coders From India
Ruby on Rails PHP .Net Developers Community, Nyros Technologies, Kakinada
 
Log in  or IF not a member please REGISTER
Username:
Password:   


Keyword
Log in | Profile 

xml to pdf generation

 
Post new topic   Reply to topic    Senior & Expert RoR Developers Discussion Forum by Nyros Technologies Index -> Plugins and Gems
View previous topic :: View next topic  
Author Message
ktulasi



Joined: 21 Oct 2009
Posts: 59

PostPosted: Mon Feb 08, 2010 6:19 am    Post subject: xml to pdf generation Reply with quote

Hi,

Prince xml is a command line program that converts given xml,html and css to pdf documents.

Installation of Prince:
-------------------------
Download the prince from http://www.princexml.com/download/
1.Log into root
2. Change directory to prince path.(cd prince 7.0)
3.sudo ./install.sh
Now,it installed.
Check it, in your command prompt.
prince (your html file name) -o output.pdf
it generates a pdf.
Its very simple to generate pdf by this.We can apply styles,we can go with images also(which the css and images should be in the same html file path).

And in the other way to generate pdf is princely plugin.
We can use princely plugin,which also generates pdf.princely is a wrapper around Prince Api.
In this we write normal html views and princely will generate a pdf.

Installing princely plugin,
ruby script/plugin install git://github.com/mbleigh/princely.git

For the princely plugin to generate pdf we can apply stylesheets.

In princely first Princely object should be created.
To render_to_string we can apply parameters as templates, stylesheets and layouts.
send_data(),it takes parameters as the given input like template,layout and stylesheets. and filename, and changes to the pdf with the given file name..

def example
princely = Princely.new()
html_string = render_to_string(:template => 'user/index.html.erb',:stylesheets => "styles.css")
send_data(
princely.pdf_from_string(html_string),
:filename => 'new',
:type => 'application/pdf'
)
end

From the example method,
a new Princely object is created and assigned to a variable princely.then, a html_string variable is assigned with templates,stylesheets and layout with render_to_string.then, by send_data method it converts the given html to pdf document.

thank you.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Senior & Expert RoR Developers Discussion Forum by Nyros Technologies Index -> Plugins and Gems
Page 1 of 1

 latest topics 
 Topics   Replies   Author   Views   Last Post 
No new posts How to customize Google Maps InfoWindow using ym4r_gm
0 kalyanallampalli 9 Thu Sep 02, 2010 5:34 pm
kalyanallampalli View latest post
No new posts Drag and Drop file upload
0 umamageshwari 19 Wed Sep 01, 2010 9:36 am
umamageshwari View latest post
No new posts Flex On Rails
0 Raghu 13 Wed Sep 01, 2010 3:00 am
Raghu View latest post
No new posts MongoDB
0 Raghu 17 Tue Aug 31, 2010 3:30 pm
Raghu View latest post
No new posts Problem with Dreamweaver / java error
3 Raja 19 Tue Aug 31, 2010 3:24 pm
Raghu View latest post
No new posts Generating Model
0 phani.galla 18 Tue Aug 31, 2010 2:09 pm
phani.galla View latest post
No new posts Hide Panels using JQuery
0 Anu 24 Tue Aug 31, 2010 1:50 pm
Anu View latest post
No new posts Load a text file using ajax in jquery
0 Anu 23 Tue Aug 31, 2010 1:39 pm
Anu View latest post
No new posts Generating Migrations
0 phani.galla 18 Tue Aug 31, 2010 1:38 pm
phani.galla View latest post
No new posts Generating Controllers
0 phani.galla 20 Tue Aug 31, 2010 1:22 pm
phani.galla View latest post




Hire an expert Ruby on Rails developer / coder / programmer or development team from India now!!

Other Forums : PHP   ::   .Net   |   Free unlimited HTML CSS templates download

Nyros Technologies   |   Kakinada City Portal   |   Developers Blog   |   About Ruby on Rails Experts   |   More