wood burning stoves 2.0*
The moose likes Other Open Source Projects and the fly likes Flying Saucer and Itext Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Flying Saucer and Itext" Watch "Flying Saucer and Itext" New topic
Author

Flying Saucer and Itext

Pat Ziel
Greenhorn

Joined: Nov 07, 2009
Posts: 9
Hey everyone,



This bit of code correctly generates a PDF file when I call it inside the main function of the class, but when I use it to generate my pdf from a JSP page I get an error about <2 of 3 Bytes and Utf8>.

The method responsible for generating the pdf is just one big block inside a static method that's being called inside the page with an array of info passed down. I'm at work atm so I can't post the stackTrace,but I thought some people might know why this is occuring.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12809
    
    5
I get an error


What is the exact text of the error - with stack trace if possible!

Where does the error message appear?

How are you accessing this? What does that have to do with the JSP forum?

Bill
Pat Ziel
Greenhorn

Joined: Nov 07, 2009
Posts: 9
1- Is has to do with the JSP forum in some way due to the fact that the code works A-ONE inside a regular Java bean(From the main) and that it fails when called from A JSP page.

2- I don't have access to my computer at this moment, but the .getMessage was printing out something similar to an issue with the number of bytes and about the Utf8 format.

I will get back to you guys with a full stack trace once I get home.

P.S Something like this : Invalid byte 2 of 3-byte UTF-8 sequence
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42355
    
  64
You can't generate binary content (like PDF) on a JSP; you'll need to use a servlet instead.


Ping & DNS - my free Android networking tools app
Pat Ziel
Greenhorn

Joined: Nov 07, 2009
Posts: 9
Ulf Dittmer wrote:You can't generate binary content (like PDF) on a JSP; you'll need to use a servlet instead.


Something like this?

Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42355
    
  64
Possibly; does it work?
Pat Ziel
Greenhorn

Joined: Nov 07, 2009
Posts: 9
Ulf Dittmer wrote:Possibly; does it work?


I'm a bit confused here. My website is made of jsp and now I need to generate a pdf. How exactly will that servlet interact with the jsp page? Because obviously the pdf is generated with user data that is passed down from the page.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42355
    
  64
The JSP containing the HTML form can submit to the servlet that creates the PDF. Or it can submit to some other servlet if that's more convenient, and the other servlet can forward to the PDF-generating servlet.
Pat Ziel
Greenhorn

Joined: Nov 07, 2009
Posts: 9
Well actually my code was correct. After speaking with the team we noticed the issue was with the utf8 encoding, any document that contained french accents or any other peculiar character was making it fail, so I converted the string appropriately.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Flying Saucer and Itext