v0.4.0
Hello, the main focus of this release is PDF form management!
This release has been a long time coming π Thank you π for your patience!
API-Users, please proceed with caution!
The codebase has been refactored heavily and there may be some side effects.
E.g. usages of: api.Merge(rsc []io.ReadSeeker,...) need to be migrated to api.MergeRaw(rsc []io.ReadSeeker, ...)
pdfcpu v0.4.0 is now based on go1.20 and comes with two new commands:
- The new powerful
form
command solves all major form handling usecases:
pdfcpu form list inFile...
pdfcpu form remove inFile [outFile] fieldID...
pdfcpu form lock inFile [outFile] [fieldID...]
pdfcpu form unlock inFile [outFile] [fieldID...]
pdfcpu form reset inFile [outFile] [fieldID...]
pdfcpu form export inFile [outFileJSON]
pdfcpu form fill inFile inFileJSON [outFile]
pdfcpu form multifill [-m(ode) single|merge] inFile inFileData outDir [outName]
DISCLAIMER 1
You are free to export and fill already existing PDF forms - this may or may not work!
Feel free to open an issue and we may be able to make it work.
DISCLAIMER 2
All forms generated with pdfcpu create
are optimized for Adobe Reader.
Mac Preview is not suited well for form handling!
The following workflows are supported:
The Regular Workflow
- Create your form with the already introduced
create
command. - Print a
list
of your form fields on the command line. export
your form to JSON,- Edit your JSON and enter your form data.
fill
your form with this JSON payload.- Optionally write protect individual fields using
lock
.
The Fill & Merge Workflow
"Give me access to your contacts db and I will generate a single PDF containing a page sequence of contact sheets"
This usecase is implemented by extending the regular workflow by an additional integrated merge step.
As for automatically filling a form with your data pdfcpu gives you two options:
- JSON - better suited for API providers, verbose but powerful JSON elements, allows full fledged imageBoxes for image fields
- CSV - for on-premises bulk fill scenarios, one CSV line representing a form instance, has its limitations eg. need to fake image fields
- The new
resize
command comes to the rescue when you're stuck with some large pages in front of a regular small form printer:
pdfcpu resize [-p(ages) selectedPages] -- [description] inFile [outFile]
Scale your pages up or down or resize to one of the many supported standard form sizes (pdfcpu paper
prints a list ) optionally enforcing portrait or landscape mode:
Examples:
pdfcpu resize "scale:2" in.pdf out.pdf
Enlarge pages by doubling the page dimensions, keep orientation.
pdfcpu resize -pages 1-3 -- "sc:.5" in.pdf out.pdf
Shrink first 3 pages by cutting in half the page dimensions, keep orientation.
pdfcpu resize -u cm -- "dim:40 0" in.pdf out.pdf
Resize pages to width of 40 cm, keep orientation.
pdfcpu resize "form:A4" in.pdf out.pdf
Resize pages to A4, keep orientation.
pdfcpu resize "f:A4P, bgcol:#d0d0d0" in.pdf out.pdf
Resize pages to A4 and enforce orientation(here: portrait mode), apply background color.
pdfcpu resize "dim:400 200" in.pdf out.pdf
Resize pages to 400 x 200 points, keep orientation.
pdfcpu resize "dim:400 200, enforce:true" in.pdf out.pdf
Resize pages to 400 x 200 points, enforce orientation.
Countless bugs have been rolling in and many of those have been fixed. Thank you π all also for your PRs π π
Unfortunately due to heavy refactoring of the code base some of them had to be merged in manually or still will be.
Changelog
- 7ff654b Bump version
- 580f9d7 Update form samples
- 4ac95e3 Fix #461
- 98c062b Fix #537
- 4e12e03 Fix #363,#524
- 73a7d98 Fix #535
- b45bfb7 Fix #539
- 74efd88 Fix #515
- d26377a Fix #481 Add Rene Kaufmann to contributors
- de1d264 Fix #430 Add Dmitry Ivanov to contributors
- 7af9343 Eliminate io.ReadAll
- a86469b Fix #447
- 7a47cb5 Bump go.mod
- 363a1f2 Add form handling
- 07d9762 Fix #523
- 97106ac Fix #511
- 8f6a813 Fix #466
- a45919b Fix #522
- aa87096 Update Dockerfile (#518)
- 9aa382a fix ListImages comment (#516)
- a021566 Fix #479
- ba2518c Fix #459
- bfaf786 Fix #489
- 4382301 Fix #458
- d8d83be Fix #469
- b9818b8 Fix #497
- d16027e Fix #493
- 5ef3bae Fix #494
- 3decd49 Fix #488
- 5d37c49 Fix #487
- fe532c2 Fix #485
- 0ce7ef0 Fix #471, #475, #478
- 8b9e92e Fix #480
- 11d755a Fix #457
- 432b649 Fix #453
- c54a411 Cleanup
- c202488 Fix free list validation
- e456479 Fix #357, #451
- 74d211b Fix #389
- 8f9a93c Add Fedora instructions (#439)
- a056f85 Fix #446
- 15f4842 Fix #380
- 437ac57 Fix #440
- 437b0a0 Fix #438
- e3d3f26 Fix #429
- adf6c1b Fix #434
- 515c2ef Fix #437
- 17e5f68 Fix #442, #443
- 8c35cdc Cleanup
- 92c29f7 Cleanup
- 1b1f5e4 go lint
- a002745 Fix #385
- 96a0a30 Fix #391
- b8b77ee Fix #411
- 31d2490 Fix #414
- f23a3da Fix #418
- 68200b9 Fix #413
- ad65664 Add issue template
- c78f959 Cleanup
- 013a11b Fix #402
- 8767334 Fix #400
- 6b5d856 Fix of a bug in Fix #407
- df8cec3 Fix #407
- f5de06f Fix #404
- 5a3802e Fix #379
- 9d3225c Add Eng Zer Jun as contributor
- 8e53ad6 refactor: move from io/ioutil to io and os packages (#403)
- c37ef1a Integrate #397, Add Juan Iscar as contributor
- e9f927d Fix #396, Add config cmd
- a8a031e Fix #398