Welcome Guest! To enable all features please Login or Register.



Go to last post Go to first unread
#1 Posted : Tuesday, June 11, 2019 8:56:13 AM(UTC)

Rank: Newbie

Groups: Registered
Joined: 6/11/2019(UTC)
Posts: 2

Hello support,

I was trying to import pages from a big document into a new one (in C#):


var newDocument = PdfDocument.CreateNew();

// 'pdfDocument' contains more than 70.000 pages.
// This works:
newDocument.Pages.ImportPages(pdfDocument, "65535-65535", 0);

// This does not work:
newDocument.Pages.ImportPages(pdfDocument, "65536-65536", 0);

I'm wondering about this 2^16-1 limit (unsigned short) as the property PdfPageCollection.Count is an integer (2^31-1).
This error occurs in the current version 4.7.2704.

The callstack given by the second code fragment is:
Patagames.Pdf.Net.Exceptions.PdfiumException: Unexpected error code.
bei Patagames.Pdf.Pdfium.ProcessLastError()
bei Patagames.Pdf.Net.PdfPageCollection.ImportPages(PdfDocument sourceDoc, String pagerange, Int32 index)

Is this a known bug and a workaround or fix available?

Regards & thanks in advance


Edited by user Tuesday, June 11, 2019 9:17:44 AM(UTC)  | Reason: Not specified

Paul Rayman  
#2 Posted : Friday, June 14, 2019 5:23:18 AM(UTC)
Paul Rayman

Rank: Administration

Groups: Administrators
Joined: 1/5/2016(UTC)
Posts: 743

Thanks: 1 times
Was thanked: 90 time(s) in 89 post(s)
The Pdfium's import procedure contains a two-byte array where is stored the ordianl numbers of pages labeled to import. So the maximum ordinal number of the page that can be processed by the import procedure is 65535.
I can suggest the another way to achieve your goals. You import first 655355 pages, and delete these pages.
For example, if you have import the first 65,535 pages, then you can delete them from the original document, and save it as copy. Thus the page with ordinal number 65536 will become the first page of the new document and you will be able to access to the next 65535 pages.
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.