[
https://issues.apache.org/jira/browse/PDFBOX-2060?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Julian Ivancsuk reopened PDFBOX-2060:
-------------------------------------
Reopend so I can upload a the correct PDF-File
> PDDocument.silentPrint using default Font
> -----------------------------------------
>
> Key: PDFBOX-2060
> URL: https://issues.apache.org/jira/browse/PDFBOX-2060
> Project: PDFBox
> Issue Type: Bug
> Affects Versions: 1.8.4, 1.8.5
> Reporter: Julian Ivancsuk
> Attachments: TabelleTest.pdf, temp.ps
>
>
> When trying to silent print a document following error occurs:
> {color:red} org.apache.pdfbox.pdmodel.font.PDType0Font getawtFont
> Information: Using font SansSerif.plain instead of Verdana{color}
> {code:title=SilentPrint.java|borderStyle=solid}
> try {
> DocFlavor flavor = DocFlavor.SERVICE_FORMATTED.PRINTABLE;
> String psMimeType = DocFlavor.BYTE_ARRAY.POSTSCRIPT.getMimeType();
> StreamPrintServiceFactory[] factories =
> StreamPrintServiceFactory.lookupStreamPrintServiceFactories(flavor,
> psMimeType);
> String pdffile = "c:\\temp\\TabelleTest.pdf";
> String psfile = "c:\\temp\\temp.ps";
>
> PDDocument doc = PDDocument.load(pdffile);
>
> // Open the output file
> FileOutputStream fos = new FileOutputStream(psfile);
> ByteArrayOutputStream bout = new ByteArrayOutputStream();
> // Use the first service available
> PrintService sps = factories[0].getPrintService(bout);
> // Define paper size
> PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
> aset.add(MediaSizeName.ISO_A4);
> PrinterJob pjob = PrinterJob.getPrinterJob();
> pjob.setPrintService(sps);
>
> doc.silentPrint(pjob);
> doc.close();
>
> fos.write(bout.toByteArray());
> fos.close();
> } catch (Throwable t) {
> t.printStackTrace();
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.2#6252)