I found this similar problem at SO: error: ‘Page’ was not declared in this scope but it is a different situation since I'm not working on header files.
As you can see from the code below, I'm using PoDoFo library trying to print out a pdf file content to the screen
#include <iostream>
#include <podofo/podofo.h>
using namespace std;
int main()
{
//load a new document
//PoDoFo::PdfMemDocument pdf("myDoc.pdf");
// this load a doc on my disk
PoDoFo::PdfMemDocument doc;
doc.Load("myDoc.pdf");
//iterate over each page"
for(int pn = 0; pn < doc.GetPageCount(); ++pn){
PoDoFo::PdfPage* page = doc.GetPage(pn);
}
//
PoDoFo::PdfContentsTokenizer tok(page);
const char* token = nullptr;
PoDoFo::PdfVariant var;
PoDoFo::EPdfContentsType type;
while (tok.ReadNext(type, token, var)) {
if (type == PoDoFo::ePdfContentsType_Keyword) {
}
}
if (var.IsArray()) {
PoDoFo::PdfArray& a = var.GetArray();
for (size_t i = 0; i < a.GetSize(); ++i)
if (a[i].IsString()) { }
}
}
This is the error:
/home/coder/QtProjects/finalProject/main.cpp:19: error: ‘page’ was not declared in this scope
PoDoFo::PdfContentsTokenizer tok(page);
hope you can help me fix this.
Thanks!