Add `--pdfmarks` option to pdf-merge.py.
This makes it easy get a pdfmark file from one PDF and and apply it to
another (among other things). The workflow suggested by Larry was:
On Thu, Feb 09, 2012 at 03:25:09PM +0800, Larry Cai wrote:
> 1. pdftk source.pdf dump_data_utf8 > in.info # save rawdata
> 2. pdftk A=book-cover.pdf B=source.pdf cat A1-2 B3-end output replaced.pdf
> # replace two pages for the book
> 3. pdf-convert < in.info > pdfmarks
> 4. gs -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=output.pdf
> replaced.pdf pdfmarks # put bookmark back
With the new option, you can accomplish the same goal with
$ rm -f pdfmarks
$ pdf-convert.py --pdfmarks pdfmarks source.pdf
$ pdftk A=book-cover.pdf B=source.pdf cat A1-2 B3-end output replaced.pdf
$ pdf-convert.py --pdfmarks pdfmarks --output output.pdf replaced.pdf
With the first call to pdf-convert.py creating pdfmarks (using
`pdftk`), and the second call applying it (using `gs`).