Question
How pages are counted in FineReader Engine 12?
Answer
The Page Counter is decremented more than once for a single page in case the physical size of this page exceeds the physical size of an A4 page.
The physical size (inch2) of the image is calculated as follows:
- physical size of image = ( PageWidthPixel / HorizontalResolutionDPI ) * ( PageHeightPixel / VerticalResolutionDPI )
The number of pages to decrement is counted with this formula:
- n is always >= 1
- n = ~(physical size of image) / (physical size of A4 image), where
- physical size of A4 image = A4PrintHeightInch * A4PrintWidthInch
The number of pages to decrement depends not only on resolution but on a ratio between size in pixels and resolution.
It is noted that all calculations are done with integer variables, so there are some rounding nuances in favor of users.
Example
The page, for example, has the following attributes:
Width = 3660 pixels,
Height = 5163 pixels,
XResolution = YResolution = 300 dpi.
The physical width of each page is (3660/300) = 12 inch, physical height of each page is (5163/300) = 17 inch, area of each page is 12*17 = 204 inch2. And the page counter decreases by (204 inch2/97 inch2) = 2 times for this page, because the size of A4 page is (8.27 inches * 11.69 inches = 97 inch2).
After recognition of this one image, the page counter decreases by 2.
Code sample (C++)
bool CCommandLineProcessor::checkPageSizeIsTooLarge(CSafePtr <IFRPage> currentPage){
BSTR sourcePage;
const double a4Size = 8.27 * 11.69;
CSafePtr <IImageDocument> imageDoc;
check (currentPage->get_ImageDocument(&imageDoc));
CSafePtr <IImage> bwImage;
check (imageDoc->get_BlackWhiteImage(&bwImage));
int imageWidth, imageHeight, xResolution, yResolution;
check (bwImage->get_Width(&imageWidth));
check (bwImage->get_Height(&imageHeight));
check (bwImage->get_XResolution(&xResolution));
check (bwImage->get_YResolution(&yResolution));
double counters = imageWidth / xResolution * imageHeight / yResolution / a4Size;
int counterRoundedUp = (int) (counters); // in the current version, counter is always rounded down.
if (counterRoundedUp > borderline) {
isTooLarge = true;
check (currentPage->get_SourceImagePath(&sourcePage));
fwprintf(stderr, MSG_LARGE_PAGE_WARNING, sourcePage, counterRoundedUp, borderline);
return true;
}
return false;
}
Comments
1 comment
Kashyap Shah
How old is this requirement? Is this changed recently.
Please sign in to leave a comment.