fromURL static method
Load a PDF File from a given URL. File is saved in cache
Implementation
static Future<PDFDocument> fromURL(String url, {Map<String, String>? headers}) async {
// Download into cache
File f = await DefaultCacheManager().getSingleFile(url, headers: headers);
PDFDocument document = PDFDocument();
document._filePath = f.path;
try {
var pageCount = await _channel.invokeMethod('getNumberOfPages', {'filePath': f.path});
document.count = int.parse(pageCount);
} catch (e) {
throw Exception('Error reading PDF!');
}
return document;
}