pdfLoadStreamWithPassword
Load a PDF file from a callback-based stream.
int pdfLoadStreamWithPassword(PDFViewerHandle viewer,
int (*getChar)(void *data, unsigned int pos),
void *cbkData, unsigned int streamLength,
char *password)
This function loads a PDF file from a generic, callback-based stream,
applying the specified password, and displays its first page.
The pdfLoadStreamWithPassword
function
returns pdfOk
if successful, otherwise
an error code.
The stream callback function receives a data pointer
(the cbkData
argument passed
to pdfLoadStreamWithPassword
), 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 */
}
...
pdfLoadStreamWithPassword(viewer, &getChar, data, streamLength, "secret");