vectorgraphics2d icon indicating copy to clipboard operation
vectorgraphics2d copied to clipboard

Generating empty pdf on Windows 10 and opening it in Adobe Acrobat Reader DC results in a warning about bad /BBox in font 'Dialog.plain'

Open konrad-jamrozik opened this issue 9 years ago • 5 comments

Opening empty generated .pdf on Windows 10 with Adobe Acrobat Reader DC (15.016.20045) results in a warning "The font 'Dialog.plain' contains bad /BBox."

Repro:

// Gradle dependency: testCompile 'de.erichseifert.vectorgraphics2d:VectorGraphics2D:0.10'
@Test
public void BBoxError() throws IOException
{
  PDFGraphics2D pdf = new PDFGraphics2D(0.0, 0.0, 100.0, 100.0);
  System.out.println(pdf.getFont());
  // Prints out: java.awt.Font[family=Dialog,name=Dialog,style=plain,size=12]

  try (FileOutputStream file = new FileOutputStream("test1.pdf"))
  {
    file.write(pdf.getBytes());
  }

  // Open test1.pdf with Adobe Acrobat Reader DC (15.016.20045) on Windows 10
  // See a dialog box: "The font 'Dialog.plain' contains bad /BBox."

  pdf.setFont(new Font(Font.SANS_SERIF, Font.BOLD, 14));
  System.out.println(pdf.getFont());
  // Prints out: java.awt.Font[family=SansSerif,name=SansSerif,style=bold,size=14]
  try (FileOutputStream file = new FileOutputStream("test2.pdf"))
  {
    file.write(pdf.getBytes());
  }

  // Open test2.pdf with Adobe Acrobat Reader DC (15.016.20045) on Windows 10
  // See a dialog box: "The font 'Dialog.plain' contains bad /BBox."
  // I.e. the message is the same, even though the font was changed.

  // Both test1.pdf and test2.pdf in "Document Propeties -> Fonts" show:
  //   Dialog.plain
  //     Type: TrueType
  //     Encoding: Ansi
  //     Actual font: Adobe Sans MM
  //     Actual Font Type: Type 1
}

konrad-jamrozik avatar Jun 04 '16 22:06 konrad-jamrozik

Also have the same problem. Any way to solve it? Thank you in advance

ejabarov avatar Apr 11 '18 08:04 ejabarov

The best way to solve this is probably by implementing a mapping to the list of Base 14 fonts as suggested in #33. Maybe explicitly setting a system font other than the standard font could help, too. I haven't tried that yet, though.

eseifert avatar Apr 12 '18 07:04 eseifert

Thank you for your reply. Can you please provide some more information for the following case?

ProcessingPipeline g = null; g = new PDFGraphics2D(0, 0, 595, 842); chart.paint(g, view.getWidth(), view.getHeight()); try (FileOutputStream file = new FileOutputStream("test1.pdf")) { file.write(g.getBytes()); } I am not really sure what font do you mean?

Thank you for your time

ejabarov avatar Apr 12 '18 07:04 ejabarov

On linux systems, it is normal.

On the windows system, the prompt "The font 'Dialog.plain' contains a bad /BBox", and the error "An error exits on this page. Acrobat may not display the page correctly. Please contact the person who created the PDF document to Correct the problem.", the drawn content can not be displayed.

Mr14huashao avatar Nov 14 '19 07:11 Mr14huashao

Adobe Reader software version 11.0.00, open pdf file error, online said to upgrade, this I did not try;

But try other ways, open with other software or browser, it is normal.

Mr14huashao avatar Nov 14 '19 08:11 Mr14huashao