pdfSetIncrementalUpdateCbk
Set the incremental update callback.
void pdfSetIncrementalUpdateCbk(PDFHandle pdf,
void (*cbk)(void *data, PDFImageHeader *imgHdr, char *bits),
void *cbkData)
This function sets a callback which is called periodically during
rasterization to allow an intermediate version of the bitmap to be
displayed to the user.
The imgHdr
and bits
arguments are similar to
those used by pdfConvertPageToBitmap2
and
pdfConvertRegionToBitmap2
.
The incremental update callback is called frequently. The best approach is usually to display the bitmap only on every nth call, to avoid slowing things down too much.
NOTE: do not free the bits
argument.
The incremental update callback is only available for the following functions:
C:
int updateCounter;
void incUpdateCbk(void *data, PDFImageHeader *imgHdr, char *bits) {
++updateCounter;
if (updateCounter == 100) {
/* imgHdr and bits are similar to the values returned by
pdfConvertPageToBitmap2 -- they can be used to display
the current status of the bitmap */
...
updateCounter = 0;
}
}
pdfSetIncrementalUpdateCbk(pdf, &incUpdateCbk, data);
updateCounter = 0;
pdfConvertPageToBitmap2(pdf, ...);