Send comments on this topic. | Back to Introduction - All Topics | Help Version 15.12.21
Implementing PDF Plug in Features

Overview:

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

  • PDF PDF stands for Portable Document Format. It was developed by Adobe Corporation to allow users to exchange and view their electronic documents in an easy and reliable way , independent of the environment in which these documents were created. A PDF file will look the same on the screen and in print regardless of what kind of machine you are using or which software package was used to create that file. One major advantage of PDF is that a large document can be compressed small enough to download very quickly, and still displays content as if you were looking at the original source such as a book or magazine.

PDF is emerging as a powerful format for reproducing documents over the web. Because of its high precision and accuracy in representing text and pictures along with its "hyper" nature, PDF is becoming 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 EPS stands for encapsulated PostScript. An EPS file is a PostScript language program describing the appearance of a single page. Usually, the purpose of the EPS file is 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 only a few limitations.

Loading Capabilities.

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

  1. Loads essentially all PDF 1.3 (Acrobat 4.x compatible) files.

  2. Loads all PostScript Language Level 3 files.

  3. Loads any EPS file.

The loading support is of course multi-page, where you can specify which page to load from the file and to find the number of pages in a certain document.

The plug-in gives the user a number of control options in order to customize the resulting rasterized page. These options 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 1bit(no anti-aliasing), 2 and 4-bit anti-aliasing. The default value is 4, which gives maximum anti-aliasing.

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

You can use RasterCodecs.Options.Pdf for control options that are used when loading a file.

Saving Capabilities.

Full multi-page write support is provided by this module for the PDF format. This plug in lets you append, insert, replace or delete specific pages in a PDF file created by 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.

A number of new save format constants have been added to LEADTOOLS in order to support types of files created by the PDF plug-in. For a list of these, please refer to Summary of All Supported Image File Formats.

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.

In order to specify which type of text encoding to use when saving, refer to TextEncoding.

LEAD provides the CodecsPdfOptions.Save property in order to specify which type of text encoding to use when saving and 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 or set the current options used when saving a PDF file use RasterCodecs.Options.Pdf.Save.

Distributing an application built using the PDF Module.

The LEADTOOLS PDF plug-in needs some initialization files in order to work properly. Before distributing an application built using this plug-in, you need to set up the end-user machine with appropriate directories and files. To do so, perform the following steps:

  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. Name them "Lib", "Fonts", and Resource".

  3. Copy the contents of the directory "Redist\Pdf\Fonts" to the "Fonts" directory.

  4. Copy the contents of the directory "Redist\Pdf\Lib" to the "Lib" directory.

  5. Copy the contents of the directory "Redist\Pdf\Resource" to the Resource" directory.

Perform the following steps to configure the registry:

  1. Create the following registry key:

    
    "HKEY_LOCAL_MACHINE\SOFTWARE\LEAD Technologies, Inc.\Pdf"
    
  2. Under this key create a string value and give it the name "GS_LIB".

  3. Now set the value data of the "GS_LIB" value as follows:

    
    "MAIN\Lib;MAIN\Fonts;MAIN\Resource"
    
  4. If MAIN stands for "C:\Pdf" then this would become

    
    "C:\Pdf\Lib;C:\Pdf\Fonts;C:\Pdf\Resource"
    
As an alternative to creating the registry keys, you can also use the CodecsPdfOptions.InitialPath property to specify the directory where the PDF runtime files reside.