1.) There is no error message or stacktrace.
2.) and 3.): The printerName is not null and the printer is found and a job is 
created but an empty one (10 empty pages). It seems to me that pdfbox cannot 
render the document but I am not sure.
4.): I have now tried another pdf and the code is working and print the pdf.

cheers,
Clemens

On 17.02.2011, at 21:13, [email protected] wrote:

> 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.  

-------------------------------------------------
ITArchitects
B.Sc. Clemens Lanthaler
Sebastian-Kneipp-Weg 17/3
A-6020 Innsbruck
Tel.: +43 (0)650 855 2954
email: [email protected]
homepage: http://www.itarchitects.at
-------------------------------------------------
Notice: This e-mail and any attachments are confidential and may be privileged. 
If you are not the intended recipient, notify the sender immediately, destroy 
all 
copies from your system and do not disclose or use the information for any 
purpose. 
Diese E-Mail inklusive aller Anhaenge ist vertraulich und koennte 
bevorrechtigtem 
Schutz unterliegen. Wenn Sie nicht der beabsichtigte Adressat sind, informieren 
Sie 
bitte den Absender unverzueglich, loeschen Sie alle Kopien von Ihrem System und 
veroeffentlichen Sie oder nutzen Sie die Information keinesfalls, gleich zu 
welchem Zweck. 
----------------------------------------------------------




Reply via email to