How can I know how many pages there are in my memorystream?

Hi Aspose.

Question: How can I know how many pages there are in my memorystream?

I have a base64String. In it there is the base64 encoded information of a PDF file.

I can use the PdfPageEditor to resize it (zoom).

But how can I know how many pages there are in the Pdf (base64String, decodedBytes or resized outputfile or outputstream)?

Code:

string base64String = "JVBE ........";

byte[] decodedBytes = Convert.FromBase64String(base64String);

MemoryStream stream1 = new MemoryStream(decodedBytes);

string inputfile2 = path + "./App_Data/TestSjabloon.pdf";

// --- INVOEGEN ---

PdfPageEditor pageEditor = new PdfPageEditor();

pageEditor.BindPdf(stream1); //als je een stream wilt invoegen

pageEditor.Zoom = (float)0.88;

pageEditor.Save(@"C:\Temp\TestResized.pdf"); //Or save in a stream

// And here I want to know how many pages there are in the PDF so that I can insert all the pages in another PDF (stamp) and after inserting uodating the index with the correct number of inserted pages!

Hello Jaco,

In order to get the page cont of pdf file in memory stream, please refer to GetPages method of PdfPageEditor class.

Hello Nayyer,

Is the method GetPages available in version 2.5.2.0?

Or in version 2.7.0.0?

Hello Jaco,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

We recommend you to use the latest version Aspose.Pdf.Kit for .NET 3.1.0.0. This version also contains some fixes for defects reported in previous versions.