Rectangle pageSize = reader.getPageSize(1);
System.out.println("Input page size: " + pageSize);
Document doc = new Document(PageSize.A4.rotate(), 0, 0, 0, 0);
PdfWriter writer = PdfWriter.getInstance(doc, new FileOutputStream(output));
doc.open();
// splitLine(doc, writer);
PdfContentByte cb = writer.getDirectContent();
float bottom = (doc.top() - pageSize.getHeight()) / 2 + kOffset;
float left = doc.right() / 2 - (pageSize.getWidth() + kTextWidth) / 2 - kMargin;
float right = doc.right() / 2 - (pageSize.getWidth() - kTextWidth) / 2 + kMargin;