itext

Create destinations for all bookmarks in a PDF file with iText API

I'd like to write some Java code that takes a PDF document, and creates named destinations from all of the bookmarks. I'm thinking that the iText API is the easiest way of doing this, but I have never used the API before. How would you go about writing this sort of code with the iText API? Open, find bookmarks, create destinations, sav...

How do you create a PDF from XML in Java?

At the moment, I'm creating an XML file in Java and displaying it in a JSP page by transforming it with XSL/XSLT. Now I need to take that XML file and display the same information in a PDF. Is there a way I can do this by using some kind of XSL file? I've seen the iText Java-PDF library, but I can't find any way to use it with XML and a...

Should I dynamically recreate a PDF, rather than store it in either the database or the filesystem?

I need customers to be able to download PDFs of letters that have been sent to them. I have read the threads about database vs filesystem storage of documents or images, and it does sound like the consensus is that, for anything more than just a few images, filesystem is the way to go. What I want to know: would a reasonable alternativ...

Using itext to convert HTML to PDF

Does anyone know if it is possible to convert a HTML page (url) to a PDF using itext? If the answer is 'no' than that is OK as well since I will stop wasting my time trying to work it out and just spend some money on one of a number of components which I know can :) Thanks in advance for your responses! ...

Problem matching Code128A Barcodes generated with iTextSharp vs. Barcode.4NET

First of all, I'm kinda new to the barcode formats and what I do know, I've learned from Wikipedia. We have some barcodes generated by an existing app that uses the Barcode.4NET library. The barcode is in Code 128A format. The code to generate them is pretty simple, looking something like this: // Create the barcode Code128ABarcode c12...

How do I retrieve an image using iText when the URL has redirects?

I am using iText to generate PDF invoices for a J2EE web application and included on the page is an image read from a URL constructed from the request URL. In the development and test environments this works fine, but in production I get a java.io.IOException: is not a recognized imageformat. If I paste the url into my browser then the...

How to generate a signed PDF w/o green checkmark

I'm signing PDF's using iText. I'm including a graphic in the signature. This works, but the green checkmark (or yellow question mark) that shows when the document is verified interferes with the graphic I inserted, making the end result look ugly. It either shows up above or below the signature graphic, but I can't get it to disappear....

Vector graphics in iText PDF

We use iText to generate PDFs from Java (based partly on recommendations on this site). However, embedding a copy of our logo in an image format like GIF results in it looking a bit strange as people zoom in and out. Ideally we'd like to embed the image in a vector format, such as EPS, SVG or just a PDF template. The website claims that...

How do I paint Swing Components to a PDF file with iText?

I would like to print my Swing JComponent via iText to pdf. JComponent com = new JPanel(); com.add( new JLabel("hello") ); PdfWriter writer = PdfWriter.getInstance( document, new FileOutputStream( dFile ) ); document.open( ); PdfContentByte cb = writer.getDirectContent( ); PdfTemplate tp = cb.createTemplate( pageImageableWidth, pageI...

iText copy form fields

Is there a way in iText to copy just the PDF acroform fields from one PDF document to another PDF document? I have the code to copy the entire PDF, but I would like to be able to overlay all my fields to a new/updated PDF document. ...

Printing from web applications

How do you generate paper-prints from a web application? Specifically I am thinking about more complex paper documents like diplomas, invoices and contracts. Variable number of pages with frames, tables, logos and headers/footers. Today I use custom forms and CSS for certain things and iTextSharp for others (I work with asp.net and MS-...

Can I fill in an encypted PDF with iTextSharp?

I have a fillable, saveable PDF file that has an owner password (that I don't have access to). I can fill it out in Adobe reader, export the FDF file, modify the FDF file, and then import it. Then I tried to do it with iText(Sharp). I can't create a PdfStamper from my PdfReader because I didn't provide the owner password to the reader....

How do I force formatting and calculations in a PDF when filling other fields using iTextSharp?

I have a PDF form with a number of text fields. The values entered in these fields are used to calculate values in other fields (the calculated fields are read-only). When I open the form in Adobe Reader and fill in a field, the calculated fields automatically re-calculate. However, I am using iTextSharp to fill in the fields, flatten ...

iText page wrapping- changes order of elements

I'm using iText to generate PDF reports - came across this issue, and worked up a simple example to illustrate it. I'm combining simple paragraphs, and images. The height of the images is such that 3 will fit on a PDF page, but when if text is on a page, only 2 images will fit. I create my iText PDF like so Document document = new ...

Barcode doesn't display in PDF using iText

I'm using iText to dynamically generate PDF docs. Now I'm trying to dynamically create a barcode in this PDF. Adobe Live Cycle has a barcode function built-in. You can just drag the barcode text box on the page and it's created. Problem: I placed the barcode field in the PDF. Then pass a number to the barcode field from the JSP page. Bu...

Both landscape and portrait for pdf with Flying Saucer/iText

Is there a way to set different page styles with Flying Saucer/iText? I need to have the first couple of pages in landscape, then switch to portrait at a certain page and out. Any ideas? ...

Itext embed font in a PDF

I have a pdf that has been created using the Foxit form designer. On my design system, I have the barcode font installed. The barcode font is used in one of the AcroFields. It appears that foxit does not embed the font in the document. I also have customers that do not have the barcode font installed in their computers, and thus I w...

Adding a dynamic image to a PDF using ColdFusion and iText

I pieced together some code to insert a dynamic image into a PDF using both ColdFusion and iText, while filling in some form fields as well. After I got it working and blogged about it, I couldn't help but think that there might be a better way to accomplish this. I'm using the basic idea of this in a production app right now so any comm...

Why am I getting a NullPointerException when trying to read a file?

I use this test to convert txt to pdf : package convert.pdf; //getResourceAsStream(String name) : Returns an input stream for reading the specified resource. //toByteArray : Get the contents of an InputStream as a byte[]. import java.io.FileOutputStream; import java.io.IOException; import org.apache.commons.io.IOUtils; import conver...

How to add total page number on every page with iText?

How to add the total page number on every page with iText? ...