PdfiumWrap constructor
Default constructor to use the class
Implementation
PdfiumWrap({String? libraryPath, this.allocator = calloc}) {
//for windows
var libPath = path.join(Directory.current.path, 'pdfium.dll');
if (Platform.isMacOS) {
libPath = path.join(Directory.current.path, 'libpdfium.dylib');
} else if (Platform.isLinux || Platform.isAndroid) {
libPath = path.join(Directory.current.path, 'libpdfium.so');
}
if (libraryPath != null) {
libPath = libraryPath;
}
late DynamicLibrary dylib;
if (Platform.isIOS) {
DynamicLibrary.process();
} else {
dylib = DynamicLibrary.open(libPath);
}
pdfium = PDFiumBindings(dylib);
config = allocator<FPDF_LIBRARY_CONFIG>();
config.ref.version = 2;
config.ref.m_pUserFontPaths = nullptr;
config.ref.m_pIsolate = nullptr;
config.ref.m_v8EmbedderSlot = 0;
pdfium.FPDF_InitLibraryWithConfig(config);
}