I don't have any experience printing or doing text extraction, but a few questions which might help in troubleshooting.
1.) did the code throw any exceptions? If so, please include the stacktrace. 2.) is printerName null? 3.) is printerFound true? 4.) does this exact same code work properly with other PDFs? ---- Thanks, Adam From: Clemens Lanthaler <[email protected]> To: [email protected] Date: 02/17/2011 11:57 Subject: Printing a PDF including OTF fonts not working Hi, I have tried to print a document (see attachment) but the pages are completely empty. Also text extraction is not working. Has anybody an idea what is going wrong ? I am creating the document with iText 2.1.7 and use the checked out version of pdf-box (1.5) from 17/02/2011. Furthermore the document has an embedded OTF font inside with ANSI encoding. Here is my code: private void printPDF(byte[] barrayBs) throws IOException, CryptographyException, InvalidPasswordException, PrinterException { String password = ""; String printerName = null; PDDocument document = null; try { document = PDDocument.load(new ByteArrayInputStream(barrayBs)); //document = PDDocument.load("/Users/selfemp/Desktop/pr2.pdf"); //PDFont font = PDTrueTypeFont.loadTTF( document, new File("/Users/selfemp/Desktop/fonts/TeXGyreAdventor-Regular.ttf")); //PDFont font2 = PDTrueTypeFont.loadTTF( document, new File("/Users/selfemp/Desktop/fonts/TeXGyreAdventor-Bold.ttf")); if (document.isEncrypted()) { document.decrypt(password); } PrinterJob printJob = PrinterJob.getPrinterJob(); printJob.setJobName("WIST-Report"); if (printerName != null) { PrintService[] printService = PrinterJob.lookupPrintServices(); boolean printerFound = false; for (int i = 0; !printerFound && i < printService.length; i++) { if (printService[i].getName().indexOf(printerName) != -1) { printJob.setPrintService(printService[i]); printerFound = true; } } } document.silentPrint(printJob); } finally { if (document != null) { document.close(); } } } - FHA 203b; 203k; HECM; VA; USDA; Conventional - Warehouse Lines; FHA-Authorized Originators - Lending and Servicing in over 45 States www.swmc.com - www.simplehecmcalculator.com Visit www.swmc.com/resources for helpful links on Training, Webinars, Lender Alerts and Submitting Conditions This email and any content within or attached hereto from Sun West Mortgage Company, Inc. is confidential and/or legally privileged. The information is intended only for the use of the individual or entity named on this email. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or taking any action in reliance on the contents of this email information is strictly prohibited, and that the documents should be returned to this office immediately by email. Receipt by anyone other than the intended recipient is not a waiver of any privilege. Please do not include your social security number, account number, or any other personal or financial information in the content of the email. Should you have any questions, please call (800) 453 7884.

