Get Page Information in C++
Contents
[
Hide
]
Use PdfFileInfo for this task. The examples below retain the original C++ code and API Reference steps.
Get page information
Print page 1 width, height, and rotation.
- Create PdfFileInfo with the input PDF path.
- Read the page width with PdfFileInfo::GetPageWidth().
- Read the page height with PdfFileInfo::GetPageHeight().
- Read the page rotation with PdfFileInfo::GetPageRotation().
- Close the facade with PdfFileInfo::
Close(). - Print the results or diagnostic messages shown in the example.
#include <Aspose.PDF.Cpp/Facades/PdfFileInfo.h>
#include <iostream>
#include <system/string.h>
namespace Facades::Examples::PDF_FileInfo
{
using namespace System;
using namespace Aspose::Pdf;
using namespace Aspose::Pdf::Facades;
void GetPageInformation(String inputFile)
{
auto pdfInfo = MakeObject<PdfFileInfo>(inputFile);
std::cout << "Page Width: " << pdfInfo->GetPageWidth(1) << std::endl;
std::cout << "Page Height: " << pdfInfo->GetPageHeight(1) << std::endl;
std::cout << "Page Rotation: " << pdfInfo->GetPageRotation(1) << std::endl;
pdfInfo->Close();
}
} // namespace Facades::Examples::PDF_FileInfo