#include <stdio.h>
#include <fpdfview.h>
int main(int argc, char** argv) {
FPDF_InitLibrary();
FPDF_DOCUMENT doc;
FPDF_PAGE page;
doc = FPDF_LoadDocument("foxit_sdk.pdf", NULL);
if (doc == NULL) {
printf("failed to open test document\n");
return 1;
}
int numPages = FPDF_GetPageCount(doc);
printf("document has %d pages\n", numPages);
for (int i = 0; i < numPages; ++i) {
page = FPDF_LoadPage(doc, i);
if (page == NULL) {
printf("failed to open page %s\n", i);
continue;;
}
double width = FPDF_GetPageWidth(page);
double height = FPDF_GetPageHeight(page);
printf("page %d is : %f x %f\n", i, width, height);
}
FPDF_DestroyLibrary();
return 0;
}
https://github.com/cgilling/build-pdfium/blob/67e5e6eadaf474283ff8e6f47b9454330bf61a76/pdfium_test/main.cc