• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Trouble in generating pdf reports with Jasper and iText

 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic