You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Feature/availability loader and lazy page sizes (#185)
* Fix opening a document when a single page cannot be resolved
PdfDocument measured every page in its constructor, so one page pdfium could
not resolve failed the whole document, even for callers that only wanted the
page count or a different page. PageSizes is now measured per page on first
read and the count comes from FPDF_GetPageCount, which resolves no pages.
GetPageSizes still measures every page and still reports an unreadable one.
* Reach pages of linearized documents through FPDFAvail
Where walking /Pages dead-ends, pages present in the file report as missing.
FPDFAvail_* fills page_list_ from the linearization hint tables instead, so
GetPageDictionary resolves them without traversing: on a 3467 page document
the walk reaches 46 pages and FPDFAvail all of them. PdfFile reopens that way
once per document, only after a page has failed and only when
FPDFAvail_IsLinearized does not say no, so documents that work today keep
their path and a failed reopen leaves the usual page error.
Also stops PdfException.CreateException(SUCCESS) being dereferenced with "!"
when pdfium refuses a page without recording an error.
* Use the availability API for all documents; add unit tests for Stream related issues
* API cleanup and restricted support of >4 GiB PDF files
* Add tests for the 4 GiB PDF file size limit
---------
Co-authored-by: David Sungaila <david.sungaila@arcor.de>
/// Opens a document using a .NET Stream. Allows opening huge
39
-
/// PDFs without loading them into memory first.
40
-
/// </summary>
41
-
/// <param name="input">The input Stream. Don't dispose prior to closing the pdf.</param>
42
-
/// <param name="password">Password, if the PDF is protected. Can be null.</param>
43
-
/// <param name="id">Retrieves an IntPtr to the COM object for the Stream. The caller must release this with Marshal.Release prior to Disposing the Stream.</param>
44
-
/// <returns>An IntPtr to the FPDF_DOCUMENT object.</returns>
0 commit comments