We start with a description of the PDF2IMG constructor. The call opens with the PDF2IMG constructor, followed by LoadInput and one or more of the other method statements.
PDF2IMG(IList fonts = null, Boolean ignoreSystemFonts = false, Boolean ignoreCurrentDirectory = false)
The PDF2IMG constructor creates a new instance of the PDF2IMG class.
|Fonts||An optional parameter that specifies the list of local directories for the system to search to find font files and other resources. Defaults to null; provide a list of strings to define the directories as needed.|
|ignoreSystemFonts||This optional parameter is set to tell PDF2IMG to ignore the system font directories. Normally PDF2IMG will scan the default system resource directories to find font files that are stored locally, such as .otf, .ttf, and .cmap files. This process begins when the system starts, but the font scanning takes time. This option allows you to turn off the search process if it is not needed for a given PDF document or set of PDF documents. You can also direct PDF2IMG to search in a specific set of locations instead, a set of locations that you provide, defined using the Fonts parameter described above.|
|ignoreCurrentDirectory||This optional parameter is set to direct PDF2IMG to ignore the current directory when searching for font files.|
An exception may be thrown if there is a problem in initializing the system.
Note that you can build your own executable file for PDF2IMG. But if you are working with PDF2IMG Pro, or an evaluation version of PDF2IMG Premium, you must generate a license file, and store that license file in the same directory where you place your executable file. For more details on working with license files, see Installing the Software.
LoadInput(Byte inputBuffer, String userPassword = null)
This method loads the input PDF or XPS document into PDF2IMG.
|inputBuffer||The memory buffer containing the input document to be imported into PDF2IMG.|
|userPassword||An optional parameter to hold the password of the PDF document if a password is required for the document to be opened.|
This method returns the number of pages in the input file after it is loaded. An exception may be thrown if a problem appears in loading the document.
CheckForMissingAppearances(UInt32 firstPage, UInt32 lastPage)
This method checks pages within the specified range for annotations or form fields that cannot be rendered.
Define a range of page numbers for pages to be checked using the firstPage and lastPage parameters.
The method returns the number of appearances that cannot be rendered in an export graphics file. An annotation may specify one or more appearance streams that define how the annotation appears to a user. For example, a form field could change color if the user rolls the cursor over the field, or a link could change color after it is clicked.
An exception may be thrown if an error occurs while looking through appearances.
ConvertPageToImage(UInt32 pageNumber, String outputPath)
This method converts a specified page in a PDF document to an output image file, such as JPG, using the Image Conversion Options that were previously set. The ImageConversionOptions class defines the available options.
|pageNumber||Page to be converted|
|outputPath||Path of the image to be created|
An exception may be thrown if a problem appears in converting the page to an image, or if the Image Conversion Options are not valid.
This method converts all of the pages in a PDF input document to a single multi-page TIFF image file. Each page is stored in memory before it is converted.
|outputPath||The local path and file name where the output TIFF image file will be saved.|
An exception may be thrown if a problem appears in converting any of the pages in the PDF document to TIFF, or if the Image Conversion Options are not valid.
This method retrieves four sets of coordinates—top, left, right, and bottom—for a CustomRegion on a page. These coordinates could be used to form a tight-fitting bounding box around all of the text, graphics, and images on the page, so that the white margins around the content on the page could be removed.
Use this method to define the Image Conversion Options to be used when converting a PDF document to graphic image file output.
Use the “options” parameter to define the conversion options. The ImageConversionOptions class defines the available options.
|outputType||The file format of the output image created. The default value is TIFF. Other values include EPS, JPG, BMP, PNG, RAW, PDF, and GIF.|
|bitsPerChannel||The Bits Per Channel of the output image created. The default value is 8.|
|horizontalResolution||The horizontal resolution of the output image created. The default value is 300 dots per inch. Valid values are between 12 and 2400.|
|verticalResolution||The vertical resolution of the output image created. The default value is 300 dots per inch. Valid values are between 12 and 2400.|
|colorSpace||The Colorspace of the output image created. The default value is RGB. Others include Gray, RGBA, CMYK, and LAB.|
|tiffConversionOptions||The options available for creation of the output TIFF. The options include setting the blackisone reference value (which is rarely used) and selecting a compression method, which defaults to lzw. Other compression options include None, G3, G4, and JPEG.
If you want more detail see the description of the blackisone optional command line argument in PDF2IMG. The concepts related to blackisone used here for the tiffConversionOptions option within the SetImageConversionOptions method in the .NET Interface are the same as described for the PDF2IMG C language interface.
|jpegConversionOptions||The options available for creation of the output JPEG. This includes the output image quality; either a small output file with low resolution, or a larger file that has higher resolution. The quality value can range from 1 to 100, with the default set to 75. A file with a quality value of 100 would be the highest quality image possible.|
|overPrintPreview||Whether or not ink overprinting is applied to the output image created. If set to true the software will generate a graphic that represents what the input PDF page would look like after being printed, and will account for ink overprinting. The default value is false.|
|regionOfInterest||The region of the page rasterized for the output image created. The default value is CropBox. Other options include MediaBox, Artbox, Trimbox, Bleedbox, BoundingBox, and CustomBox. If you select CustomBox you need to define coordinates in customRegion.|
|outputColorProfileOptions||The options used for the Output Color Profile of the output image created.|
|inputColorProfileOptions||The options used for the Input Color Profile of the output image created.|
|useColorManagement||Sets whether color management is used during creation of the output image. The default value is true.|
|enhanceThinLines||Sets whether thin lines are generated in the generated output image. The default value is true, to generate thin line renderings as they would appear when generated by Adobe Reader or Acrobat.|
|resamplerUsed||Sets whether resampling is used in creation of the output image. The default value is Auto. Other options include Bicubic or none. Resampling is a method used to resize graphics image files, such as JPG or PNG. The resampling process tends to create a smoother image when the image size increases or decreases. To increase the size of the image, more pixels are added to the image, and pixels are removed from an image to make it smaller. In each case the image loses resolution.|
|reverseGrayscale||Sets whether grayscale should be reversed in the created output image. The default value is false.|
|asPrinted||Sets if the document should be converted as if it was being printed when creating the output image. The default value is false.|
|printAnnotations||Sets if displayable annotations are suppressed the output image. The default value is false, annotations should be printed.|
|ouputWidth||The width of the output image created, in pixels. The default value is 0.|
|outputHeight||The height of the output image created, in pixels. The default value is 0.|
|smoothing||Smoothing used for the output image created. Smoothing, or anti-aliasing, is useful when creating low resolution outputs. The default value is All. Other options include none, text, line art, or image.|
|thresholdForBandRasterization||The threshold in bytes to use for determining if rasterization should be done in bands in order to use less memory. PDF2IMG checks to see if it has enough memory to rasterize a PDF page to JPG or TIF in one pass. If not it rasterizes the page in bands (strips) in order to use smaller chunks of memory. Then the software reassembles the bitmaps into the finished output image. This setting allows you to change the threshold value for the band rasterization process by defining the maximum size, in bytes. An image with a size greater than this value will be rasterized in a banding conversion, rather than attempting a single full-page conversion in one step. The default value is 300000000, or 30 million bytes. This is only applicable for TIFF or JPEG output.|
|customRegion||The custom region of the page rasterized for the output image created. When defining a region to rasterize on an input page, rather than using a standard value like cropbox or mediabox, it is possible to define a custom region for rasterizing by providing a set of four coordinates, [left],[top],[right],[bottom] in PDF units. Provide these coordinates in customRegion if you define regionOfInterest to be CustomBox.|
An exception may be thrown if the Image Conversion Options are not valid.