Age | Commit message (Collapse) | Author |
|
|
|
|
|
|
|
Allow `mvn` to be redefined so we can use `mvn3` explicitly in the
MacPorts port.
|
|
|
|
|
|
Need to remove the "-SNAPSHOT" string from the tagged version.
|
|
Make it so that we can actually add a proper message to the tag
generated by Maven.
|
|
That command resulted in this error:
[INFO] [ERROR] Failed to execute goal
org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy
(default-deploy) on project pdf-form-replace-font2: Deployment
failed: repository element was not specified in the POM inside
distributionManagement element or in
-DaltDeploymentRepository=id::layout::url parameter -> [Help 1]
I had added `release:perform` because it's described as the second step
in releasing in this document:
https://maven.apache.org/maven-release/maven-release-plugin/usage.html
However, as explained in
https://maven.apache.org/maven-release/maven-release-plugin/usage/perform-release.html
, `release:perform` runs the `deploy` target, which doesn't make sense
for this project. It seems like we only need `release:prepare` to do a
Maven-driven release.
|
|
|
|
When I tried packaging with MacPorts, the path written to the shell
wrapper was the temporary MacPorts build path, not the final install
path.
My plan is to extract the shell wrapper build to the `package` stage,
and do something with the variables to give it the correct install path.
Not sure what that something is yet, but that's the idea.
|
|
Need this to package with MacPorts.
|
|
|
|
|
|
Facilitate installation for package management. Package our
`pdf-form-replace-font2` shell script so that it runs the JAR at the
correct install location.
|
|
Quiet the following warning output that appeared when running the
executable:
$ java -jar target/pdf-form-replace-font2-0.0.1-SNAPSHOT.jar --find HelveticaLTStd-Bold --replace CourierNewPSMT --output f1040-courier.pdf f1040.pdf
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
|
|
We no longer need these.
|
|
Didn't make sense to have the `replacePdfFieldFont` function do things
related to command line argument parsing.
I had done it that way originally because that's how my mind worked out
the standard input and output handling at the time.
|
|
|
|
|
|
|
|
I'm not using tests here, so rather than keep useless tests cluttering
the project I decided to remove them.
This causes the `mvn package` task to fail, so I added a skip test
configuration on the Maven Surefire plugin as described by smp7d
(https://stackoverflow.com/users/395975/smp7d) on Stack Overflow:
https://stackoverflow.com/questions/7456006/maven-package-install-without-test-skip-tests/7502723#7502723
|
|
No longer used now that we switched to Maven.
|
|
Copy from 'pdf-form-replace-font' with small modifications to align with
the present project.
|
|
|
|
|
|
I had used Java 11 in order to use the `var` syntax, which seemed
pleasantly more concise, however, I discovered that the machine I want
to deploy this application to only has a Java 8 SDK, and I don't want to
bother messing with it and going on a potential yak shaving quest.
|
|
Make the program dynamic and use the command line arguments when
performing font replacement.
|
|
Set `input`, `find`, `replace`, and `output` from command line
arguments. These will be used to generate the output PDF.
|
|
|
|
Thanks to this Stack Overflow answer by mysomic
(https://stackoverflow.com/users/27241/mysomic) for explaining how to
get the program version in a Maven pom.xml context:
https://stackoverflow.com/questions/2712970/get-maven-artifact-version-at-runtime/12571330#12571330
|
|
Used the following resources to see how to parse command line options
using commons-cli:
- https://reintech.io/blog/java-command-line-applications-parsing-processing-arguments
- https://commons.apache.org/proper/commons-cli/usage.html
Reusing the options from 'pdf-form-replace-font'.
|
|
Package everything including our dependencies into a single JAR file.
Thanks to these Stack Overflow answers for explaining that I needed to
exclude the signature files from the final package:
- https://stackoverflow.com/questions/999489/invalid-signature-file-when-attempting-to-run-a-jar/6743609#6743609
- https://stackoverflow.com/questions/34855649/invalid-signature-file-digest-for-manifest-main-attributes-exception-while-tryin/34856095#34856095
|
|
Move this to a new function to make room in `main()` for command line
argument parsing.
|
|
Not sure what the commn Java style is for wildcard imports, but I didn't
really like them, so replace them with explicit type imports.
|
|
Now that we have something that works, remove the old code from when I
was testing things out.
|
|
Build our earlier code with Maven.
|
|
Thanks to this Stack Overflow answer by Raphaƫl Colantonio
(https://stackoverflow.com/users/3728901/rapha%c3%abl-colantonio) for
the tip about type:pom :
https://stackoverflow.com/questions/70086051/itextpdf-dependency-not-found-by-maven/70090910#70090910
Without that tag, the compile failed.
|
|
|
|
The previous one wouldn't compile because I used hyphens in my package
name. Regenerate the project structure replacing the hyphens with
underscores:
$ mvn archetype:generate -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-simple -DarchetypeVersion=1.4
...
Define value for property 'groupId': com.teddywing.pdf_form_replace_font2
Define value for property 'artifactId': pdf-form-replace-font2
Define value for property 'version' 1.0-SNAPSHOT: : 0.0.1-SNAPSHOT
Define value for property 'package' com.teddywing.pdf_form_replace_font2: :
Confirm properties configuration:
groupId: com.teddywing.pdf_form_replace_font2
artifactId: pdf-form-replace-font2
version: 0.0.1-SNAPSHOT
package: com.teddywing.pdf_form_replace_font2
Y: :
|
|
I followed the Maven Getting Started
(https://maven.apache.org/guides/getting-started/index.html) guide to
set up a project structure so I could use it to manage dependencies. I
picked the 'maven-archetype-simple' archetype
(https://maven.apache.org/archetypes/maven-archetype-simple/).
This code was generated with the following command and interactive
prompts:
$ mvn archetype:generate -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-simple -DarchetypeVersion=1.4
Define value for property 'groupId': com.teddywing.pdf-form-replace-font2
Define value for property 'artifactId': pdf-form-replace-font2
Define value for property 'version' 1.0-SNAPSHOT: : 0.0.1-SNAPSHOT
Define value for property 'package' com.teddywing.pdf-form-replace-font2: :
Confirm properties configuration:
groupId: com.teddywing.pdf-form-replace-font2
artifactId: pdf-form-replace-font2
version: 0.0.1-SNAPSHOT
package: com.teddywing.pdf-form-replace-font2
Y: :
|
|
|
|
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.
|
|
Still working on this, trying to figure out why the font replacement
isn't working.
|
|
|
|
Don't change all of the input fields' font to the replacement, only
those with a specific font we want to replace.
|
|
Use iText to change the font of interactive form fields in a PDF.
Changes the font in 'f1040.pdf' to Courier.
This code is based on the following example from iText:
https://kb.itextsupport.com/home/it7kb/ebooks/itext-7-jump-start-tutorial-for-net/chapter-5-manipulating-an-existing-pdf-document-net#Chapter5:ManipulatinganexistingPDFdocument|.NET-Changingthepropertiesofformfields
For now I just downloaded the dependencies' JAR files and put them in a
'lib/' directory rather than have to learn how to use a dependency
management tool like Maven. Here is the contents of the 'lib/'
directory:
barcodes-7.2.2.jar
commons-7.2.2.jar
font-asian-7.2.2.jar
forms-7.2.2.jar
hyph-7.2.2.jar
io-7.2.2.jar
kernel-7.2.2.jar
layout-7.2.2.jar
pdfa-7.2.2.jar
pdftest-7.2.2.jar
sign-7.2.2.jar
slf4j-api-1.7.9.jar
styled-xml-parser-7.2.2.jar
svg-7.2.2.jar
To run this:
$ make
$ make run
|