That fixed it! Thank you Andreas.
On Tue, Mar 6, 2012 at 11:35 AM, Andreas Lehmkuehler <[email protected]> wrote: > Hi, > > Am 27.02.2012 19:17, schrieb Eric Johnson: > >> Hi, >> I'm using pdfbox-app-1.6.0, and trying to print a PDF in landscape. >> My test string shows up fine (roughly in center of doc) in a PDF >> viewer but when I do print preview it is in very lower left bottom >> edge of the preview page and when I print, no text is printed at all. >> >> Here is my code: >> >> public static void main(String[] args) throws Exception { >> >> PDDocument doc = null; >> >> try { >> doc = new PDDocument(); >> PDPage page = new PDPage(); >> page.setMediaBox(PDPage.PAGE_SIZE_LETTER); >> page.setRotation(90); >> doc.addPage(page); >> PDRectangle pageSize = page.findMediaBox(); >> float pageWidth = pageSize.getWidth(); >> PDPageContentStream cs = new >> PDPageContentStream(doc, page, false, >> false); >> >> // translation of pageWidth to use lower left >> corner as 0,0 >> cs.concatenate2CTM(0, 1, -1, 0, pageWidth, 0); >> >> PDFont boldFont = PDType1Font.HELVETICA_BOLD; >> PDFont regFont = PDType1Font.HELVETICA; >> float fontSize = 8; >> >> cs.setFont(boldFont, fontSize); >> >> cs.beginText(); >> cs.moveTo(306, 390); >> cs.drawString("Test 1:"); >> cs.endText(); >> >> cs.close(); >> doc.save("TestPdf.pdf"); >> } finally { >> if (doc != null) { >> doc.close(); >> } >> } >> > Try to us PDPageContentStream#moveTextPositionByAmount instead of > PDPageContentStream#move > > >> Thanks for the help. >> Eric > > > > BR > Andreas Lehmkühler

