Versions conflict: Obtain non-standard page width/height values using version 2.6.3

Hello,

If I’m using Aspose.Pdf.Kit 2.6.3 and I load a PDF file which does not have standard page size (A4, A3…), but certain specific values for page width/height…

Is it possible to obtain those page width/height values using version 2.6.3?

I haven’t found how to do that, and I know it is possible in version 3.0.0 (using, i.e., PdfPageEditor.GetPageSize(pageNumber).Height),
but version 3.0.0 has some issues about adding text and images, so in some way I’m trapped :slight_smile: between these two versions.

Thanks.


Hi,

For Aspose.Pdf.Kit v 2.6.3 you can use the PageSize property of PdfPageEditor http://www.aspose.com/documentation/file-format-components/aspose.pdf.kit-for-.net-and-java/aspose.pdf.kit.pdfpageeditor.pagesize.html

Please see the following thread for code sample <A href="https://forum.aspose.com/t/129195</A></P> <P>Thanks.</P>

Thanks for your answer,

The code that you mentioned assigns values to the page width/height, but does not retrieves them, so I still have a doubt about this.

I know that with Aspose.Pdf.Kit 3.0.0 you could obtain the height like this:

float height;

PdfPageEditor pdfPageEditor = new PdfPageEditor();

pdfPageEditor.BindPdf(pdfStream);

height = pdfPageEditor.GetPageSize(1).Height;

… But in version 2.6.3 there is no such PdfPageEditor.GetPageSize() method; instead, there is a PdfPageEditor.PageSize property that unfortunately has no getter :frowning:

(as I said before, right now I’m “forced” to use 2.6.3 because there are issues with 3.0.0)

Thanks and good work!




Hi,

Sorry for the confusion. You can use the GetPageHeight (http://www.aspose.com/documentation/file-format-components/aspose.pdf.kit-for-.net-and-java/aspose.pdf.kit.pdffileinfo.getpageheight.html) and GetPageWidth (http://www.aspose.com/documentation/file-format-components/aspose.pdf.kit-for-.net-and-java/aspose.pdf.kit.pdffileinfo.getpagewidth.html) function of PdfFileInfo class to get page hieght and width.

Thanks.

Hi,

I tried that code before, for example like this:

PdfFileInfo info = new PdfFileInfo(pdfFile);

return info.GetPageWidth(1);

But it doesn’t work in my tests (with Aspose.Pdf.Kit version 2.6.3) when the PDF does not have standard page size (A4, A3…)

Thanks.

Hi,

Can you please give us the file with which you are having problems so that we can test it.

Thanks.

Hi,

I’ve attched the PDF file. It has 2 pages, each one with a different size; both of them are not standard sizes.

Thanks in advance.

Hi,

I've tested it with the pdf and am not able to reproduce the error. The method PdfFileInfo.GetPageWidth works both in v 2.6.3 and in v 3.0, and the width of the two pages are obtained (515 for page1, 756 for page2).

As for the two issues about PdfFileMend in v 3.0, we are working on them and have fixed one. we will inform you if the other issue will be resolved. Sorry for the inconvenience.

Thanks,

Hi,

You are right. I had those problems because I had not icluded next code line:

ThePDFstream.Seek(0, SeekOrigin.Begin);

I APOLOGIZE for that.

Sorry for the inconvenience and thanks for the attention.