Archive For 21. February 2016

Merging pdf documents with java

By |

A Java 8 code snippet to merge to pdf documents into a single file: import com.itextpdf.text.Document; import com.itextpdf.text.pdf.PdfContentByte; import com.itextpdf.text.pdf.PdfImportedPage; import com.itextpdf.text.pdf.PdfReader; import com.itextpdf.text.pdf.PdfWriter; import*; public class PdfMerger { public static void main(String[] args) throws Exception { File[] inFiles = new File[] { new File(“1.pdf”), new File(“2.pdf”) }; File outFile = new File(“out.pdf”); Document document = new…

Read more »