How PDF files are displayed
PDF is not itself a display format, but rather a container for content. Regardless of which specific technology is used, PDF files are prepared for display through a process known as “rendering”. As outlined in this blog post, this involves parsing PDF content and translating it into a form, such as an image, that can be readily displayed in a viewer. Rendering PDF content is also a required step before a PDF can be printed or saved into an image or other graphical format.
Regardless of the specific technology used, the following steps must be taken any time a PDF needs to be displayed:
- Locate the page object in the PDF.
- Extract the page’s content streams (one or more strings).
- Parse the content stream to get the page description commands (these are similar to PostScript language commands).
- The content streams commands refer to one or more resources (fonts, images, etc.) – these resource objects are located in the PDF and images are decoded and fonts are processed to obtain the glyph outlines.
- As the page content is followed there are operations that adjust the user matrix which change the position, scaling and rotation.
- These commands and/or objects collectively describe the page in mathematical terms and are then converted into an appropriate output. This can be either an image (using GDI+ in our case) or a different graphical language like EPS, EMF/WMF etc.
- Text is simply a collection of shapes just like other graphic content.
It is possible to build PDF viewing software using only Foxit Quick PDF Library; however, the process is significantly more efficient, flexible and powerful when this is used in conjunction with the Debenu PDF Viewer SDK.
This article refers to a deprecated product. If you are looking for support for Foxit PDF SDK, please click here.
Updated on May 16, 2022