I am using OpenViewerFX (JPedal) to display PDF files in a JavaFX application. Some files are displayed well, others only show not printable characters (in documents created by myself and also documents from other people). See for example this one:
This is my code:
private final PdfDecoderFX pdf = new PdfDecoderFX();
private Group group;
@Override
public void start(Stage stage) {
BorderPane bp = new BorderPane();
Scene scene = new Scene(bp, 400, 400);
stage.setScene(scene);
stage.show();
group = new Group();
group.getChildren().add(pdf);
bp.setCenter(group);
Platform.runLater(() -> {
try {
pdf.openPdfFile("D:\\Dokument1.pdf");
decodePage();
} catch (PdfException e) {
e.printStackTrace();
System.out.println(e.getMessage());
}
});
}
private void decodePage() {
try {
pdf.setPageParameters(2.0f, 0);
pdf.decodePage(1);
pdf.waitForDecodingToFinish();
} catch (final Exception e) {
e.printStackTrace();
System.out.println(e.getMessage());
}
}
The PDF file was created from a Word document with Adobe PDF printer. I used the standard font and only standard characters. I tested several settings when creating the file, including
- Compatibility "PDF 1.3" to "PDF 1.7"
- Enable/Disable web optimization
- Include all fonts
- Include Open-Type fonts
but always the same result.
What could I be doing wrong?