I am trying to create an app which fixes "bad" PDFs: PDFs without ToC (I mean outline tree - create ToC), PDFs with duplicate pages (delete them) or "quickly created" PDFs made by joining several other PDFs (senseless items in ToC, usually names of the PDF parts, senseless pages, etc. - delete all this). Such PDFs often contain useful information but in useless form so fix it.
I need something for manipulating a PDF (I am trying PoDoFo) and something for displaying a page because PoDoFo cannot render a page image. I already have got a bad experience with poppler-qt - very ugly images, as if they came from middle 90s. So I compiled MuPDF ver. 1.3 and tried it.
When I created a "non Qt" project in the Creator and let MuPDF render several pages of a test PDF (storing them in files), the result was splendid. When I created a Qt GUI project, the project worked until I started using MuPDF. With MuPDF, all texts vanished from the app and I got bags of error messages:
render glyph failed err=13 face=0x29d1eb0, glyph=51
<many similar lines>
render glyph failed err=13 face=0x29d1eb0, glyph=51
<many similar lines>
To copy to clipboard, switch view to plain text mode
The end. Does anybody know what is it all about? And why poppler-qt produces such ugly images? Many PDF apps use poppler and results aren't ugly. With poppler, I tried this:
Poppler::Document *document = Poppler::Document::load(filename); // in fact, not here but in OpenPDF()
Poppler::Page *pdfPage = document->page(pageNumber);
QImage image
= pdfPage
->renderToImage
();
<display image in the page window>
delete pdfPage;
delete document; // in fact, not here but in ClosePDF()
Poppler::Document *document = Poppler::Document::load(filename); // in fact, not here but in OpenPDF()
Poppler::Page *pdfPage = document->page(pageNumber);
QImage image = pdfPage->renderToImage();
<display image in the page window>
delete pdfPage;
delete document; // in fact, not here but in ClosePDF()
To copy to clipboard, switch view to plain text mode
What am I doing wrong?
Bookmarks