Implementing PDF Plug in Features

Overview:

The PDF module enhances the input/output functionality in LEADTOOLS by supporting a number of powerful and complex file formats including:

PDF (Portable Document Format), developed by Adobe Corporation, allows users to exchange and view electronic documents independent of their development environment. PDF files look the same on screen and in print regardless of the computer type or software package used to create them. One major advantage of PDF is that large documents can be compressed small enough to download very quickly, yet still display content as if you were looking at the original source.

PDF has emerged as a powerful format for reproducing documents over the web. Because of its high precision and accuracy in representing text and pictures, as well as hypertext capability, PDF has become a popular alternative to HTML and Postscript.

PS (Postscript) is a simple interpretive page description language. Its primary application is to describe the appearance of text, graphical shapes, and sampled images on printed or displayed pages. Some of the page description and interactive graphics capabilities of the PostScript language include arbitrary shapes, painting operators, text fully integrated with graphics and sampled images derived from natural sources. Postscript is the language that most advanced laser printers use in order to render electronic information on a printed page.

EPS (Encapsulated PostScript) is a PostScript language program describing the appearance of a single page, usually intended to be embedded inside another PostScript language page description. The EPS file can contain any combination of text, graphics, and images, and it is the same as any other PostScript language page description with a few limitations.

Loading Capabilities.

The LEADTOOLS PDF plug-in has the following import capabilities:

1.

Loads essentially all PDF 1.4 (Acrobat 5.x compatible) files.

2.

Loads all PostScript Language Level 3 files.

3.

Loads any EPS file.

Load support is multi-page, with the option to to find the number of pages in a document and specify which document page(s) to load.

Control options for customizing the resulting rasterized page include:

1.

Pixel depth. Valid values are 1, 4, 8, and 24 .The default value for this control parameter is 24.

2.

Horizontal resolution in dots per inch with a default value of 96.

3.

Vertical resolution in dots per inch with a default value of 96.

4.

Ability to use either library installed fonts (fonts installed by the plug in) or system fonts. The default value of this control option is to use library installed fonts.

5.

Font anti-aliasing. Valid values are 1-bit (no anti-aliasing), 2-bit, and 4-bit anti-aliasing. The default value is 4, which gives maximum anti-aliasing.

6.

Graphics anti-aliasing. Valid values are 1-bit (no anti-aliasing), 2-bit, and 4-bit anti-aliasing. The default value is 1.

You can use the function L_GetPDFOptions to get the default values for control options that are used when loading a file. You can then use the function L_SetPDFOptions to change the values for the control options.

Saving Capabilities.

Full multi-page write support for the PDF format is provided by this module. This plug in lets you append, insert, replace or delete specific pages in a PDF file created with LEADTOOLS.

The plug-in gives you a wide range of control options for the resulting image data in terms of compression, including:

1.

No compression

2.

Compressed using CCITT Group 3, 1 dimension. For 1-bit images.

3.

Compressed using CCITT Group 3, 2 dimensions. For 1-bit images.

4.

Compressed using CCITT Group 4. For 1-bit images.

5.

JPEG compression and YUV 4:4:4 color space loss-less. Bits per pixel: 8 for grayscale, 24 for color.

6.

JPEG compression and YUV 4:2:2 color space. Bits per pixel: 8 for grayscale, 24 for color.

7.

JPEG compression and YUV 4:1:1 color space. Bits per pixel: 8 for grayscale, 24 for color.

The plug-in also gives you control over the type of encoding to be used in order to change compressed image data into a text format .The text encoding techniques include:

1.

No text encoding at all.

2.

Use ASCII 85 text encoding algorithm.

3.

Use ASCII HEX text encoding technique.

A number of new flags have been added to the SAVEFILEOPTION structure, in order to specify which type of text encoding to use when saving. For more information, please refer to that structure for more details. In addition, LEAD provides the FILEPDFSAVEOPTIONS structure to let you control the security of and access to the PDF file that is saved. These include user and owner passwords, encryption options, and the capabilities the user of the resulting PDF document will have. To determine the current options used when saving a PDF file, call L_GetPDFSaveOptions. To set the options used when saving a PDF file, call L_SetPDFSaveOptions.

Distributing an application built using the PDF Module

The PDF plug-in requires initialization files in order to work properly. Before distributing an application built using this plug-in, setup the end-user machine with appropriate directories and files as follows:

1.

Create a main directory (referred to later as MAIN) on the hard-drive to contain the files. For example "C:\Pdf".

2.

Create 3 subdirectories within this "MAIN" directory, named "Lib, "Fonts", and "Resource".

3.

Copy the contents of the directory Bin\Common\\Pdf\Fonts to the "Fonts" directory.

4.

Copy the contents of the directory Bin\Common\Pdf\Lib to the "Lib" directory.

5.

Copy the contents of the directory Bin\Common\Pdf\Resource to the "Resource" directory.

6.

Setup the registry configuration below:

 

a.

Create the following registry key:
HKEY_LOCAL_MACHINE\SOFTWARE\LEAD Technologies, Inc.\Pdf

 

b.

Under this key create a string value named "GS_LIB".

 

c.

Set the "GS_LIB" value as:
MAIN\Lib;MAIN\Fonts;MAIN\Resource

For Example, if MAIN stands for "C:\Pdf"then this would become:
C:\ Pdf\Lib;C:\ Pdf\Fonts;C:\ Pdf\Resource

NOTE: If a user installs separate software applications that use different versions of the LEADTOOLS® PDF filter, and both applications use the default PDF initialization directories, the runtime library of the second application installed will overwrite the runtime library of the first application installed. This overwrite can be avoided by setting the PDF initialization directories using the L_SetPDFInitDir function to some location other than the default. To get the current path of the PDF initialization directories, call L_GetPDFInitDir.

See Also:

Summary of All Supported Image File Formats