PDA

View Full Version : Add Bookmark in PDF



LordQt
1st February 2008, 13:31
Hello friends,

simple question: How can I add a bookmark information to my pdf??

Here is my Code:


QPrinter printer;
QPainter p;
printer.setOrientation(QPrinter::Portrait);
printer.setOutputFileName("Sendungen.pdf");
printer.setOutputFormat(QPrinter::PdfFormat);
if (db.open()){
QSqlQuery query( "select Statement ");
query.setForwardOnly(true);
while(query.next()){
QSqlRecord record = query.record();
myimage.loadFromData(query.value(record.indexOf("imgData" ) ).toByteArray(),0);
myimage.convertToFormat(QImage::Format_Mono);
//p.setRenderHint(QPainter::Antialiasing, true);
p.begin(&printer);
p.drawImage(0, 0, myimage);
printer.newPage();
}
p.end();
}


There are many pictures in the pdf, and I search for a method to add a bookmark information per page. Is this possible??

wysota
7th February 2008, 12:24
I don't think this is possible with the current version of Qt. At least not when rendering an image. Maybe if you rendered a QTextDocument containing hyperlinks to images...