Florian Hänel
2017-06-02 09:58:59 UTC
between 0.9.5 and trunk, podofo stopped reporting the correct number of
annotations:
#include <iostream>
#include "podofo/podofo.h"
int main(int argc, char** argv) {
PoDoFo::PdfMemDocument* doc = new PoDoFo::PdfMemDocument();
doc->Load("test2-annotated.pdf");
for(int pn = 0; pn < doc->GetPageCount(); pn++) {
auto page = doc->GetPage(pn);
int num = page->GetNumAnnots();
std::cout<<"page"<<pn<<"annotations:"<<num<<std::endl;
}
}
⌘ [/home/florian/work] $ g++ -g -O0 -fno-omit-frame-pointer -std=gnu++11
podofotest.cpp -L build-podofo-trunk/src -l podofo -I podofo-trunk -I
build-podofo-trunk -DNOTCALLED -o test-trunk
⌘ [/home/florian/work] $ g++ -g -O0 -fno-omit-frame-pointer -std=gnu++11
podofotest.cpp -L build-podofo-0.9.5/src -l podofo -I podofo-0.9.5 -I
build-podofo-0.9.5 -DNOTCALLED -o test-0.9.5
⌘ [/home/florian/work] $ LD_LIBRARY_PATH=build-podofo-trunk/src
./test-trunk | grep annotations
WARNING: There are more objects (4) in this XRef table than specified in
the size key of the trailer directory (1)!
WARNING: There are more objects (126) in this XRef table than specified
in the size key of the trailer directory (4)!
<</ID[(▒^��"Mʄ����)(���cE�䵳 F�|�L)]/Info 115 0 R/Prev 2380581/Root 114 0
R/Size 126>>
page0annotations:0
page1annotations:3
page2annotations:5
page3annotations:5
page4annotations:8
page5annotations:11
page6annotations:12
⌘ [/home/florian/work] $ LD_LIBRARY_PATH=build-podofo-0.9.5/src
./test-0.9.5 | grep annotations
<</ID[(▒^��"Mʄ����)(���cE�䵳 F�|�L)]/Info 115 0 R/Prev 2380581/Root 114 0
R/Size 126>>
page0annotations:9
page1annotations:3
page2annotations:5
page3annotations:5
page4annotations:8
page5annotations:11
page6annotations:12
⌘ [/home/florian/work] $
the file was created with:
pdftk test.pdf cat 9-15 output test2.pdf
then annotated in okular on page 0
http://heeen.de/test2-annotated.pdf
Florian
annotations:
#include <iostream>
#include "podofo/podofo.h"
int main(int argc, char** argv) {
PoDoFo::PdfMemDocument* doc = new PoDoFo::PdfMemDocument();
doc->Load("test2-annotated.pdf");
for(int pn = 0; pn < doc->GetPageCount(); pn++) {
auto page = doc->GetPage(pn);
int num = page->GetNumAnnots();
std::cout<<"page"<<pn<<"annotations:"<<num<<std::endl;
}
}
⌘ [/home/florian/work] $ g++ -g -O0 -fno-omit-frame-pointer -std=gnu++11
podofotest.cpp -L build-podofo-trunk/src -l podofo -I podofo-trunk -I
build-podofo-trunk -DNOTCALLED -o test-trunk
⌘ [/home/florian/work] $ g++ -g -O0 -fno-omit-frame-pointer -std=gnu++11
podofotest.cpp -L build-podofo-0.9.5/src -l podofo -I podofo-0.9.5 -I
build-podofo-0.9.5 -DNOTCALLED -o test-0.9.5
⌘ [/home/florian/work] $ LD_LIBRARY_PATH=build-podofo-trunk/src
./test-trunk | grep annotations
WARNING: There are more objects (4) in this XRef table than specified in
the size key of the trailer directory (1)!
WARNING: There are more objects (126) in this XRef table than specified
in the size key of the trailer directory (4)!
<</ID[(▒^��"Mʄ����)(���cE�䵳 F�|�L)]/Info 115 0 R/Prev 2380581/Root 114 0
R/Size 126>>
page0annotations:0
page1annotations:3
page2annotations:5
page3annotations:5
page4annotations:8
page5annotations:11
page6annotations:12
⌘ [/home/florian/work] $ LD_LIBRARY_PATH=build-podofo-0.9.5/src
./test-0.9.5 | grep annotations
<</ID[(▒^��"Mʄ����)(���cE�䵳 F�|�L)]/Info 115 0 R/Prev 2380581/Root 114 0
R/Size 126>>
page0annotations:9
page1annotations:3
page2annotations:5
page3annotations:5
page4annotations:8
page5annotations:11
page6annotations:12
⌘ [/home/florian/work] $
the file was created with:
pdftk test.pdf cat 9-15 output test2.pdf
then annotated in okular on page 0
http://heeen.de/test2-annotated.pdf
Florian