With PoDoFo i made it, but i dont know how with wxpdfdoc. An anvice of code how to?
Some code of PoDoFo, that i am learning now. But i think that i can made most easy with wxpdfdoc.
Thanks
Jim
Code: Select all
#include <iostream>
#include "cstring"
#include <podofo/podofo.h>
using namespace std;
int main()
{
PoDoFo::PdfMemDocument existingDocument1;
PoDoFo::PdfMemDocument existingDocument2;
PoDoFo::PdfMemDocument existingDocument3;
existingDocument1.Load("a.pdf");
existingDocument2.Load("b.pdf");
existingDocument3.InsertPages(existingDocument1,0,1);
existingDocument3.Write("c.pdf");
for (int pn = 0; pn < existingDocument1.GetPageCount(); ++pn)
{
PoDoFo::PdfPage* page = existingDocument1.GetPage(pn);
PoDoFo::PdfContentsTokenizer tok(page);
const char* token = nullptr;
PoDoFo::PdfVariant var;
PoDoFo::EPdfContentsType type;
while (tok.ReadNext(type, token, var))
{
switch (type)
{
case PoDoFo::ePdfContentsType_Keyword:
// process token: it contains the current command
// pop from var stack as necessary
break;
case PoDoFo::ePdfContentsType_Variant:
// process var: push it onto a stack
break;
default:
// should not happen!
break;
}
}
}
return 0;
}