Compare these products for PDF generation with Java given requirements inside: iText, Apache PDFBox or FOP? [closed]

iText; nowadays iText is a commercial library, the latest version is not for free anymore (a fork of an older version remains under MIT license: OpenPDF) FOP; I worked a lot with FOP. It’s fairly resource intensive (Java > XML > XSLT > PDF) and complex PDFs become a nightmare ( may result in XSLTs … Read more

iText landscape orientation and positioning?

You’re using PageSize.A4_LANDSCAPE, a variable that was introduced by a contributor and that should have never been added to the main release. Please use PageSize.A4.rotate() instead. It’s not clear what you want to achieve with the lines: document.left(100f); document.top(150f); Those are getters, not setters. It looks as if you’re assuming that PDF is similar to … Read more

iText – add content to existing PDF file

iText has more than one way of doing this. The PdfStamper class is one option. But I find the easiest method is to create a new PDF document then import individual pages from the existing document into the new PDF. // Create output PDF Document document = new Document(PageSize.A4); PdfWriter writer = PdfWriter.getInstance(document, outputStream); document.open(); … Read more

Merging multiple PDFs using iTextSharp in c#.net

I found the answer: Instead of the 2nd Method, add more files to the first array of input files. public static void CombineMultiplePDFs(string[] fileNames, string outFile) { // step 1: creation of a document-object Document document = new Document(); //create newFileStream object which will be disposed at the end using (FileStream newFileStream = new FileStream(outFile, … Read more

ITextSharp HTML to PDF?

I came across the same question a few weeks ago and this is the result from what I found. This method does a quick dump of HTML to a PDF. The document will most likely need some format tweaking. private MemoryStream createPDF(string html) { MemoryStream msOutput = new MemoryStream(); TextReader reader = new StringReader(html); // … Read more

iTextSharp set document landscape (horizontal) A4

You can set the page size to a rotated A4. E.g. (assuming PDF, but should apply regardless): iTextSharp.text.Document doc; // …initialize ‘doc’… // Set the page size doc.SetPageSize(iTextSharp.text.PageSize.A4.Rotate()); I’ve done this with PDF without trouble, haven’t tried it with other doc types.

How to insert blank lines in PDF?

You can trigger a newline by inserting Chunk.NEWLINE into your document. Here’s an example. public static void main(String args[]) { try { // create a new document Document document = new Document( PageSize.A4, 20, 20, 20, 20 ); PdfWriter.getInstance( document, new FileOutputStream( “HelloWorld.pdf” ) ); document.open(); document.add( new Paragraph( “Hello, World!” ) ); document.add( new … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)