IOError: Helvetica not found as resource
Following the instructions in the README for gradle, I don't get the fonts (*.afm) embedded into the jar.
IOError: Helvetica not found as resource. (The *.afm files must exist as resources in the package pdftk.com.lowagie.text.pdf.fonts)
Unhandled Java Exception in create_output():
ExceptionConverter: pdftk.com.lowagie.text.DocumentException: Helvetica not found as resource. (The *.afm files must exist as resources in the package pdftk.com.lowagie.text.pdf.fonts)
at pdftk.com.lowagie.text.pdf.Type1Font.<init>(Type1Font.java:197)
at pdftk.com.lowagie.text.pdf.BaseFont.createFont(BaseFont.java:398)
at pdftk.com.lowagie.text.pdf.BaseFont.createFont(BaseFont.java:351)
at pdftk.com.lowagie.text.pdf.DocumentFont.doType1TT(DocumentFont.java:173)
at pdftk.com.lowagie.text.pdf.DocumentFont.<init>(DocumentFont.java:118)
at pdftk.com.lowagie.text.pdf.AcroFields.getAppearance(AcroFields.java:430)
at pdftk.com.lowagie.text.pdf.AcroFields.setField(AcroFields.java:1038)
at pdftk.com.lowagie.text.pdf.AcroFields.setFields(AcroFields.java:945)
at com.gitlab.pdftk_java.TK_Session.create_output(TK_Session.java:2901)
at com.gitlab.pdftk_java.pdftk.main(pdftk.java:152)
There was a problem with pdftk-java. Please report it at
https://gitlab.com/pdftk-java/pdftk/issues
including the message above, the version of pdftk-java (3.0.3), and if possible steps to reproduce the error.
This fix my error, but since I don't really know gradle, I prefer not submitting a MR, just presenting my fix.
diff --git a/build.gradle b/build.gradle
index 3e274e8..639cc58 100644
--- a/build.gradle
+++ b/build.gradle
@@ -10,6 +10,9 @@ sourceSets {
java {
srcDirs = ['java']
}
+ resources {
+ srcDirs = ["java"]
+ }
}
}
The error is not present if I build with ant.