Changeset View
Changeset View
Standalone View
Standalone View
generators/poppler/generator_pdf.cpp
Show First 20 Lines • Show All 1258 Lines • ▼ Show 20 Line(s) | |||||
1259 | } | 1259 | } | ||
1260 | 1260 | | |||
1261 | void PDFGenerator::requestFontData(const Okular::FontInfo &font, QByteArray *data) | 1261 | void PDFGenerator::requestFontData(const Okular::FontInfo &font, QByteArray *data) | ||
1262 | { | 1262 | { | ||
1263 | Poppler::FontInfo fi = font.nativeId().value<Poppler::FontInfo>(); | 1263 | Poppler::FontInfo fi = font.nativeId().value<Poppler::FontInfo>(); | ||
1264 | *data = pdfdoc->fontData(fi); | 1264 | *data = pdfdoc->fontData(fi); | ||
1265 | } | 1265 | } | ||
1266 | 1266 | | |||
1267 | void PDFGenerator::requestSignedRevisionData( Okular::SignatureInfo *info, QByteArray *buffer ) | ||||
1268 | { | ||||
1269 | Q_ASSERT( info ); | ||||
1270 | Q_ASSERT( buffer ); | ||||
1271 | | ||||
1272 | const QUrl docUrl = document()->currentDocument(); | ||||
1273 | QFile f( docUrl.toLocalFile() ); | ||||
1274 | if ( !f.open( QIODevice::ReadOnly ) ) | ||||
1275 | { | ||||
1276 | KMessageBox::error( nullptr, i18n("Could not open '%1'. File does not exist", docUrl.toDisplayString() ) ); | ||||
1277 | return; | ||||
1278 | } | ||||
1279 | | ||||
1280 | QList<qint64> byteRange = info->signedRangeBounds(); | ||||
1281 | f.seek( byteRange.first() ); | ||||
1282 | QDataStream stream( buffer, QIODevice::WriteOnly ); | ||||
1283 | stream << f.read( byteRange.last() - byteRange.first() ); | ||||
1284 | f.close(); | ||||
1285 | } | ||||
1286 | | ||||
1267 | #define DUMMY_QPRINTER_COPY | 1287 | #define DUMMY_QPRINTER_COPY | ||
1268 | bool PDFGenerator::print( QPrinter& printer ) | 1288 | bool PDFGenerator::print( QPrinter& printer ) | ||
1269 | { | 1289 | { | ||
1270 | bool printAnnots = true; | 1290 | bool printAnnots = true; | ||
1271 | bool forceRasterize = false; | 1291 | bool forceRasterize = false; | ||
1272 | 1292 | | |||
1273 | if ( pdfOptionsPage ) | 1293 | if ( pdfOptionsPage ) | ||
1274 | { | 1294 | { | ||
▲ Show 20 Lines • Show All 193 Lines • ▼ Show 20 Line(s) | 1440 | { | |||
1468 | } | 1488 | } | ||
1469 | else if ( key == QLatin1String("FormCalculateOrder") ) | 1489 | else if ( key == QLatin1String("FormCalculateOrder") ) | ||
1470 | { | 1490 | { | ||
1471 | #ifdef HAVE_POPPLER_0_53 | 1491 | #ifdef HAVE_POPPLER_0_53 | ||
1472 | QMutexLocker ml(userMutex()); | 1492 | QMutexLocker ml(userMutex()); | ||
1473 | return QVariant::fromValue<QVector<int>>(pdfdoc->formCalculateOrder()); | 1493 | return QVariant::fromValue<QVector<int>>(pdfdoc->formCalculateOrder()); | ||
1474 | #endif | 1494 | #endif | ||
1475 | } | 1495 | } | ||
1496 | else if ( key == QLatin1String("IsDigitallySigned") ) | ||||
1497 | { | ||||
1498 | const Okular::Document *doc = document(); | ||||
1499 | uint numPages = doc->pages(); | ||||
1500 | for ( uint i = 0; i < numPages; i++ ) | ||||
1501 | { | ||||
1502 | foreach ( Okular::FormField *f, doc->page( i )->formFields() ) | ||||
1503 | { | ||||
1504 | if ( f->type() == Okular::FormField::FormSignature ) | ||||
1505 | return true; | ||||
1506 | } | ||||
1507 | } | ||||
1508 | return false; | ||||
1509 | } | ||||
1476 | return QVariant(); | 1510 | return QVariant(); | ||
1477 | } | 1511 | } | ||
1478 | 1512 | | |||
1479 | bool PDFGenerator::reparseConfig() | 1513 | bool PDFGenerator::reparseConfig() | ||
1480 | { | 1514 | { | ||
1481 | if ( !pdfdoc ) | 1515 | if ( !pdfdoc ) | ||
1482 | return false; | 1516 | return false; | ||
1483 | 1517 | | |||
▲ Show 20 Lines • Show All 475 Lines • Show Last 20 Lines |