Hello.
When I run the following code for one of my test documents, I get the System.InvalidOperationException: ‘Sequence contains no elements’.
var pageText = page.Content.GetText(new PdfTextOptions
{
Order = PdfTextOrder.Reading,
Whitespaces = PdfTextWhitespaces.Space | PdfTextWhitespaces.NewLine
})?.ToString();
The document itself doesn’t appear to be corrupted; it loads correctly and can be viewed using various PDF viewers. Adobe Acrobat Reader does not suggest saving it after it is opened (which suggests there are no hidden problems that were automatically recovered).
The document consists of an image on the first page and some text on the second and third pages. The problem occurs when I try to get text from the first page.
I would probably expect GemBox.Pdf to return an empty string rather than throwing an exception. However, I might have missed something, so I would be glad to get your feedback on this.
Thank you.
P.S. I can share the document that causes this issue. Please let me know how I can hand it over to you.
Note that this is a hidden (unlisted) version. To install it, you’ll need to run the above command on the NuGet Package Manager Console (Tools → NuGet Package Manager → Package Manager Console).
Hi Stipo,
Yes, it works well with the “2025.8.101” version, thank you!
Is it safe to use this (unlisted) version in production? Or better to wait for the publicly available one, which would include this fix?