DTWAIN_SetPDFPageScale

Top  Previous  Next

The following function is available only with DTWAIN / PDF.

 

The DTWAIN_SetPDFPageScale sets the current page scale of the image acquired to PDF files.

 

DTWAIN_BOOL DTWAIN_SetPDFPageScale (

DTWAIN_SOURCE

Source,

LONG

PageScale,

DTWAIN_FLOAT

CustomXScale,

DTWAIN_FLOAT

CustomYScale );

 

Parameters

Source

An open TWAIN Source.

 

PageScale

The current scaling factor to apply to the acquired image.

 

CustomXScale

Custom x-scaling as a percent.

 

CustomYScaleHeight

Custom y-scaling as a percent.

 

 

Return Values

The return value is TRUE if successful.  Otherwise FALSE is returned.

 

Comments

The DTWAIN_SetPDFPageScale sets the current scale of an acquired image that is saved as a page in a PDF file.

 

Please note:  If you are acquiring to PDF files, and will allow DTWAIN to create searchable PDF's (see DTWAIN_SetPDFOCRMode), you should not call DTWAIN_SetPDFPageScale, as doing so will distort the locations of the position of the text within the PDF file.  Please call DTWAIN_SetPDFPageSize to properly size a page that will eventually store searchable text.

 

The PageScale argument can be one of the following:

 

DTWAIN_PDF_NOSCALING

DTWAIN_PDF_FITPAGE

DTWAIN_PDF_CUSTOMSCALE

 

If PageScale is DTWAIN_PDF_NOSCALING, the image acquired is not scaled to fit in the page.  When placing an image within a PDF page, each pixel of the image corresponds to a point of the PDF page.  For example, if an image is 600 x 800, and the PDF page is letter (612 x 792 points), the image will fit within the width of the PDF file (600 < 612), but the height will not fit ( 800 > 792).  If the image is too large to fit the width or height, the image is clipped.

 

DTWAIN_PDF_FITPAGE will stretch or contract the image in the x and y direction to fit the page.  This is desirable if you have acquired using standard size paper (Letter, A4, etc.).

 

DTWAIN_PDF_CUSTOMSCALE allows you to specify the x and y scaling.  The scaling numbers must be greater than 0.0.  The x and y values are specified by CustomXScale and CustomYScale arguments, respectively. By setting the custom scale, you can shrink or exapnd your images in the x and/or y direction.

 

If DTWAIN_PDF_NOSCALING or DTWAIN_PDF_FITPAGE are specifed, the CustomXScale and CustomYScale arguments are ignored.

 

By default, the page scale is set for DTWAIN_PDF_FITPAGE.

 

Example

To add the image to the PDF page with no scaling

DTWAIN_SetPDFPageScale( Source, DTWAIN_PDF_NOSCALING, 0.0, 0.0 );

 

To fit the image to the PDF page

DTWAIN_SetPDFPageScale( Source, DTWAIN_PDF_FITPAGE, 0.0, 0.0 );

 

To set a custom scale of 50% in the x (horizontal) and 35% in the y (vertical) direction:

DTWAIN_SetPDFPageScale( Source, DTWAIN_PDF_CUSTOMSCALE, 50.0, 35.0 );

 

 

For languages that have difficulties with DTWAIN_FLOAT parameters, the alternate function that can be used as a replacement for DTWAIN_SetPDFPageScale is DTWAIN_SetPDFPageScaleString.

 

 

TWAIN State Transitions

The Source must be in State 4. or higher

 

Prerequisite Function Call(s)

DTWAIN_SysInitialize

 

DTWAIN Source Selection Function

 

 

See Also

PDF File Options