diff options
author | Teddy Wing | 2023-04-23 06:07:40 +0200 |
---|---|---|
committer | Teddy Wing | 2023-04-23 06:07:40 +0200 |
commit | 227f65a1300cdc8bc5f57fc472a11e388f4e4518 (patch) | |
tree | dc5d908fad2868c16f23843f1eb242a26959e267 | |
parent | dff5f939d4a7a87d32f053f8743aa0ad20126fd1 (diff) | |
download | pdf-form-replace-font2-227f65a1300cdc8bc5f57fc472a11e388f4e4518.tar.bz2 |
Main.java: Don't embed the font
This finally works. My guess is that the library was embedding the font
and, crucially, _subsetting_ the font. But since we don't set any values
before writing out the PDF, it was probably subsetting to 0 glyphs,
effectively making it appear that the desired font wasn't being set.
Forcing no embedding renders the font correctly.
-rw-r--r-- | Main.java | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -38,7 +38,7 @@ public class Main { FontProgram courier_program = FontProgramFactory .createFont("/System/Library/Fonts/Supplemental/Copperplate.ttc", 0, false); PdfFont courier = PdfFontFactory - .createFont(courier_program, PdfEncodings.UTF8, PdfFontFactory.EmbeddingStrategy.PREFER_EMBEDDED); + .createFont(courier_program, PdfEncodings.UTF8, PdfFontFactory.EmbeddingStrategy.FORCE_NOT_EMBEDDED); PdfAcroForm form = PdfAcroForm.getAcroForm(pdf, false); Map<String, PdfFormField> fields = form.getFormFields(); |