Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Trouble in generating pdf reports with Jasper and iText

 
Leticia Barbalho
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey everyone,

I have a report created on iReports, and I wanna present it on my browser in my web app. The problem is I need to add a barcode in a specific point of this report. This barcode is being generated correctly, using class BarcodeInter25 of iText.

The problem happens when I'm gonna insert this barcode in the existing report in runtime. I tried it two ways:

First way:



In this first attempt, I use PdfImportedPage to import the page from my existing pdf and put it in my new report. But it it not working: the report shows only with the barcode, it hasn't imported the file I pointed.

Second way:



In this second attempt, I try to open the pdf directly in my document and write the image on it with pdfwriter. The code is normally interpreted and it gives me no error, but when it tries to open the pdf of the screen, it doesn't open. The screen remains gray, like if it was forever loading.

The documentation I'm using comes mainly from here:
http://itextdocs.lowagie.com/tutorial/general/copystamp/.

I accept any kind of help on ways to do it

Thanks in advance
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is not a Servlet specific question so I'm moving it to Other Java APIs.

Try writing the code in a stand-alone class first and write it to the file system. Once you are able to read this you should be able to alter it to stream to the client.

Dave
 
Jason Moors
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to use the PdfStamper class instead of PdfWriter.

You need to do something like :



[ March 31, 2006: Message edited by: Jason Moors ]
[ March 31, 2006: Message edited by: Jason Moors ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic