openCustom static method
Opening the PDF from custom source.
maxSizeToCacheOnMemory
is the maximum size of the PDF to cache on memory in bytes; the custom loading process
may be heavy because of FFI overhead and it may be better to cache the PDF on memory if it's not too large.
The default size is 1MB.
passwordProvider
is used to provide password for encrypted PDF. See PdfPasswordProvider for more info.
firstAttemptByEmptyPassword
is used to determine whether the first attempt to open the PDF is by empty password
or not. For more info, see PdfPasswordProvider.
sourceName
can be any arbitrary string to identify the source of the PDF; Neither of read
/fileSize
identify the source if such name is explicitly specified.
Implementation
static Future<PdfDocument> openCustom({
required FutureOr<int> Function(Uint8List buffer, int position, int size)
read,
required int fileSize,
required String sourceName,
PdfPasswordProvider? passwordProvider,
bool firstAttemptByEmptyPassword = true,
int? maxSizeToCacheOnMemory,
void Function()? onDispose,
}) =>
PdfDocumentFactory.instance.openCustom(
read: read,
fileSize: fileSize,
sourceName: sourceName,
passwordProvider: passwordProvider,
firstAttemptByEmptyPassword: firstAttemptByEmptyPassword,
maxSizeToCacheOnMemory: maxSizeToCacheOnMemory,
onDispose: onDispose,
);