mbattyani / cl-pdf

CL-PDF is a cross-platform Common Lisp library for generating PDF files.
Other
115 stars 41 forks source link

Allow copying and removing pages in templates #7

Closed pederkl closed 8 years ago

pederkl commented 8 years ago

I want to use a two-page template (first- and follow-on-pages) to generate single, two- or multipage output. This required changes to pdf-parser.lisp.

To achieve my goals I extended the signature of with-existing-page to take a new keyword parameter copy-p. If nil, the existing template page is edited, as before. If non-nil, a copy of the page is inserted at the end of the document.

To remove unneeded template pages, I added a new exported function remove-page.

Perhaps someone else also finds this useful. I make no claims that the code is optimal, I do not really understand the structure of PDFs or the cl-pdf representation of it. But through trial and error, this seemed to do the job I wanted it to.

mbattyani commented 8 years ago

Looks like a very useful feature. Thanks!