r17847 by fschmid - PDF Importer: added import of global Javascripts.

scribus-commit scribus-commit at lists.scribus.net
Thu Nov 1 18:51:02 UTC 2012


Author: fschmid
Date: Thu Nov  1 18:51:02 2012
New Revision: 17847

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17847
Log:
PDF Importer: added import of global Javascripts.

Modified:
    trunk/Scribus/scribus/plugins/import/pdf/importpdf.cpp

Modified: trunk/Scribus/scribus/plugins/import/pdf/importpdf.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17847&path=/trunk/Scribus/scribus/plugins/import/pdf/importpdf.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/pdf/importpdf.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/pdf/importpdf.cpp Thu Nov  1 18:51:02 2012
@@ -493,6 +493,32 @@
 							else
 								pdfDoc->displayPage(dev, pp + 1, hDPI, vDPI, rotate, useMediaBox, crop, printing, NULL, NULL, dev->annotations_callback, dev);
 						}
+						int numjs = pdfDoc->getCatalog()->numJS();
+						if (numjs > 0)
+						{
+							NameTree *jsNameTreeP = new NameTree();
+							Object names;
+							Object catDict;
+							pdfDoc->getXRef()->getCatalog(&catDict);
+							if (catDict.isDict())
+							{
+								catDict.dictLookup("Names", &names);
+								if (names.isDict())
+								{
+									Object obj;
+									names.dictLookup("JavaScript", &obj);
+									jsNameTreeP->init(pdfDoc->getXRef(), &obj);
+									obj.free();
+								}
+								for (int a = 0; a < numjs; a++)
+								{
+									m_Doc->JavaScripts.insert(UnicodeParsedString(jsNameTreeP->getName(a)), UnicodeParsedString(pdfDoc->getCatalog()->getJS(a)));
+								}
+								names.free();
+							}
+							catDict.free();
+							delete jsNameTreeP;
+						}
 					}
 					else
 					{




More information about the scribus-commit mailing list