Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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' #41

Open
konrad-jamrozik opened this issue Jun 4, 2016 · 5 comments
Assignees

Comments

@konrad-jamrozik
Copy link

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
}
@ejabarov
Copy link

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

@eseifert
Copy link
Owner

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.

@ejabarov
Copy link

ejabarov commented Apr 12, 2018

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

@Mr14huashao
Copy link

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
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants