5 Things You Can Do With DocumentAlchemy

the DocumentAlchemy blog

 
Last Updated:
5 Things You Can Do With DocumentAlchemy

5. Add a Cover Page to a PDF Document

You have a collection of PDF files.

You want to put those files up on the website, but not before adding a “cover-page” that indicates their source and your company's contact information.

The cover page is also a PDF file, so your objective is to insert a single page at the beginning of each of the source documents.

You can use DocumentAlchemy's “join documents” REST endpoint to insert that cover page.

For example, to add a cover page to a single PDF file, you can use the following curl command:

where TITLE-PAGE.PDF is your cover page and DOC_BODY.PDF is the document you want to add the cover page to.

Here's a shell-script that will add a cover page to each document listed on the command line:

Save the script as add-cover.sh, make sure it is executable (chmod a+x add-cover.sh) and run it like this:

./add-cover.sh cover-page.pdf documents/*.pdf

to create a copy of each PDF file in documents with cover-page.pdf inserted.

Note that the generated files will be found in the same directory as the source file, with the string covered- added to the file name.

EDIT: See “Add a cover page to a PDF document” in “Five Things You Can Do With the DocumentAlchemy API - Command-Line Interface Edition” for an even easier interface to this functionality.

About DocumentAlchemy

DocumentAlchemy is a RESTful web service that developers can use to add document generation, conversion and processing features to their app.

Visit our live demonstrations or interactive API reference to explore Document Alchemy's rapidly growing API for working with MS Office documents, PDFs, images, web pages and more.


Copyright © 2017 DocumentAlchemy.