• 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

need to refresh a lot to see the generated pdf document

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Everyone,

I am generating a pdf document from xml using XSL-FO. When i execute my code, i am able to get the output, but i need to click on the refresh button many times.

I don't understand why this is happening. Can any one Pl explain me what might be the problem

Thanks in Advance.
 
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am a biginner in the FPO arena.
Did you try searching the Apache FOP web site, just a thought, I am sure you did your home work.

Where is WilliamB when we need him?

- m
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sounds like you have a problem with caching to me!
 
author and deputy
Posts: 3150
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1. Have you tested it with other PC's ?
2. how does your url look like ? does it have a .pdf string at the end ?
3. are you supplying the xml and xsl at the url or inside your java xsl transformation code ?
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As I recall, PDF plugins like to have a content-length to work with. It sounds like you are generating PDF output directly to the response stream so you can't set the content-length.

If this was my problem I would write the pdf to a temp file in order to be able to send the content-length correctly. That also helps with debugging the FOP since you can have the server side keep the temp file as you develop the application. I also like to keep the .fo output around during development so you can see what is being generated.

In general, I try to develop servlet applications in parts that can be tested OUTSIDE the servlet environment as much as possible - servlets have so many pitfalls.

Bill
 
vishme vish
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you all for the replies.

I am not able to understand why i need to refresh a lot.
I am executing my code through WSAD. The URL is
http://localhost:9080/PDFOutput/TestingServlet
Here is my Servlet code, that is used to generate the pdf document.
Here i am passing xml as String.



And here is my details.xsl file.


Any help would be greatly appreciated

Thanks in Advance.
 
Balaji Loganathan
author and deputy
Posts: 3150
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Add this few lines to your servlet code after the codeline MessageHandler.setScreenLogger(logger);


resp.setContentType("application/pdf");
resp.setHeader("Content-Disposition","inline;filename=details.pdf ");

and see how its works.

Instead of writing it to outputstream, try to write it to a bytearrayoutputstream and then assign it to printwriter. (by this way you can get the content length of your file then you can set the response length using resp.setContentLength(bytearrarycontent.length)
 
Why am I so drawn to cherry pie? I can't seem to stop. Save me tiny ad!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic