Uploaded image for project: 'PDFBox'
  1. PDFBox
  2. PDFBOX-2060

PDDocument.silentPrint using default Font

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 1.8.4, 1.8.5
    • None
    • None
    • None

    Description

      When trying to silent print a document following error occurs:

      org.apache.pdfbox.pdmodel.font.PDType0Font getawtFont
      Information: Using font SansSerif.plain instead of Verdana

      SilentPrint.java
      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();
      }
      
      

      Attachments

        1. TabelleTest.pdf
          10 kB
          Julian Ivancsuk
        2. temp.ps
          63 kB
          Julian Ivancsuk
        3. TabelleTest_embedded.pdf
          27 kB
          Julian Ivancsuk

        Issue Links

          Activity

            People

              Unassigned Unassigned
              leostiw Julian Ivancsuk
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: