Lines 22-27
for which a new license (GPL+exception) is in place.
Link Here
|
22 |
#include <poppler/PageTransition.h> |
22 |
#include <poppler/PageTransition.h> |
23 |
#include <poppler/ViewerPreferences.h> |
23 |
#include <poppler/ViewerPreferences.h> |
24 |
#include <poppler/poppler-config.h> |
24 |
#include <poppler/poppler-config.h> |
|
|
25 |
#include <poppler/cpp/poppler-version.h> |
25 |
#include <poppler/SplashOutputDev.h> |
26 |
#include <poppler/SplashOutputDev.h> |
26 |
#include <poppler/splash/SplashBitmap.h> |
27 |
#include <poppler/splash/SplashBitmap.h> |
27 |
|
28 |
|
Lines 59-64
for which a new license (GPL+exception) is in place.
Link Here
|
59 |
#include "ui/multiprogressdialog.h" |
60 |
#include "ui/multiprogressdialog.h" |
60 |
#include "ui/propertiespalette.h" |
61 |
#include "ui/propertiespalette.h" |
61 |
|
62 |
|
|
|
63 |
#define POPPLER_VERSION_ENCODE(major, minor, micro) ( \ |
64 |
((major) * 10000) \ |
65 |
+ ((minor) * 100) \ |
66 |
+ ((micro) * 1)) |
67 |
#define POPPLER_ENCODED_VERSION POPPLER_VERSION_ENCODE(POPPLER_VERSION_MAJOR, POPPLER_VERSION_MINOR, POPPLER_VERSION_MICRO) |
68 |
|
62 |
PdfPlug::PdfPlug(ScribusDoc* doc, int flags) |
69 |
PdfPlug::PdfPlug(ScribusDoc* doc, int flags) |
63 |
{ |
70 |
{ |
64 |
tmpSele = new Selection(this, false); |
71 |
tmpSele = new Selection(this, false); |
Lines 507-518
bool PdfPlug::convert(const QString& fn)
Link Here
|
507 |
{ |
514 |
{ |
508 |
for (int i = 0; i < order->getLength (); ++i) |
515 |
for (int i = 0; i < order->getLength (); ++i) |
509 |
{ |
516 |
{ |
|
|
517 |
#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 58, 0) |
518 |
Object orderItem = order->get(i); |
519 |
#else |
510 |
Object orderItem; |
520 |
Object orderItem; |
511 |
order->get(i, &orderItem); |
521 |
order->get(i, &orderItem); |
|
|
522 |
#endif |
512 |
if (orderItem.isDict()) |
523 |
if (orderItem.isDict()) |
513 |
{ |
524 |
{ |
|
|
525 |
#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 58, 0) |
526 |
Object ref = order->getNF(i); |
527 |
#else |
514 |
Object ref; |
528 |
Object ref; |
515 |
order->getNF(i, &ref); |
529 |
order->getNF(i, &ref); |
|
|
530 |
#endif |
516 |
if (ref.isRef()) |
531 |
if (ref.isRef()) |
517 |
{ |
532 |
{ |
518 |
OptionalContentGroup *oc = ocg->findOcgByRef(ref.getRef()); |
533 |
OptionalContentGroup *oc = ocg->findOcgByRef(ref.getRef()); |
Lines 523-529
bool PdfPlug::convert(const QString& fn)
Link Here
|
523 |
ocgNames.append(ocgName); |
538 |
ocgNames.append(ocgName); |
524 |
} |
539 |
} |
525 |
} |
540 |
} |
|
|
541 |
#if POPPLER_ENCODED_VERSION < POPPLER_VERSION_ENCODE(0, 58, 0) |
526 |
ref.free(); |
542 |
ref.free(); |
|
|
543 |
#endif |
527 |
} |
544 |
} |
528 |
else |
545 |
else |
529 |
{ |
546 |
{ |
Lines 597-635
bool PdfPlug::convert(const QString& fn)
Link Here
|
597 |
dev->layersSetByOCG = true; |
614 |
dev->layersSetByOCG = true; |
598 |
} |
615 |
} |
599 |
#endif |
616 |
#endif |
|
|
617 |
|
618 |
#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 58, 0) |
619 |
Object info = pdfDoc->getDocInfo(); |
620 |
if (info.isDict()) |
621 |
{ |
622 |
Object obj; |
623 |
Dict *infoDict = info.getDict(); |
624 |
obj = infoDict->lookup((char*) "Title"); |
625 |
if (obj.isString()) |
626 |
{ |
627 |
m_Doc->documentInfo().setTitle(UnicodeParsedString(obj.getString())); |
628 |
} |
629 |
obj = infoDict->lookup((char*) "Author"); |
630 |
if (obj.isString()) |
631 |
{ |
632 |
m_Doc->documentInfo().setAuthor(UnicodeParsedString(obj.getString())); |
633 |
} |
634 |
obj = infoDict->lookup((char*) "Subject"); |
635 |
if (obj.isString()) |
636 |
{ |
637 |
m_Doc->documentInfo().setSubject(UnicodeParsedString(obj.getString())); |
638 |
} |
639 |
obj = infoDict->lookup((char*) "Keywords"); |
640 |
if (obj.isString()) |
641 |
{ |
642 |
// s1 = obj.getString(); |
643 |
m_Doc->documentInfo().setKeywords(UnicodeParsedString(obj.getString())); |
644 |
} |
645 |
} |
646 |
info = Object(); |
647 |
#else |
600 |
Object info; |
648 |
Object info; |
601 |
pdfDoc->getDocInfo(&info); |
649 |
pdfDoc->getDocInfo(&info); |
602 |
if (info.isDict()) |
650 |
if (info.isDict()) |
603 |
{ |
651 |
{ |
604 |
Object obj; |
652 |
Object obj; |
605 |
// GooString *s1; |
653 |
// GooString *s1; |
606 |
Dict *infoDict = info.getDict(); |
654 |
Dict *infoDict = info.getDict(); |
607 |
if (infoDict->lookup((char*)"Title", &obj )->isString()) |
655 |
if (infoDict->lookup((char*)"Title", &obj)->isString()) |
608 |
{ |
656 |
{ |
609 |
// s1 = obj.getString(); |
657 |
// s1 = obj.getString(); |
610 |
m_Doc->documentInfo().setTitle(UnicodeParsedString(obj.getString())); |
658 |
m_Doc->documentInfo().setTitle(UnicodeParsedString(obj.getString())); |
611 |
obj.free(); |
659 |
obj.free(); |
612 |
} |
660 |
} |
613 |
if (infoDict->lookup((char*)"Author", &obj )->isString()) |
661 |
if (infoDict->lookup((char*)"Author", &obj)->isString()) |
614 |
{ |
662 |
{ |
615 |
// s1 = obj.getString(); |
663 |
// s1 = obj.getString(); |
616 |
m_Doc->documentInfo().setAuthor(UnicodeParsedString(obj.getString())); |
664 |
m_Doc->documentInfo().setAuthor(UnicodeParsedString(obj.getString())); |
617 |
obj.free(); |
665 |
obj.free(); |
618 |
} |
666 |
} |
619 |
if (infoDict->lookup((char*)"Subject", &obj )->isString()) |
667 |
if (infoDict->lookup((char*)"Subject", &obj)->isString()) |
620 |
{ |
668 |
{ |
621 |
// s1 = obj.getString(); |
669 |
// s1 = obj.getString(); |
622 |
m_Doc->documentInfo().setSubject(UnicodeParsedString(obj.getString())); |
670 |
m_Doc->documentInfo().setSubject(UnicodeParsedString(obj.getString())); |
623 |
obj.free(); |
671 |
obj.free(); |
624 |
} |
672 |
} |
625 |
if (infoDict->lookup((char*)"Keywords", &obj )->isString()) |
673 |
if (infoDict->lookup((char*)"Keywords", &obj)->isString()) |
626 |
{ |
674 |
{ |
627 |
// s1 = obj.getString(); |
675 |
// s1 = obj.getString(); |
628 |
m_Doc->documentInfo().setKeywords(UnicodeParsedString(obj.getString())); |
676 |
m_Doc->documentInfo().setKeywords(UnicodeParsedString(obj.getString())); |
629 |
obj.free(); |
677 |
obj.free(); |
630 |
} |
678 |
} |
631 |
} |
679 |
} |
632 |
info.free(); |
680 |
info.free(); |
|
|
681 |
#endif |
633 |
if (cropped) |
682 |
if (cropped) |
634 |
{ |
683 |
{ |
635 |
QRectF crBox = getCBox(contentRect, pageNs[0]); |
684 |
QRectF crBox = getCBox(contentRect, pageNs[0]); |
Lines 746-753
bool PdfPlug::convert(const QString& fn)
Link Here
|
746 |
pdfDoc->displayPage(dev, pp, hDPI, vDPI, rotate, useMediaBox, crop, printing, NULL, NULL, dev->annotations_callback, dev); |
795 |
pdfDoc->displayPage(dev, pp, hDPI, vDPI, rotate, useMediaBox, crop, printing, NULL, NULL, dev->annotations_callback, dev); |
747 |
} |
796 |
} |
748 |
PDFPresentationData ef; |
797 |
PDFPresentationData ef; |
|
|
798 |
#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 58, 0) |
799 |
Object trans = pdfDoc->getPage(pp)->getTrans(); |
800 |
Object *transi = &trans; |
801 |
#else |
749 |
Object trans; |
802 |
Object trans; |
750 |
Object *transi = pdfDoc->getPage(pp)->getTrans(&trans); |
803 |
Object *transi = pdfDoc->getPage(pp)->getTrans(&trans); |
|
|
804 |
#endif |
751 |
if (transi->isDict()) |
805 |
if (transi->isDict()) |
752 |
{ |
806 |
{ |
753 |
m_Doc->pdfOptions().PresentMode = true; |
807 |
m_Doc->pdfOptions().PresentMode = true; |
Lines 793-824
bool PdfPlug::convert(const QString& fn)
Link Here
|
793 |
delete pgTrans; |
847 |
delete pgTrans; |
794 |
} |
848 |
} |
795 |
m_Doc->currentPage()->PresentVals = ef; |
849 |
m_Doc->currentPage()->PresentVals = ef; |
|
|
850 |
#if POPPLER_ENCODED_VERSION < POPPLER_VERSION_ENCODE(0, 58, 0) |
796 |
trans.free(); |
851 |
trans.free(); |
797 |
transi->free(); |
852 |
transi->free(); |
|
|
853 |
#endif |
798 |
} |
854 |
} |
799 |
int numjs = pdfDoc->getCatalog()->numJS(); |
855 |
int numjs = pdfDoc->getCatalog()->numJS(); |
800 |
if (numjs > 0) |
856 |
if (numjs > 0) |
801 |
{ |
857 |
{ |
802 |
NameTree *jsNameTreeP = new NameTree(); |
858 |
NameTree *jsNameTreeP = new NameTree(); |
|
|
859 |
#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 58, 0) |
860 |
Object catDict = pdfDoc->getXRef()->getCatalog(); |
861 |
#else |
803 |
Object catDict; |
862 |
Object catDict; |
804 |
pdfDoc->getXRef()->getCatalog(&catDict); |
863 |
pdfDoc->getXRef()->getCatalog(&catDict); |
|
|
864 |
#endif |
805 |
if (catDict.isDict()) |
865 |
if (catDict.isDict()) |
806 |
{ |
866 |
{ |
|
|
867 |
#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 58, 0) |
868 |
Object names = catDict.dictLookup("Names"); |
869 |
#else |
807 |
Object names; |
870 |
Object names; |
808 |
catDict.dictLookup("Names", &names); |
871 |
catDict.dictLookup("Names", &names); |
|
|
872 |
#endif |
809 |
if (names.isDict()) |
873 |
if (names.isDict()) |
810 |
{ |
874 |
{ |
|
|
875 |
#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 58, 0) |
876 |
Object obj = names.dictLookup("JavaScript"); |
877 |
jsNameTreeP->init(pdfDoc->getXRef(), &obj); |
878 |
#else |
811 |
Object obj; |
879 |
Object obj; |
812 |
names.dictLookup("JavaScript", &obj); |
880 |
names.dictLookup("JavaScript", &obj); |
813 |
jsNameTreeP->init(pdfDoc->getXRef(), &obj); |
881 |
jsNameTreeP->init(pdfDoc->getXRef(), &obj); |
814 |
obj.free(); |
882 |
obj.free(); |
|
|
883 |
#endif |
815 |
} |
884 |
} |
816 |
for (int a = 0; a < numjs; a++) |
885 |
for (int a = 0; a < numjs; a++) |
817 |
{ |
886 |
{ |
818 |
m_Doc->JavaScripts.insert(UnicodeParsedString(jsNameTreeP->getName(a)), UnicodeParsedString(pdfDoc->getCatalog()->getJS(a))); |
887 |
m_Doc->JavaScripts.insert(UnicodeParsedString(jsNameTreeP->getName(a)), UnicodeParsedString(pdfDoc->getCatalog()->getJS(a))); |
819 |
} |
888 |
} |
|
|
889 |
#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 58, 0) |
890 |
names = catDict.dictLookup("OpenAction"); |
891 |
#else |
820 |
names.free(); |
892 |
names.free(); |
821 |
catDict.dictLookup("OpenAction", &names); |
893 |
catDict.dictLookup("OpenAction", &names); |
|
|
894 |
#endif |
822 |
if (names.isDict()) |
895 |
if (names.isDict()) |
823 |
{ |
896 |
{ |
824 |
LinkAction *linkAction = NULL; |
897 |
LinkAction *linkAction = NULL; |
Lines 839-847
bool PdfPlug::convert(const QString& fn)
Link Here
|
839 |
} |
912 |
} |
840 |
} |
913 |
} |
841 |
} |
914 |
} |
|
|
915 |
#if POPPLER_ENCODED_VERSION < POPPLER_VERSION_ENCODE(0, 58, 0) |
842 |
names.free(); |
916 |
names.free(); |
|
|
917 |
#endif |
843 |
} |
918 |
} |
|
|
919 |
#if POPPLER_ENCODED_VERSION < POPPLER_VERSION_ENCODE(0, 58, 0) |
844 |
catDict.free(); |
920 |
catDict.free(); |
|
|
921 |
#endif |
845 |
delete jsNameTreeP; |
922 |
delete jsNameTreeP; |
846 |
} |
923 |
} |
847 |
m_Doc->pdfOptions().Version = (PDFOptions::PDFVersion)qMin(15, qMax(13, pdfDoc->getPDFMajorVersion() * 10 + pdfDoc->getPDFMinorVersion())); |
924 |
m_Doc->pdfOptions().Version = (PDFOptions::PDFVersion)qMin(15, qMax(13, pdfDoc->getPDFMajorVersion() * 10 + pdfDoc->getPDFMinorVersion())); |