You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Tilman Hausherr (JIRA)" <ji...@apache.org> on 2014/05/06 21:34:14 UTC
[jira] [Commented] (PDFBOX-2060) PDDocument.silentPrint using
default Font
[ https://issues.apache.org/jira/browse/PDFBOX-2060?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13991032#comment-13991032 ]
Tilman Hausherr commented on PDFBOX-2060:
-----------------------------------------
The problem is that verdana is not embedded. Pdfbox doesn't know that the verdana font is available on some Windows versions, so it is using a default font. If you created this PDF yourself, try modify it so that it embeds the fonts.
In the unreleased 2.0 version, I use an altered version of PDFBox with a modified font property file, see e.g. [here|https://issues.apache.org/jira/browse/PDFBOX-62?focusedCommentId=13982356&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13982356] where I tell more.
> 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
> Fix For: 1.8.6
>
> 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)