Folks!
In order to get rid of the CLI message about validating links please go get the latest commit.
This somehow sneaked into release and I am not ready to push another release yet.
Thank you!
Hello dear pdfcpu user!
👩🏽🔬 This release extends the image command so you can update individual images in a PDF.
It also extends the pdfcpu configuration with parameters for controlling outbound HTTP access and introduces the config version.
Moreover we introduce a config command that lets you reset the config.yml to the current major version whenever pdfcpu issues a corresponding warning or you just feel like it for other reasons.
And we have a nice extension for the booklet command and lots of fixes and parser improvements.
Let's dive right in.. 🤿
Update Images
pdfcpu images list [-p(ages) selectedPages] -- inFile...
pdfcpu images extract [-p(ages) selectedPages] -- inFile outDir
pdfcpu images update inFile imageFile [outFile] [ objNr | (pageNr Id) ]
Using the new images command you can now update images in your PDF file.
Consider the following use case:
pdfcpu images list gallery.pdf
gallery.pdf:
1 images available (1.8 MB)
Page Obj# │ Id │ Type SoftMask ImgMask │ Width │ Height │ ColorSpace Comp bpc Interp │ Size │ Filters
━━━━━━━━━━┿━━━━━┿━━━━━━━━━━━━━━━━━━━━━━━━┿━━━━━━━┿━━━━━━━━┿━━━━━━━━━━━━━━━━━━━━━━━━━━━━┿━━━━━━━━┿━━━━━━━━━━━━
1 3 │ Im0 │ image │ 1268 │ 720 │ DeviceRGB 3 8 * │ 1.8 MB │ FlateDecode
Extract all images into the current dir:
pdfcpu images extract gallery.pdf .
extracting images from gallery.pdf into ./ ...
optimizing...
writing gallery_1_Im0.png
Let's update the image with Id=Im0 on page=1 with gallery_1_Im0.png:
pdfcpu images update gallery.pdf gallery_1_Im0.png
or update the image object (#3) with logo.png:
pdfcpu images update gallery.pdf logo.png 3
or why not updating the image with Id=Im0 on page=1 with logo.jpg:
pdfcpu images update gallery.pdf logo.jpg 1 Im0
You can also dry run the command ofcourse and write to some out.pdf:
pdfcpu images update gallery.pdf gallery_1_Im0.png out.pdf
pdfcpu images update gallery.pdf logo.png out.pdf 3
pdfcpu images update gallery.pdf logo.jpg out.pdf 1 Im0
The behavior of pdfcpu images extract
is the same like pdfcpu extract -mode image
.
See more here and don't forget there is always pdfcpu help images
.
Reset Configuration and new config command
Sometimes it is necessary to extend the pdfcpu configuration.
In such a case if you upgraded to a new release in the past you had to manually remove your config.yml
and it would get upgraded on the execution of the next command on the CLI.
This is now history.
Starting with this release pdfcpu will issue a warning if your configuration needs to be upgraded:
**************************** WARNING ****************************
* Your configuration is not based on the current major version. *
* Please backup and then reset your configuration: *
* $ pdfcpu config reset *
*****************************************************************
The warning will only appear if the major version of the installed pdfcpu executable
does not match the major version of the new configuration version we are also introducing with this release:
# version (Do not edit!)
version: v0.9.1 dev
If you do not reset your configuration in this situation you are risking nasty side effects and in worst case a hard landing - Ouch.. 🚑
From now on all you have to do is execute the new config reset
command:
$ pdfcpu config reset
Did you make a backup of /Users/horstrutter/Library/Application Support/pdfcpu/config.yml ?
(yes/no): yes
Are you ready to reset your config.yml to v0.9.1 dev ?
(yes/no): yes
resetting..
Ready - Don't forget to update config.yml with your modifications.
Using the occasion we extended what you know as pdfcpu config
into:
$ pdfcpu help config
usage: pdfcpu config list
pdfcpu config reset
Make sure you also read the docs.
Controlling Http Traffic
Right now there are two use cases involving outbound Http traffic:
- validation check for broken links
- loading images into image boxes
We are introducing 2 new configuration parameters with this release:
# internet availability.
offline: false
# http timeout in seconds.
timeout: 5
There is also a new offline
common flag for operations which is probably most useful for testing scenarios and consistent benchmarking.
Extended Booklet command
Thanks to @adamgreenhall for once again making the booklet command even more powerful.
Please check out all the details here.
In addition feel free to consult pdfcpu help booklet
.
🙏🏻 Thanks 🙏🏻
to all of you for reporting bugs and testing fixes.
Special shoutout also to @carlwilson and everybody else for putting time into submitting a PR.
✨ All of this ensures pdfcpu gets more robust and better and better by the minute ✨
Changelog
- 1d4a5a6 Bump version
- c703429 Fix config file handling
- 853c877 Bump version
- a7c32de Add warning if config.yml is outdated, add config reset cmd.
- 22ebeff Booklet 8up orientations (#969)
- b1b9f99 Fix #868, add config parms offline, timeout
- 23311b7 Fix #859, #965
- dc38554 Fix #897
- 9a32118 Fix #455
- bb789c7 Fix form validation
- ac650d9 Fix #940
- 9749d6d Fix #953
- 8711370 Fix #955
- e2a8e58 Fix #951
- 84cdec0 Fix #948
- 007356f Merge pull request #947 from carlwilson/docker-entrypoint
- 748b3cb Merge remote-tracking branch 'upstream/master' into docker-entrypoint
- 3f7e650 FIX: Docker run command in README
- 75f26b2 Fix #935, Clean up
- 0174d86 Fix Docker execution instructions in README.
- e2441b9 Fix #941
- 5677395 Use Docker ENTRYPOINT rather than CMD