FPDF_LoadDocument function

  1. @Native<FPDF_DOCUMENT Function(FPDF_STRING file_path, FPDF_BYTESTRING password)>(FPDF_STRING, FPDF_BYTESTRING)>()
FPDF_DOCUMENT FPDF_LoadDocument(
  1. FPDF_STRING file_path,
  2. FPDF_BYTESTRING password
)

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 |file_path| is UTF-8.

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.

Implementation

@ffi.Native<FPDF_DOCUMENT Function(FPDF_STRING, FPDF_BYTESTRING)>()
external FPDF_DOCUMENT FPDF_LoadDocument(
  FPDF_STRING file_path,
  FPDF_BYTESTRING password,
);