FPDF_LoadDocument typedef

Pointer<FPDF_DOCUMENT> FPDF_LoadDocument (
  1. Pointer<Utf8> filePath,
  2. Pointer<Utf8> password
)

PdfiumException getLastError() { switch (nGetLastError()) { case FPDF_ERR_SUCCESS: fprintf(stderr, "Success"); break; case FPDF_ERR_UNKNOWN: fprintf(stderr, "Unknown error"); break; case FPDF_ERR_FILE: fprintf(stderr, "File not found or could not be opened"); break; case FPDF_ERR_FORMAT: fprintf(stderr, "File not in PDF format or corrupted"); break; case FPDF_ERR_PASSWORD:

 fprintf(stderr, "Password required or incorrect password");
 break;

case FPDF_ERR_SECURITY: fprintf(stderr, "Unsupported security scheme"); break; case FPDF_ERR_PAGE: fprintf(stderr, "Page not found or content error"); break; default: fprintf(stderr, "Unknown error %ld", err); } }

Implementation

// Function: FPDF_LoadDocument
//          Open and load a PDF document.
// Parameters:
//          file_path -  Path to the PDF file (including extension).
//          password  -  A string used as the password for the PDF file.
//                       If no password is needed, empty or NULL can be used.
//                       See comments below regarding the encoding.
// Return value:
//          A handle to the loaded document, or NULL on failure.
// Comments:
//          Loaded document can be closed by FPDF_CloseDocument().
//          If this function fails, you can use FPDF_GetLastError() to retrieve
//          the reason why it failed.
//
//          The encoding for |password| can be either UTF-8 or Latin-1. PDFs,
//          depending on the security handler revision, will only accept one or
//          the other encoding. If |password|'s encoding and the PDF's expected
//          encoding do not match, FPDF_LoadDocument() will automatically
//          convert |password| to the other encoding.
typedef Pointer<FPDF_DOCUMENT> FPDF_LoadDocument(
  Pointer<Utf8> filePath,
  Pointer<Utf8> password,
);