Cracking the Code: Creating Images in PDFs
If you need to build brochures, flyers, presentations, or other types of media that includes images, PDF is the perfect format for doing so. PDF supports images and other rich media, and there are many options when it comes to creating images in PDFs.
Read Are Your PDFs Print-Ready?
We have several code samples available for the Adobe PDF Library that can help you create and edit images in PDFs. This post will focus on samples related to the creation of images.
Note: The samples in this post are written in C++, but we have other samples available for .NET Framework and Java.
Creating Thumbnails
In a PDF document, a thumbnail is a small graphic image that represents a page.
Thumbnails appear in a panel on the left side of the Adobe Acrobat window and aid in navigating through a document, as a user can scroll through a series of thumbnails quickly to find a page.
The AddThumbnailsToPDF sample program shows how to create thumbnails for a PDF document – one for each page. The program saves the thumbnail images in a PDF output file, using an indexed color table with 256 colors RGB.
Creating Transparent Images
PDF files can have objects that are partially or fully transparent, and thus can blend in various ways with objects behind them. Transparent graphics or images can be stacked in a PDF, with each one blending to contribute to the final result that appears on the page. In this sample the text behind the image is partially visible.
The CreateImageWithTransparency sample shows how to create a transparency within a PDF document, in the form of a graphic image with an art graphic layered on top.
Creating Color Separations
Color separation is part of high-volume offset printing processing. The original digital content is color separated to create a set of plates for printing, generally one plate per page for each of the primary colors—Cyan, Magenta, Yellow, and Black (CMYK). During printing, each color layer is printed separately, one on top of the other, blended together to create the depth and variety of color in the final images. A spot color is a separate color added on top of the image after the four color plates are used to create the initial print run.
This sample will read each page from a document, and create a set of bitmap images for each page. The first image will show the entire page in CMYK. It will then create separations for the page into Cyan, Magenta, Yellow, Black, and spot colors.
All of these images will be inserted, one page per image, into the output document created. The process and spot color plating will be rendered visually in DeviceGray.
The CreateSeparations sample demonstrates how to create color separations for spot color images.
We invite you to check out the Datalogics GitHub Repository for more information on Adobe PDF Library and samples for the
Streamline your development workflow
Start a free trial and discover how our PDF SDK can minimize your development time.