PDF is not working only txt files are working. Poppler library is linux based I need windows. Give me some suggestion how can i view pdf document.
check my snippet.
// To read the document and store in the database
if (file.exists()) {
if (file.
open(QFile::ReadOnly)) { inside = file.readAll();
file.close();
}
query4.bindValue(":resume",inside);
QByteArray inside="";
QFile file(filename);
if (file.exists()) {
if (file.open(QFile::ReadOnly)) {
inside = file.readAll();
file.close();
}
query4.bindValue(":resume",inside);
To copy to clipboard, switch view to plain text mode
Retrieving from the database and viewing in TextEdit
QString queryString
= "SELECT * FROM Tbl_StudentLink";
query.exec(queryString);
int field1 = query.record().indexOf("resume");
if(query.seek(index,false))
{
// QUrl url = QUrl::fromEncoded(query.value(field1).toByteArray());
QByteArray pdf
= query.
value(field1
).
toByteArray();
viewPDF->show();
}
QSqlQuery query(console->mainwindow->db);
QString queryString = "SELECT * FROM Tbl_StudentLink";
query.exec(queryString);
int field1 = query.record().indexOf("resume");
if(query.seek(index,false))
{
// QUrl url = QUrl::fromEncoded(query.value(field1).toByteArray());
QByteArray pdf = query.value(field1).toByteArray();
QTextEdit *viewPDF = new QTextEdit(QString(pdf));
viewPDF->show();
}
To copy to clipboard, switch view to plain text mode
Bookmarks