Hi,
I’m trying to work with the PdfExtractor on an in-memory Document. The EndPage property of the PdfExtractor is 0 (zero). And when I invoke the ExtractImage method of the PdfExtractor the EndPage is set to the correct value. This is the code I’m using:
private void Foo(byte[] data)
{
MemoryStream stream = new MemoryStream(data);
Document pdfDocument = new Document(stream);
// pdfDocument.Pages.Count is 106<span style="color:#2b91af;">PdfExtractor</span> pdfExtractor = <span style="color:blue;">new</span> <span style="color:#2b91af;">PdfExtractor</span>(); pdfExtractor.BindPdf(pdfDocument); <span style="color:blue;">var</span> endPage = pdfExtractor.EndPage; <span style="color:green;">// pdfExtractor.EndPage is 0</span> pdfExtractor.ExtractImage(); endPage = pdfExtractor.EndPage; <span style="color:green;">// now endpage is 106</span>
}
The following code does work correctly. The EndPage of the PdfExtractor has been set correctly from the start:
private void Foo(string fileName)
{
PdfExtractor pdfExtractor = new PdfExtractor();
pdfExtractor.BindPdf(fileName);<span style="color:blue;">var</span> endPage = pdfExtractor.EndPage; <span style="color:green;">// pdfExtractor.EndPage is 106</span> pdfExtractor.ExtractImage(); endPage = pdfExtractor.EndPage; <span style="color:green;">// endpage is still 106</span>
}
It would appear that something is not correctly initialized when working with a Document. Can you please help me with this?
Regards,
Arjan Vermunt