aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2023-04-23 06:07:40 +0200
committerTeddy Wing2023-04-23 06:07:40 +0200
commit227f65a1300cdc8bc5f57fc472a11e388f4e4518 (patch)
treedc5d908fad2868c16f23843f1eb242a26959e267
parentdff5f939d4a7a87d32f053f8743aa0ad20126fd1 (diff)
downloadpdf-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.java2
1 files changed, 1 insertions, 1 deletions
diff --git a/Main.java b/Main.java
index fd4a8d5..701119f 100644
--- a/Main.java
+++ b/Main.java
@@ -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();