iPDFdev Tips & Tricks for PDF development

IFXPDFFactory – part 11 – Document information and viewer preferences

February 24th, 2015

The document information stores metadata about the document. The viewer preferences specify how the PDF file should be displayed in the viewer.

IFXPDFFactory – part 9 – PDF optional content / layers

September 04th, 2013

PDF optional content (also known as PDF layers) refers to sections of content in a PDF document that can be selectively viewed, printed or hidden by document authors or consumers. This feature is now implemented in IFXPDFFactory framework.

PDF page imposition using CoreGraphics on iOS

June 11th, 2013

A recent question on StackOverflow asked about how to create a single large PDF page from multiple PDF pages. This process is known as page imposition, it lets you combine multiple PDF pages onto larger sheets to create books, booklets or other special arrangements.

My answer to that question handled only the situation when all the source pages had the same size and rotation. The code here is more complex and it handles any combination of page sizes and rotation.

IFXPDFFactory – part 6 – Vector graphics

March 12th, 2013

After a long break and finishing the implementation of several internal details that will support the future public APIs, the library is ready to create content. For the beginning I added support for vector graphics: lines, curves, etc.

Lets see how they work.

IFXPDFFactory – part 5 – Pens and brushes

January 10th, 2013

In the previous post I showed the color support in IFXPDFFactory. How are these colors actually used? Pens and brushes enter the scene here.

Find images on PDF pages on iPhone and iPad

July 02nd, 2012

There are situations when we need to know if a PDF page contains, images, where on the page are the images located, what is the size on the page of a displayed image or other information about images in a PDF page.
Some of this information is available directly in the PDF file, other information needs to be computed.

Links navigation in a PDF document on iPhone and iPad

June 21st, 2011

iOS provides good support for displaying PDF files, but it lacks any support for the interactive features in the PDF files, such as annotations, links, form fields. In this article I'll show how to implement navigation in a PDF document using the links defined on document's pages. The project attached to this article is based on Apple's ZoomingPDFViewer sample that has been updated to support links navigation.

Convert an image to PDF on the iPhone and iPad

April 22nd, 2011

A reader asked a me about image to PDF conversion a few days ago and I promised him an article, so here it is.

Image to PDF conversion is based on Quartz API. Using Quartz we can create PDF files and add content to them, the conversion actually means drawing the image on a PDF page.

Let's begin.

Convert a PDF page to image on the iPhone and iPad

March 28th, 2011

A common requirement when working with PDF files is to convert them to images. Because the iOS includes native PDF support, converting a PDF page to image seems easy. A graphic context is created for the image, the PDF page is rendered on image's graphic context and then the image is saved. Yet there is a catch when rendering the PDF page on the image's graphic context.

Now lets see how we put this idea into practice and convert a PDF page to image at a specific resolution.

Display a PDF page on the iPhone and iPad

March 23rd, 2011

Displaying a PDF page in an iPhone/iPad application seems pretty simple since the iOS includes a PDF API but there a few pitfalls. The iOS SDK includes the ZoomingPDFViewer sample and there are also several examples on the internet that show how to do this. The thing with Apple’s ZoomingPDFViewer and the other examples is that they have several flaws: rotated pages are not handled correctly, the actual position of MediaBox and CropBox is not considered, they cannot scale higher than 100% and they do not clip the content relative to CropBox as any PDF viewer does. The test files available for download at the end of this article let you verify these issues.

This article will show how to take care of the above problems and display a PDF page at a specific position in the view with a user defined zoom level.