Hello,
I’m running into a strange issue where the expected behavior for embedding a font differs from the behavior with indesign. When my code adds a page with text using the OTF font ApfelGrotezRegular it’s added as ApfelGrotezRegular(Embedded OpenType) but for the page our indesign user added it’s listed as ApfelGrotez-Regular (Embedded).
Further if I run the Acrobat preflight profile Digital printing (B/W) it throws an error about “Text uses OpenType font”. But if I convert the otf file to ttf and rerun my java code the issue goes away. Is there something I should be doing when I generate the page and process the otf font?
Sample code
try(FileReader fr = new FileReader(Configuration.getInstance().getProperties().getProperty(“template.path”, “/path/to/boiler/plate/text.txt”))) {
try(BufferedReader br = new BufferedReader(fr)) {
String line = br.readLine();
while (line != null) {
if (line.contains("\n")) {
final TextFragment fragmentNewLine = new TextFragment("");
fragmentNewLine.getTextState().setFont(FontRepository.findFont("ApfelGrotezk-Regular"));
//fragmentNewLine.getTextState().setFont(FontRepository.findFont("Helvetica LT Pro"));
fragmentNewLine.getTextState().setFontSize (8);
fragmentNewLine.getTextState().getFont().setEmbedded(true);
//fragmentNewLine.getTextState().setBackgroundColor(Color.fromCmyk(0.0,0.0,0.0,1.0));
//fragmentNewLine.getTextState().setForegroundColor(Color.fromCmyk(0.0,0.0,0.0,0.0));
paragraph.appendLine(fragmentNewLine);
} else {
// Quick and dirty brute force replacement
line = line.replace("[ISBN]", this.liveTextSummary.getIsbn());
line = line.replace("[JOB_ID]", this.liveTextSummary.getDtqJobId());
final TextFragment fragment = new TextFragment(line);
fragment.getTextState().setFont(FontRepository.findFont("ApfelGrotezk-Regular"));
//fragment.getTextState().setFont(FontRepository.findFont("Helvetica LT Pro"));
fragment.getTextState().setFontSize (8);
fragment.getTextState().getFont().setEmbedded(true);
//fragment.getTextState().setBackgroundColor(Color.fromCmyk(0.0,0.0,0.0,1.0));
//fragment.getTextState().setForegroundColor(Color.fromCmyk(0.0,0.0,0.0,0.0));
paragraph.appendLine(fragment);
}
line = br.readLine();
}
} catch (IOException e) {
throw new RuntimeException(e);
}
} catch (IOException e) {
throw new RuntimeException(e);
}
aspose otf vs ttf.png (11.1 KB)
preflight errors acrobat pro.png (55.2 KB)