itext

itext positioning text absolutely

In itext I have a chunk/phrase/paragraph (I dont mind which) and I want to position some where else on the page e.g. at 300 x 200. How would I do this? ...

Writing to DirectContent with ColumnText does not update PdfDocument.GetVerticalPosition

Im using ITextSharp to generate a PDF, and have a situation where a need to use DirectContent via a ColumnText. The problem is, that after writing text via the ColumnText object, the PdfDocument.GetVerticalPosition has not been updated? See following test which fails: public void TestGetVerticalPositionIsUpdated() { Pdf...

itextsharp "Object reference not set to an instance of an object" error

I have the following code. In my dev enviroment I am not getting any erros but in my production enviroment I do. ... private Document _pdf; public Report() { _pdf = new Document(); } public string GenerateReport(string reportType) { try { var fs = new FileStream("C:\\myfile.pdf", FileMo...

GroupLayout-like library for iText

Hi. I was wondering whether there is a library that would provide javax.swing.GroupLayout-like ability to lay-out things (e.g. text boxes)? Or Maybe PDF itself supports such layouts? Some GroupLayout links: http://java.sun.com/docs/books/tutorial/uiswing/layout/group.html http://java.sun.com/javase/6/docs/api/javax/swing/GroupLayout.htm...

itext multiline text in bounding box

Hi. Does anyone know, how to, in iText, add multiline text in bounding box (with coordinates specified). I tried cb.showTextAligned(PdfContentByte.ALIGN_LEFT, text, bounds.getLeft(), TOTAL_HEIGHT-bounds.getTop(), 0); But it does not support newlines. I also tried PdfContentByte cb = writer.getDirectContent(); cb.moveText(300,40...

Can you set a background imaged to a PdfPTable when using iText

I am using iText to generate Pdf Reports for data in a database... The header of the pages of the pdfs is an image with some text on the image added dynamically, say for example date generated.. Anyone knows if we can set background images to Tables of type PdfPTable in itext.. Thanks ...

Java: how to write out PDF to a text file?

When I open a PDF file and write the content to a text file the content from the text file is messed up. I think it's because of the encoding. From what I understand the JVM sets the default character set to Cp1252 (because I'm running on Windows XP). I've changed the default character set but with no results (System.setProperty("file.en...

Reading a PDF document with iText not working sometimes

I am using iText to read from a PDF doc. I am getting an ArrayIndexOutOfBoundsException. The strange thing is it only happens for certain files and at certain locations in those files. I suspect it's something to do with the way the PDF is encoded at those locations but can't figure out what the problem is. I have looked at this questio...

java PdfTextExtractor.getTextFromPage(Unknown Source)

Hello i have trouble with parsing a pdf when the iterator reaches page 11 an exception is throw. Any ideas? Thanks Here's my code: import java.io.*; import java.nio.charset.Charset; import java.util.regex.*; import com.lowagie.text.pdf.PdfReader; import com.lowagie.text.pdf.hyphenation.TernaryTree.Iterator; import com.lowagie.text.pd...

How can I use revisions to avoid invalidating digital signatures in a PDF?

Using Acrobat 9, if I sign a PDF using a self-signed certificate and then edit the PDF after I sign it, Acrobat will inform me that there is a valid signature on the document but that the document also has unsigned changes. If I then sign the PDF again and look in the signature panel, it will show the first signed revision with a valid s...

Embed font into PDf file by using iText

Hi, I defined a tag map, and got a xml data file. I want to convert the xml data file to PDF by using iText. The question is how to embed fonts (e.g. polish font, chinese font) into target PDF when converting xml to PDF? Thanks. ...

How to insert a image under the text as a pdf background using iText ?

I need some sample code to insert a image as a pdf background, is there any this kind of sample code ? and I have wrote the text well, then i need to insert a image under the text. ...

Signing PDF - multiple signatures with a single revision

Hi, To put it simply - I want to add multiple signatures on a PDF (using iText), without adding new revision for each. I've read the following thread, and it makes much sense (since Bruno wrote the answer) It is obvious, that if the document has 2 revisions, the first signature doesn't cover the second revision. However, is it possibl...

Adding external images to PDF using iText

I'm having trouble figuring out how to add an external image (referenced by a URL) to a PDF using iText. Is this kind of thing possible? The PDF spec in 7.1.5 says you should be able to reference a PDF via a URL by using a URL specification. This is what I've got so far: PdfFileSpecification pdfSpec = PdfFileSpecification.url(writ...

iText 5.0.0 where did RTF and HTML go?

This question may seem stupid, but, so be it! I have a stupid problem then :-). Well, my problem is this : using this code //PDF generation PdfWriter.getInstance(document, new FileOutputStream("PDFFile.pdf")); //RTF generation RtfWriter2.getInstance(document, new FileOutputStream("RTFFile.rtf")); //HTM generation HtmlWriter.getIns...

How to create iText PDF with CMY colors only

Hi, I need to create pdfs with iText (for the moment, other lib suggestions are appreciated) in the CMY colorspace. It's not CMYK: All colors and black should be converted to CMY only so that the black plate is empty when saving my created PDF. I know, black would look some sort of brown, but I have to requirement to not use any black ...

Using iText to selectively hide parts of a pdf

I am using iText to populate a pdf form using data from our database. Sometimes, though, our forms may have an extra body of text at the end, like a disclaimer, depending on certain criteria specified in the data. Is it possible to hide parts of a PDF document so they do not display / print? This would let our business people create...

Are there any credible alternatives to iText for programmatic PDF generation within Java?

Anyone come across anything else that is similar or close in quality/features? Cheers. ...

iText Limiting Text Size in a Text Field

Is there any way we can specify the max number of chars a TextField can take in the PDF form created using iText? ...

iText disable printing/Copying/Saving

Hello, I wrote a servlet to serve PDF using iText. Is there any way to disable printing/Copying/Saving from the browser end? ...