Tester for PoDoFo

This commit is contained in:
Kovid Goyal 2010-06-30 13:39:18 -06:00
parent 1a5f73d86d
commit 71c8f750e7

View File

@ -0,0 +1,26 @@
#define USING_SHARED_PODOFO
#include <podofo.h>
#include <iostream>
using namespace PoDoFo;
using namespace std;
int main(int argc, char **argv) {
if (argc < 2) return 1;
char *fname = argv[1];
PdfMemDocument doc(fname);
PdfInfo* info = doc.GetInfo();
cout << endl;
cout << "is encrypted: " << doc.GetEncrypted() << endl;
PdfString old_title = info->GetTitle();
cout << "is hex: " << old_title.IsHex() << endl;
PdfString new_title(reinterpret_cast<const pdf_utf16be*>("\0z\0z\0z"), 3);
cout << "is new unicode: " << new_title.IsUnicode() << endl;
info->SetTitle(new_title);
doc.Write("/t/x.pdf");
cout << "Output written to: " << "/t/x.pdf" << endl;
return 0;
}