loadDocumentFromPath method

PdfiumWrap loadDocumentFromPath(
  1. String path, {
  2. String? password,
})

Loads a document from path, and if necessary, a password can be specified.

Throws an PdfiumException if no document is loaded. Returns a instance of PdfiumWrap

Implementation

PdfiumWrap loadDocumentFromPath(String path, {String? password}) {
  final filePathP = stringToNativeInt8(path);
  _document = pdfium.FPDF_LoadDocument(
      filePathP, password != null ? stringToNativeInt8(password) : nullptr,);
  if (_document == nullptr) {
    final err = pdfium.FPDF_GetLastError();
    throw PdfiumException.fromErrorCode(err);
  }
  return this;
}