pdfLoadStream
Load a PDF file from a callback-based stream.
int pdfLoadStream(PDFViewerHandle viewer,
int (*getChar)(void *data, unsigned int pos),
void *cbkData, unsigned int streamLength)
This function loads a PDF file from a generic, callback-based stream,
and displays its first page.
The pdfLoadStream
function returns pdfOk
if
successful, otherwise an error code.
The stream callback function receives a data pointer
(the cbkData
argument passed
to pdfLoadStream
), and a stream position (which will be
between 0 and streamLength - 1
), and should return the
byte at that position.
IMPORTANT: The PDF stream must not be freed or modified until
after pdfCloseFile
is called.
C:
int getChar(void *data, unsigned int pos) {
/* return the byte at position [pos] in the PDF stream */
}
...
pdfLoadStream(viewer, &getChar, data, streamLength);