Skip to content

Commit

Permalink
PdfEmitter, Enhancement: Enable options to set the PDF/Version & arc…
Browse files Browse the repository at this point in the history
…hiving formats PDF/A (A1A & A1B) eclipse-birt#1486  (eclipse-birt#1487)

PdfEmitter, Enhancement: Enable options to set the PDF/Version & archiving formats PDF/A (A1A & A1B) (eclipse-birt#1486)
  • Loading branch information
speckyspooky authored Nov 8, 2023
1 parent 7400052 commit 11b3744
Show file tree
Hide file tree
Showing 2 changed files with 434 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -464,9 +464,24 @@ private void drawText(String text, float textX, float textY, FontInfo fontInfo,
BaseFont font = getBaseFont(fontInfo);
float fontSize = fontInfo.getFontSize();
try {
// PDF/A: if font not embeddable then use the configured PDF/A fallback font
if (this.pageDevice.isPdfAFormat() && fontInfo.getBaseFont() != null
&& !fontInfo.getBaseFont().isEmbedded()) {
try {
String defaultFontPdfA = this.pageDevice.getDefaultFontPdfA();
if (defaultFontPdfA != null) {
font = BaseFont.createFont(defaultFontPdfA, "", true);
}
logger.log(Level.WARNING,
"PDF/A: " + fontInfo.getFontName() + " not embeddable, fallback font used.");
} catch (Exception e) {
logger.log(Level.WARNING,
"PDF/A: " + fontInfo.getFontName() + " not embeddable." + e.getMessage());
}
}
contentByte.setFontAndSize(font, fontSize);
} catch (IllegalArgumentException e) {
logger.log(Level.WARNING, e.getMessage());
} catch (IllegalArgumentException iae) {
logger.log(Level.WARNING, iae.getMessage());
// close to zero , increase by one MIN_FONT_SIZE step
contentByte.setFontAndSize(font, MIN_FONT_SIZE * 2);
}
Expand Down
Loading

0 comments on commit 11b3744

Please sign in to comment.