Import

    • If you pass in a single image file name a single page PDF will be created.

    • If you pass in a list of image files a photo album gets created as a result of the concatenation of pages containing a single image each.

    • By supplying a configuration string you can specify layout details like position, dimensions, scaling and the paper size to be used.

    • The command will create the output file if it does not exist otherwise it will append to it. This feature comes in handy when you have a cover page and want to append a photo album to it.

    A configuration string to specify the details of the image layout on the page.

    Anchors for positioning

    Default description

    • You only have to specify any parameter diverging from the default.

    • Only one of dimensions or format is allowed.

    Examples

    Create a single page photo.pdf containing photo.png using the default positioning p:full. The page size dimensions will match the dimensions of the image:

    1. pdfcpu import photo.pdf photo.png

    Create a single page PDF using paper size f:A5 using the default orientation portrait which could also be expressed with f:A5P. Use the positioning parameter p:c to center the image on the page and the default relative scaling s:0.5 rel:

    1. pdfcpu import 'f:A5, p:c' photo.pdf photo.jpg

    Import - 图2

    Create a single page PDF using paper size f:A5L using the orientation landscape. Use the positioning parameter p:c to center the image on the page and the default relative scaling :

    Create a single page PDF using A5 landscape mode, a relative scaling of 0.5 and the positioning p:bl which anchors the picture to the bottom left page corner:

    1. pdfcpu import 'f:A5L, p:bl' photo.pdf photo.jpg

    Import - 图4

    1. pdfcpu import 'f:A5L, p:r, o:-20 0' photo.pdf photo.jpg

    Import photo.jpg into a 500 x 500 single page PDF anchoring the image to the top left corner using a relative scaling of 0.3:

    1. pdfcpu import 'd:500 500, p:tl, s:0.3 rel' photo.pdf photo.jpg

    Import - 图6

    Import photo.jpg into a 500 x 500 single page PDF anchoring the image to the top left corner using a scaling of 1:

    Generate a PDF photo album assuming pics/ contains image files (jpg, png, tif):

    1. pdfcpu import album.pdf pics/*

    Generate a PDF photo album with images centered on the page using the default relative scaling of 0.5:

    1. pdfcpu import 'p:c' album.pdf pics/*

    The following command also generates a PDF album but additionally configures the paper size Letter and positions the images to be anchored to the bottom left corner with a horizontal offset of 10 points and a vertical offset of 20 points with a scaling of 0.3 relative to page dimensions: