• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

pdf generator

 
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
I have a functionality where I have generate pdf from the reports that are rendered using jsp. I have to write a common PDF generator that generates pdf on fly.

You all know that with Jsp's report data would be converted to html format and displayed onto the broswer. Now, when the user want to see the same data in PDF format, do I have to make a call onto the pdf generator class that would make call onto my business class to get the data from the database and convert that into XML-FO format?. I don't want to have pdf generator class for each report.

I am not sure how I should have to proceed with this and what is the best solution and in general how this is done.

I am new to XML and XLST and I am not sure how to go about this.

I would appreciate if any one could help me in handling this
Thank you
Saritha
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't think you should tie your PDFGenerator class to the rest of your application too tightly. In my opinion, the PDFGenerator class should take an input XML document, the XSL stylesheet document for converting that particular XML into XSL-FO, and then run the XSL-FO through the XSL-FO engine to generate PDF. Nothing more.
 
Saritha Penumudi
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you Lasse Koskela,
I really appreciate your reply.

I am currently in a phase where I have to identify all classes that I need for my PDF generator. I would really appreciate if you could help in suggesting if the approach I am thinking is correct or suggest best approach.
--------------------------------------------------------------------------
Approach 1:
1. JSP would send a request to generate a report in pdf format to Action class which inturn makes a request on to my business class.
2. Business class inturn would send a request to the DB class.
3. DB class would get the data from the database and return the data in the form of value objects to the business class.
4. Business class then send that collection to the DOMGenerator that converts data in the value objects to DOM Document and return DOM document to the business class.
5. Business class inturn would return DOM Document to the Action class.
6. Action class would send the DOM Document and xsl file to the PDF generator that generates xsl-fo and transfor XSL-FO into pdf.

Questions:
1. With the above approach, will there be any performance issues with creating DOM Document?. As I may get thousands on records from the database
2. General question: With this approach will there be any memory issues as DOM document is built in memory. With respect to memory and network traffic will there be any difference between returning collection of value objects to returing DOM document.
---------------------------------------------------------------------------
Approach 2:
Same as above approach 1. Except that instead of converting value objects to DOM Document on EJB side. Send the value objects to the web container. Which would convert them into DOM Document then to XML then to XSL-FO and finally to PDF.
---------------------------------------------------------------------------

Please Help me out. I have to present this to team on monday

Thank you
Saritha
[ September 26, 2004: Message edited by: Saritha ventrapragada ]
 
Saritha Penumudi
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
With lots of experts out there.. Please help me with this pdf generation stuff..

How I should approach.
1. I have a value object which need to be converted to xml. I don't want to save xml file onto hard disk. Hence I am thinking of creating Document. and then generate SourceStream from Document which can be passed to the treansform method.

I guess with this I am holding whole data in memory. As I get thousands and thousands of records, I am not sure if there will be any OutOfmemory constraints.

Please help me out.

Else, please post the general approach that should be followed.

Please Please Please
[ September 28, 2004: Message edited by: Saritha ventrapragada ]
 
Your mind is under my control .... your will is now mine .... read this tiny ad
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic