Table of contents

Need better scanning performance?

Get a FREE customized reading template.

PDFReadingMode

Parameter PDFReadingMode defines how to handle PDF files.

JSON Structure

Location in template:

ImageSourceOptions
    └── PdfReadingMode

Parent object: ImageSource object

Example:

{
    "PDFReadingMode":
    {
        "Mode": "PDFRM_RASTER",
        "DPI": 300,
        "RasterDataSource": "RDS_RASTERIZED_PAGES"
    }
}

Parameter Details

Parameter PDFReadingMode is configured by a PDF reading mode objects. The PDF reading mode object includes a candidate mode and a series of mode arguments. The available mode arguments of the PDF reading mode object is shown as follow.

Mode Arguments

Mode Argument Name Mode Argument Summary
Mode Description
Specifies the operation mode.
Type
String
Candidate Mode List
PDFRM_VECTOR
PDFRM_RASTER
DPI Description
Specifies the DPI used when rasterizing a PDF into images.
Type
int
Range
[100,3000]
Default Value
300
Remarks
The resolution of the rendered image is calculated as follows:
Set PDF page height to h and page width to w,
Final rendered image height ImgHeight = h / 72 * DPI
Final rendered image width ImgWidth = w / 72 * DPI
DPI is the number of pixels per inch of the image.
The page width and height unit defined in PDF is pt (length unit, 1 inch = 72 pt), so in the above formula we first divide the width and height by 72 to get the inch length of the page, and then multiply by DPI to get the final image pixel width and height.
RasterDataSource Description
Specifies a the target type.
Type
String
Range
One of the candidate mode as a string
RDS_RASTERIZED_PAGES
RDS_EXTRACTED_IMAGES
Default Value
RDS_RASTERIZED_PAGES

Default Setting

If the PDFReadingMode is not configured in your template file, the following settings will be used as the default setting.

{
    "PDFReadingMode": 
    {
        "Mode": "PDFRM_RASTER",
        "DPI": 300,
        "RasterDataSource": "RDS_RASTERIZED_PAGES"
    }
}

Candidate Mode Introduction

PDFRM_RASTER

Renders each page of the PDF as an image, which will be processed later. This reading mode can be used for all PDF files, but the drawback is that you need to choose the appropriate value of PDFRasterDPI to render the image. Otherwise, if the image is too large, the processing speed of DBR may be slowed, and if the image is too small, the barcode region may be distorted and cannot be decoded.

PDFRM_VECTOR

This mode will not render PDF data into images, but directly extract PDF vector data for barcode region positioning and decoding. This mode can offer faster speed and higher accuracy, but it is only suitable for PDF composed of vector data.

This page is compatible for: