[
https://issues.apache.org/jira/browse/PDFBOX-965?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Tilman Hausherr updated PDFBOX-965:
-----------------------------------
Attachment: probe.pdf-1.png
> Printing of PDF with embedded OTF/TTF fonts is not working
> ----------------------------------------------------------
>
> Key: PDFBOX-965
> URL: https://issues.apache.org/jira/browse/PDFBOX-965
> Project: PDFBox
> Issue Type: Bug
> Components: Rendering
> Affects Versions: 1.5.0
> Environment: OSX 10.6.6, JDK 1.6_022
> Reporter: Clemens Lanthaler
> Attachments: Probe.pdf, probe.pdf-1.png
>
>
> I want to print a PDF created with iText 2.1.7 which includes a OTF Font
> (into the pdf embedded). I have also converted the fonts to TTF fonts and
> recreated the pdf but pdfbox is not able to print the pdf file (PDF file see
> attachment). The result is that the printer outputs 10 empty pages and no
> error message. With the same code other pdf files can be printed.
> My code to print the pdf file:
> 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();
> }
> }
> }
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)