View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0017102 | Scribus | Usability | public | 2024-01-01 12:32 | 2024-01-07 16:24 |
Reporter | pmjdebruijn | Assigned To | jghali | ||
Priority | normal | Severity | feature | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Product Version | 1.6.0 | ||||
Fixed in Version | 1.6.1.svn | ||||
Summary | 0017102: DublinCore DocInfo ComboBoxes | ||||
Description | Currently the DublinCore "Further Information" Document Information fields are entirely freeform, which is fine, but it also requires users to look up documentation on how to fill these out, practically leading to PDF with this information empty or improperly filled out, so some in-application guidance would be quite helpful. I've attached a prototype patch, that changes some fields to ComboBoxes, that offers some examples of how these fields should be properly filled. Date: offers the current date in proper format, both as an example and a convenience Type: https://www.dublincore.org/specifications/dublin-core/dcmi-type-vocabulary/ Format: application/pdf mimetype Language: en-US, en-GB, as examples, ideally, this of course should have many more entries Coverage: Worldwide, the Getty Thesaurus of Geographic Names [TGN] is probably too large to put into a ComboBox Rights: All Rights Reserved and list of Creative Commons licenses | ||||
Tags | No tags attached. | ||||
Patch | Yes | ||||
|
docinfo-combobox.patch (7,573 bytes)
diff -Nurpd a/scribus/ui/prefs_documentinformationbase.ui b/scribus/ui/prefs_documentinformationbase.ui --- a/scribus/ui/prefs_documentinformationbase.ui 2024-01-01 12:45:45.000000000 +0100 +++ b/scribus/ui/prefs_documentinformationbase.ui 2024-01-01 13:01:18.937709303 +0100 @@ -181,7 +181,11 @@ </widget> </item> <item row="2" column="1"> - <widget class="QLineEdit" name="dateLineEdit"/> + <widget class="QComboBox" name="dateLineEdit"> + <property name="editable"> + <bool>true</bool> + </property> + </widget> </item> <item row="3" column="0"> <widget class="QLabel" name="label_10"> @@ -191,7 +195,11 @@ </widget> </item> <item row="3" column="1"> - <widget class="QLineEdit" name="typeLineEdit"/> + <widget class="QComboBox" name="typeLineEdit"> + <property name="editable"> + <bool>true</bool> + </property> + </widget> </item> <item row="4" column="0"> <widget class="QLabel" name="label_11"> @@ -201,7 +209,11 @@ </widget> </item> <item row="4" column="1"> - <widget class="QLineEdit" name="formatLineEdit"/> + <widget class="QComboBox" name="formatLineEdit"> + <property name="editable"> + <bool>true</bool> + </property> + </widget> </item> <item row="5" column="0"> <widget class="QLabel" name="label_12"> @@ -231,7 +243,11 @@ </widget> </item> <item row="7" column="1"> - <widget class="QLineEdit" name="languageLineEdit"/> + <widget class="QComboBox" name="languageLineEdit"> + <property name="editable"> + <bool>true</bool> + </property> + </widget> </item> <item row="8" column="0"> <widget class="QLabel" name="label_15"> @@ -251,7 +267,11 @@ </widget> </item> <item row="9" column="1"> - <widget class="QLineEdit" name="coverageLineEdit"/> + <widget class="QComboBox" name="coverageLineEdit"> + <property name="editable"> + <bool>true</bool> + </property> + </widget> </item> <item row="10" column="0"> <widget class="QLabel" name="label_17"> @@ -261,7 +281,11 @@ </widget> </item> <item row="10" column="1"> - <widget class="QLineEdit" name="rightsLineEdit"/> + <widget class="QComboBox" name="rightsLineEdit"> + <property name="editable"> + <bool>true</bool> + </property> + </widget> </item> </layout> </item> diff -Nurpd a/scribus/ui/prefs_documentinformation.cpp b/scribus/ui/prefs_documentinformation.cpp --- a/scribus/ui/prefs_documentinformation.cpp 2024-01-01 12:45:45.000000000 +0100 +++ b/scribus/ui/prefs_documentinformation.cpp 2024-01-01 13:05:19.808624061 +0100 @@ -5,6 +5,7 @@ a copyright and/or license notice that p for which a new license (GPL+exception) is in place. */ +#include <QDateTime> #include "prefs_documentinformation.h" #include "prefsstructs.h" #include "scribusdoc.h" @@ -20,6 +21,32 @@ Prefs_DocumentInformation::Prefs_Documen m_caption = tr("Document Information"); m_icon = "documentinfo.png"; + + dateLineEdit->addItem(QDateTime::currentDateTime().toString("yyyy-MM-dd")); + typeLineEdit->addItem("Collection"); + typeLineEdit->addItem("Dataset"); + typeLineEdit->addItem("Event"); + typeLineEdit->addItem("Image"); + typeLineEdit->addItem("InteractiveResource"); + typeLineEdit->addItem("MovingImage"); + typeLineEdit->addItem("PhysicalObject"); + typeLineEdit->addItem("Service"); + typeLineEdit->addItem("Software"); + typeLineEdit->addItem("Sound"); + typeLineEdit->addItem("StillImage"); + typeLineEdit->addItem("Text"); + formatLineEdit->addItem("application/pdf"); + languageLineEdit->addItem("en-US"); + languageLineEdit->addItem("en-GB"); + coverageLineEdit->addItem("Worldwide"); + rightsLineEdit->addItem("All Rights Reserved"); + rightsLineEdit->addItem("Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International"); + rightsLineEdit->addItem("Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International"); + rightsLineEdit->addItem("Creative Commons Attribution-NonCommercial 4.0 International"); + rightsLineEdit->addItem("Creative Commons Attribution-NoDerivatives 4.0 International"); + rightsLineEdit->addItem("Creative Commons Attribution-ShareAlike 4.0 International"); + rightsLineEdit->addItem("Creative Commons Attribution 4.0 International"); + rightsLineEdit->addItem("Creative Commons Zero 1.0 Universal Public Domain Dedication"); } void Prefs_DocumentInformation::languageChange() @@ -35,15 +62,15 @@ void Prefs_DocumentInformation::restoreD descriptionTextEdit->setText(prefsData->docInfo.comments()); publisherLineEdit->setText(prefsData->docInfo.publisher()); contributorsTextEdit->setText(prefsData->docInfo.contrib()); - dateLineEdit->setText(prefsData->docInfo.date()); - typeLineEdit->setText(prefsData->docInfo.type()); - formatLineEdit->setText(prefsData->docInfo.format()); + dateLineEdit->setEditText(prefsData->docInfo.date()); + typeLineEdit->setEditText(prefsData->docInfo.type()); + formatLineEdit->setEditText(prefsData->docInfo.format()); identifierLineEdit->setText(prefsData->docInfo.ident()); sourceLineEdit->setText(prefsData->docInfo.source()); - languageLineEdit->setText(prefsData->docInfo.langInfo()); + languageLineEdit->setEditText(prefsData->docInfo.langInfo()); relationLineEdit->setText(prefsData->docInfo.relation()); - coverageLineEdit->setText(prefsData->docInfo.cover()); - rightsLineEdit->setText(prefsData->docInfo.rights()); + coverageLineEdit->setEditText(prefsData->docInfo.cover()); + rightsLineEdit->setEditText(prefsData->docInfo.rights()); } void Prefs_DocumentInformation::saveGuiToPrefs(struct ApplicationPrefs *prefsData) const @@ -55,14 +82,14 @@ void Prefs_DocumentInformation::saveGuiT prefsData->docInfo.setComments(descriptionTextEdit->toPlainText()); prefsData->docInfo.setPublisher(publisherLineEdit->text()); prefsData->docInfo.setContrib(contributorsTextEdit->toPlainText()); - prefsData->docInfo.setDate(dateLineEdit->text()); - prefsData->docInfo.setType(typeLineEdit->text()); - prefsData->docInfo.setFormat(formatLineEdit->text()); + prefsData->docInfo.setDate(dateLineEdit->currentText()); + prefsData->docInfo.setType(typeLineEdit->currentText()); + prefsData->docInfo.setFormat(formatLineEdit->currentText()); prefsData->docInfo.setIdent(identifierLineEdit->text()); prefsData->docInfo.setSource(sourceLineEdit->text()); - prefsData->docInfo.setLangInfo(languageLineEdit->text()); + prefsData->docInfo.setLangInfo(languageLineEdit->currentText()); prefsData->docInfo.setRelation(relationLineEdit->text()); - prefsData->docInfo.setCover(coverageLineEdit->text()); - prefsData->docInfo.setRights(rightsLineEdit->text()); + prefsData->docInfo.setCover(coverageLineEdit->currentText()); + prefsData->docInfo.setRights(rightsLineEdit->currentText()); } |
|
it seems "Further Information" does not end up in exported PDFs? |
|
So this is turned out be to quite the rabbithole, so XMP is only embedded in PDF/X-4, and then only basic metadata (so nothing from Further Information) makes it into the XMP |
|
This is updated version, which 1) Fixes the tab navigation flow on the QTextEdit by setting tabChangesFocus to true 2) Disables formatLineEdit as the format field is entirely ignored it seems, and hardcoded in the PDF engine to application/pdf 3) Changes some fields to ComboBox just as the previous patch docinfo-combobox-2.patch (8,826 bytes)
diff -Nurpd a/scribus/ui/prefs_documentinformationbase.ui b/scribus/ui/prefs_documentinformationbase.ui --- a/scribus/ui/prefs_documentinformationbase.ui 2023-12-31 16:58:17.000000000 +0100 +++ b/scribus/ui/prefs_documentinformationbase.ui 2024-01-02 17:53:22.778085165 +0100 @@ -99,7 +99,11 @@ </widget> </item> <item row="3" column="1"> - <widget class="QTextEdit" name="keywordsTextEdit"/> + <widget class="QTextEdit" name="keywordsTextEdit"> + <property name="tabChangesFocus"> + <bool>true</bool> + </property> + </widget> </item> <item row="4" column="0"> <widget class="QLabel" name="label_6"> @@ -109,7 +113,11 @@ </widget> </item> <item row="4" column="1"> - <widget class="QTextEdit" name="descriptionTextEdit"/> + <widget class="QTextEdit" name="descriptionTextEdit"> + <property name="tabChangesFocus"> + <bool>true</bool> + </property> + </widget> </item> </layout> </widget> @@ -171,7 +179,11 @@ </widget> </item> <item row="1" column="1"> - <widget class="QTextEdit" name="contributorsTextEdit"/> + <widget class="QTextEdit" name="contributorsTextEdit"> + <property name="tabChangesFocus"> + <bool>true</bool> + </property> + </widget> </item> <item row="2" column="0"> <widget class="QLabel" name="label_9"> @@ -181,7 +193,11 @@ </widget> </item> <item row="2" column="1"> - <widget class="QLineEdit" name="dateLineEdit"/> + <widget class="QComboBox" name="dateLineEdit"> + <property name="editable"> + <bool>true</bool> + </property> + </widget> </item> <item row="3" column="0"> <widget class="QLabel" name="label_10"> @@ -191,7 +207,11 @@ </widget> </item> <item row="3" column="1"> - <widget class="QLineEdit" name="typeLineEdit"/> + <widget class="QComboBox" name="typeLineEdit"> + <property name="editable"> + <bool>true</bool> + </property> + </widget> </item> <item row="4" column="0"> <widget class="QLabel" name="label_11"> @@ -201,7 +221,14 @@ </widget> </item> <item row="4" column="1"> - <widget class="QLineEdit" name="formatLineEdit"/> + <widget class="QLineEdit" name="formatLineEdit"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>application/pdf</string> + </property> + </widget> </item> <item row="5" column="0"> <widget class="QLabel" name="label_12"> @@ -231,7 +258,11 @@ </widget> </item> <item row="7" column="1"> - <widget class="QLineEdit" name="languageLineEdit"/> + <widget class="QComboBox" name="languageLineEdit"> + <property name="editable"> + <bool>true</bool> + </property> + </widget> </item> <item row="8" column="0"> <widget class="QLabel" name="label_15"> @@ -251,7 +282,11 @@ </widget> </item> <item row="9" column="1"> - <widget class="QLineEdit" name="coverageLineEdit"/> + <widget class="QComboBox" name="coverageLineEdit"> + <property name="editable"> + <bool>true</bool> + </property> + </widget> </item> <item row="10" column="0"> <widget class="QLabel" name="label_17"> @@ -261,7 +296,11 @@ </widget> </item> <item row="10" column="1"> - <widget class="QLineEdit" name="rightsLineEdit"/> + <widget class="QComboBox" name="rightsLineEdit"> + <property name="editable"> + <bool>true</bool> + </property> + </widget> </item> </layout> </item> diff -Nurpd a/scribus/ui/prefs_documentinformation.cpp b/scribus/ui/prefs_documentinformation.cpp --- a/scribus/ui/prefs_documentinformation.cpp 2023-12-31 16:58:17.000000000 +0100 +++ b/scribus/ui/prefs_documentinformation.cpp 2024-01-02 17:54:46.943624669 +0100 @@ -5,6 +5,7 @@ a copyright and/or license notice that p for which a new license (GPL+exception) is in place. */ +#include <QDateTime> #include "prefs_documentinformation.h" #include "prefsstructs.h" #include "scribusdoc.h" @@ -20,6 +21,31 @@ Prefs_DocumentInformation::Prefs_Documen m_caption = tr("Document Information"); m_icon = "documentinfo.png"; + + dateLineEdit->addItem(QDateTime::currentDateTime().toString("yyyy-MM-dd")); + typeLineEdit->addItem("Collection"); + typeLineEdit->addItem("Dataset"); + typeLineEdit->addItem("Event"); + typeLineEdit->addItem("Image"); + typeLineEdit->addItem("InteractiveResource"); + typeLineEdit->addItem("MovingImage"); + typeLineEdit->addItem("PhysicalObject"); + typeLineEdit->addItem("Service"); + typeLineEdit->addItem("Software"); + typeLineEdit->addItem("Sound"); + typeLineEdit->addItem("StillImage"); + typeLineEdit->addItem("Text"); + languageLineEdit->addItem("en-US"); + languageLineEdit->addItem("en-GB"); + coverageLineEdit->addItem("Worldwide"); + rightsLineEdit->addItem("All Rights Reserved"); + rightsLineEdit->addItem("Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International"); + rightsLineEdit->addItem("Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International"); + rightsLineEdit->addItem("Creative Commons Attribution-NonCommercial 4.0 International"); + rightsLineEdit->addItem("Creative Commons Attribution-NoDerivatives 4.0 International"); + rightsLineEdit->addItem("Creative Commons Attribution-ShareAlike 4.0 International"); + rightsLineEdit->addItem("Creative Commons Attribution 4.0 International"); + rightsLineEdit->addItem("Creative Commons Zero 1.0 Universal Public Domain Dedication"); } void Prefs_DocumentInformation::languageChange() @@ -35,15 +61,15 @@ void Prefs_DocumentInformation::restoreD descriptionTextEdit->setText(prefsData->docInfo.comments()); publisherLineEdit->setText(prefsData->docInfo.publisher()); contributorsTextEdit->setText(prefsData->docInfo.contrib()); - dateLineEdit->setText(prefsData->docInfo.date()); - typeLineEdit->setText(prefsData->docInfo.type()); + dateLineEdit->setEditText(prefsData->docInfo.date()); + typeLineEdit->setEditText(prefsData->docInfo.type()); formatLineEdit->setText(prefsData->docInfo.format()); identifierLineEdit->setText(prefsData->docInfo.ident()); sourceLineEdit->setText(prefsData->docInfo.source()); - languageLineEdit->setText(prefsData->docInfo.langInfo()); + languageLineEdit->setEditText(prefsData->docInfo.langInfo()); relationLineEdit->setText(prefsData->docInfo.relation()); - coverageLineEdit->setText(prefsData->docInfo.cover()); - rightsLineEdit->setText(prefsData->docInfo.rights()); + coverageLineEdit->setEditText(prefsData->docInfo.cover()); + rightsLineEdit->setEditText(prefsData->docInfo.rights()); } void Prefs_DocumentInformation::saveGuiToPrefs(struct ApplicationPrefs *prefsData) const @@ -55,14 +81,14 @@ void Prefs_DocumentInformation::saveGuiT prefsData->docInfo.setComments(descriptionTextEdit->toPlainText()); prefsData->docInfo.setPublisher(publisherLineEdit->text()); prefsData->docInfo.setContrib(contributorsTextEdit->toPlainText()); - prefsData->docInfo.setDate(dateLineEdit->text()); - prefsData->docInfo.setType(typeLineEdit->text()); + prefsData->docInfo.setDate(dateLineEdit->currentText()); + prefsData->docInfo.setType(typeLineEdit->currentText()); prefsData->docInfo.setFormat(formatLineEdit->text()); prefsData->docInfo.setIdent(identifierLineEdit->text()); prefsData->docInfo.setSource(sourceLineEdit->text()); - prefsData->docInfo.setLangInfo(languageLineEdit->text()); + prefsData->docInfo.setLangInfo(languageLineEdit->currentText()); prefsData->docInfo.setRelation(relationLineEdit->text()); - prefsData->docInfo.setCover(coverageLineEdit->text()); - prefsData->docInfo.setRights(rightsLineEdit->text()); + prefsData->docInfo.setCover(coverageLineEdit->currentText()); + prefsData->docInfo.setRights(rightsLineEdit->currentText()); } |
|
Small refinement still docinfo-combobox-3.patch (8,754 bytes)
diff -Nurpd a/scribus/ui/prefs_documentinformationbase.ui b/scribus/ui/prefs_documentinformationbase.ui --- a/scribus/ui/prefs_documentinformationbase.ui 2023-12-31 16:58:17.000000000 +0100 +++ b/scribus/ui/prefs_documentinformationbase.ui 2024-01-02 20:00:38.778907264 +0100 @@ -99,7 +99,11 @@ </widget> </item> <item row="3" column="1"> - <widget class="QTextEdit" name="keywordsTextEdit"/> + <widget class="QTextEdit" name="keywordsTextEdit"> + <property name="tabChangesFocus"> + <bool>true</bool> + </property> + </widget> </item> <item row="4" column="0"> <widget class="QLabel" name="label_6"> @@ -109,7 +113,11 @@ </widget> </item> <item row="4" column="1"> - <widget class="QTextEdit" name="descriptionTextEdit"/> + <widget class="QTextEdit" name="descriptionTextEdit"> + <property name="tabChangesFocus"> + <bool>true</bool> + </property> + </widget> </item> </layout> </widget> @@ -171,7 +179,11 @@ </widget> </item> <item row="1" column="1"> - <widget class="QTextEdit" name="contributorsTextEdit"/> + <widget class="QTextEdit" name="contributorsTextEdit"> + <property name="tabChangesFocus"> + <bool>true</bool> + </property> + </widget> </item> <item row="2" column="0"> <widget class="QLabel" name="label_9"> @@ -181,7 +193,11 @@ </widget> </item> <item row="2" column="1"> - <widget class="QLineEdit" name="dateLineEdit"/> + <widget class="QComboBox" name="dateLineEdit"> + <property name="editable"> + <bool>true</bool> + </property> + </widget> </item> <item row="3" column="0"> <widget class="QLabel" name="label_10"> @@ -191,7 +207,11 @@ </widget> </item> <item row="3" column="1"> - <widget class="QLineEdit" name="typeLineEdit"/> + <widget class="QComboBox" name="typeLineEdit"> + <property name="editable"> + <bool>true</bool> + </property> + </widget> </item> <item row="4" column="0"> <widget class="QLabel" name="label_11"> @@ -201,7 +221,11 @@ </widget> </item> <item row="4" column="1"> - <widget class="QLineEdit" name="formatLineEdit"/> + <widget class="QLineEdit" name="formatLineEdit"> + <property name="enabled"> + <bool>false</bool> + </property> + </widget> </item> <item row="5" column="0"> <widget class="QLabel" name="label_12"> @@ -231,7 +255,11 @@ </widget> </item> <item row="7" column="1"> - <widget class="QLineEdit" name="languageLineEdit"/> + <widget class="QComboBox" name="languageLineEdit"> + <property name="editable"> + <bool>true</bool> + </property> + </widget> </item> <item row="8" column="0"> <widget class="QLabel" name="label_15"> @@ -251,7 +279,11 @@ </widget> </item> <item row="9" column="1"> - <widget class="QLineEdit" name="coverageLineEdit"/> + <widget class="QComboBox" name="coverageLineEdit"> + <property name="editable"> + <bool>true</bool> + </property> + </widget> </item> <item row="10" column="0"> <widget class="QLabel" name="label_17"> @@ -261,7 +293,11 @@ </widget> </item> <item row="10" column="1"> - <widget class="QLineEdit" name="rightsLineEdit"/> + <widget class="QComboBox" name="rightsLineEdit"> + <property name="editable"> + <bool>true</bool> + </property> + </widget> </item> </layout> </item> diff -Nurpd a/scribus/ui/prefs_documentinformation.cpp b/scribus/ui/prefs_documentinformation.cpp --- a/scribus/ui/prefs_documentinformation.cpp 2023-12-31 16:58:17.000000000 +0100 +++ b/scribus/ui/prefs_documentinformation.cpp 2024-01-02 20:00:56.414746678 +0100 @@ -5,6 +5,7 @@ a copyright and/or license notice that p for which a new license (GPL+exception) is in place. */ +#include <QDateTime> #include "prefs_documentinformation.h" #include "prefsstructs.h" #include "scribusdoc.h" @@ -20,6 +21,31 @@ Prefs_DocumentInformation::Prefs_Documen m_caption = tr("Document Information"); m_icon = "documentinfo.png"; + + dateLineEdit->addItem(QDateTime::currentDateTime().toString("yyyy-MM-dd")); + typeLineEdit->addItem("Collection"); + typeLineEdit->addItem("Dataset"); + typeLineEdit->addItem("Event"); + typeLineEdit->addItem("Image"); + typeLineEdit->addItem("InteractiveResource"); + typeLineEdit->addItem("MovingImage"); + typeLineEdit->addItem("PhysicalObject"); + typeLineEdit->addItem("Service"); + typeLineEdit->addItem("Software"); + typeLineEdit->addItem("Sound"); + typeLineEdit->addItem("StillImage"); + typeLineEdit->addItem("Text"); + languageLineEdit->addItem("en-US"); + languageLineEdit->addItem("en-GB"); + coverageLineEdit->addItem("Worldwide"); + rightsLineEdit->addItem("All Rights Reserved"); + rightsLineEdit->addItem("Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International"); + rightsLineEdit->addItem("Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International"); + rightsLineEdit->addItem("Creative Commons Attribution-NonCommercial 4.0 International"); + rightsLineEdit->addItem("Creative Commons Attribution-NoDerivatives 4.0 International"); + rightsLineEdit->addItem("Creative Commons Attribution-ShareAlike 4.0 International"); + rightsLineEdit->addItem("Creative Commons Attribution 4.0 International"); + rightsLineEdit->addItem("Creative Commons Zero 1.0 Universal Public Domain Dedication"); } void Prefs_DocumentInformation::languageChange() @@ -35,15 +61,15 @@ void Prefs_DocumentInformation::restoreD descriptionTextEdit->setText(prefsData->docInfo.comments()); publisherLineEdit->setText(prefsData->docInfo.publisher()); contributorsTextEdit->setText(prefsData->docInfo.contrib()); - dateLineEdit->setText(prefsData->docInfo.date()); - typeLineEdit->setText(prefsData->docInfo.type()); - formatLineEdit->setText(prefsData->docInfo.format()); + dateLineEdit->setEditText(prefsData->docInfo.date()); + typeLineEdit->setEditText(prefsData->docInfo.type()); + formatLineEdit->setText("application/pdf"); identifierLineEdit->setText(prefsData->docInfo.ident()); sourceLineEdit->setText(prefsData->docInfo.source()); - languageLineEdit->setText(prefsData->docInfo.langInfo()); + languageLineEdit->setEditText(prefsData->docInfo.langInfo()); relationLineEdit->setText(prefsData->docInfo.relation()); - coverageLineEdit->setText(prefsData->docInfo.cover()); - rightsLineEdit->setText(prefsData->docInfo.rights()); + coverageLineEdit->setEditText(prefsData->docInfo.cover()); + rightsLineEdit->setEditText(prefsData->docInfo.rights()); } void Prefs_DocumentInformation::saveGuiToPrefs(struct ApplicationPrefs *prefsData) const @@ -55,14 +81,14 @@ void Prefs_DocumentInformation::saveGuiT prefsData->docInfo.setComments(descriptionTextEdit->toPlainText()); prefsData->docInfo.setPublisher(publisherLineEdit->text()); prefsData->docInfo.setContrib(contributorsTextEdit->toPlainText()); - prefsData->docInfo.setDate(dateLineEdit->text()); - prefsData->docInfo.setType(typeLineEdit->text()); + prefsData->docInfo.setDate(dateLineEdit->currentText()); + prefsData->docInfo.setType(typeLineEdit->currentText()); prefsData->docInfo.setFormat(formatLineEdit->text()); prefsData->docInfo.setIdent(identifierLineEdit->text()); prefsData->docInfo.setSource(sourceLineEdit->text()); - prefsData->docInfo.setLangInfo(languageLineEdit->text()); + prefsData->docInfo.setLangInfo(languageLineEdit->currentText()); prefsData->docInfo.setRelation(relationLineEdit->text()); - prefsData->docInfo.setCover(coverageLineEdit->text()); - prefsData->docInfo.setRights(rightsLineEdit->text()); + prefsData->docInfo.setCover(coverageLineEdit->currentText()); + prefsData->docInfo.setRights(rightsLineEdit->currentText()); } |
|
I've also attempted to extend the XMP embedding, however it fails to embed valid XMP somehow... The patch also enables XMP for PDF 1.6 (as X-4 is a variant of 1.6) And it refactors variable naming, which makes the patch a bit hard to read by itself in places, but the resulting code makes more sense. pdflib-dc-meta.patch (6,287 bytes)
diff -Nurpd a/scribus/pdflib_core.cpp b/scribus/pdflib_core.cpp --- a/scribus/pdflib_core.cpp 2023-12-31 16:58:30.000000000 +0100 +++ b/scribus/pdflib_core.cpp 2024-01-02 18:19:37.347046496 +0100 @@ -1020,8 +1020,8 @@ void PDFLibCore::PDF_Begin_Catalog() // Datum += tmp; // Datum += "Z"; - // only include XMP to PDF/X-4 at the moment, could easily be extended to include it to any PDF - if (Options.Version == PDFVersion::PDF_X4) + // only include XMP to PDF 1.6 and PDF/X-4 at the moment, could easily be extended to include it to any PDF + if (Options.Version >= PDFVersion::PDF_16) generateXMP(dt.toString("yyyy-MM-ddThh:mm:ssZ")); /* The following code makes the resulting PDF "Reader enabled" in Acrobat Reader 8 @@ -11721,34 +11721,127 @@ void PDFLibCore::generateXMP(const QStri QDomElement descDC = desc.cloneNode().toElement(); rdf.appendChild(descDC); QString dcNS = "http://purl.org/dc/elements/1.1/"; + descDC.setAttributeNS(dcNS, "dc:format", "application/pdf"); + + if (!doc.documentInfo().cover().isEmpty()) + descDC.setAttributeNS(dcNS, "dc:coverage", doc.documentInfo().cover()); + + //QString xmlLang = "x-default"; + if (!doc.documentInfo().langInfo().isEmpty()) + { + QDomElement language = xmpDoc.createElement("dc:language"); + descDC.appendChild(language); + QDomElement bag1 = xmpDoc.createElement("rdf:Bag"); + language.appendChild(bag1); + QDomElement li1 = xmpDoc.createElement("rdf:li"); + bag1.appendChild(li1); + li1.appendChild(xmpDoc.createTextNode(doc.documentInfo().langInfo())); + //xmlLang = doc.documentInfo().langInfo(); + } + QDomElement title = xmpDoc.createElement("dc:title"); descDC.appendChild(title); - QDomElement alt1 = xmpDoc.createElement("rdf:Alt"); - title.appendChild(alt1); - QDomElement li1 = xmpDoc.createElement("rdf:li"); - li1.setAttribute("xml:lang", "x-default"); - alt1.appendChild(li1); + QDomElement alt2 = xmpDoc.createElement("rdf:Alt"); + title.appendChild(alt2); + QDomElement li2 = xmpDoc.createElement("rdf:li"); + li2.setAttribute("xml:lang", "x-default"); + alt2.appendChild(li2); QString docTitle = doc.documentInfo().title(); if ((PDF_IsPDFX()) && (docTitle.isEmpty())) docTitle = doc.documentFileName(); - li1.appendChild(xmpDoc.createTextNode(docTitle)); + li2.appendChild(xmpDoc.createTextNode(docTitle)); + + if (!doc.documentInfo().publisher().isEmpty()) + { + QDomElement publisher = xmpDoc.createElement("dc:publisher"); + descDC.appendChild(publisher); + QDomElement bag3 = xmpDoc.createElement("rdf:Bag"); + publisher.appendChild(bag3); + QDomElement li3 = xmpDoc.createElement("rdf:li"); + bag3.appendChild(li3); + li3.appendChild(xmpDoc.createTextNode(doc.documentInfo().publisher())); + } + QDomElement creator = xmpDoc.createElement("dc:creator"); descDC.appendChild(creator); - QDomElement seq = xmpDoc.createElement("rdf:Seq"); - creator.appendChild(seq); - QDomElement li2 = xmpDoc.createElement("rdf:li"); - seq.appendChild(li2); - li2.appendChild(xmpDoc.createTextNode(doc.documentInfo().author())); + QDomElement seq4 = xmpDoc.createElement("rdf:Seq"); + creator.appendChild(seq4); + QDomElement li4 = xmpDoc.createElement("rdf:li"); + seq4.appendChild(li4); + li4.appendChild(xmpDoc.createTextNode(doc.documentInfo().author())); + + if (!doc.documentInfo().contrib().isEmpty()) + { + QDomElement contributor = xmpDoc.createElement("dc:contributor"); + descDC.appendChild(contributor); + QDomElement bag5 = xmpDoc.createElement("rdf:Bag"); + contributor.appendChild(bag5); + QDomElement li5 = xmpDoc.createElement("rdf:li"); + bag5.appendChild(li5); + li5.appendChild(xmpDoc.createTextNode(doc.documentInfo().contrib())); + } + // Subject's entry in Document Info dictionary is actually dc:description in XMP, not dc:subject. QDomElement description = xmpDoc.createElement("dc:description"); descDC.appendChild(description); - QDomElement alt2 = xmpDoc.createElement("rdf:Alt"); - description.appendChild(alt2); - QDomElement li3 = xmpDoc.createElement("rdf:li"); - li3.setAttribute("xml:lang", "x-default"); - alt2.appendChild(li3); - li3.appendChild(xmpDoc.createTextNode(doc.documentInfo().subject())); + QDomElement alt6 = xmpDoc.createElement("rdf:Alt"); + description.appendChild(alt6); + QDomElement li6 = xmpDoc.createElement("rdf:li"); + li6.setAttribute("xml:lang", "x-default"); + alt6.appendChild(li6); + li6.appendChild(xmpDoc.createTextNode(doc.documentInfo().subject())); + + if (!doc.documentInfo().type().isEmpty()) + { + QDomElement type = xmpDoc.createElement("dc:type"); + descDC.appendChild(type); + QDomElement bag7 = xmpDoc.createElement("rdf:Bag"); + type.appendChild(bag7); + QDomElement li7 = xmpDoc.createElement("rdf:li"); + bag7.appendChild(li7); + li7.appendChild(xmpDoc.createTextNode(doc.documentInfo().type())); + } + + if (!doc.documentInfo().rights().isEmpty()) + { + QDomElement rights = xmpDoc.createElement("dc:rights"); + descDC.appendChild(rights); + QDomElement alt8 = xmpDoc.createElement("rdf:Alt"); + rights.appendChild(alt8); + QDomElement li8 = xmpDoc.createElement("rdf:li"); + li8.setAttribute("xml:lang", "x-default"); + alt8.appendChild(li8); + li8.appendChild(xmpDoc.createTextNode(doc.documentInfo().rights())); + } + + if (!doc.documentInfo().date().isEmpty()) + { + QDomElement date = xmpDoc.createElement("dc:date"); + descDC.appendChild(date); + QDomElement seq9 = xmpDoc.createElement("rdf:Seq"); + date.appendChild(seq9); + QDomElement li9 = xmpDoc.createElement("rdf:li"); + seq9.appendChild(li9); + li9.appendChild(xmpDoc.createTextNode(doc.documentInfo().date())); + } + + if (!doc.documentInfo().ident().isEmpty()) + descDC.setAttributeNS(dcNS, "dc:identifier", doc.documentInfo().ident()); + + if (!doc.documentInfo().source().isEmpty()) + descDC.setAttributeNS(dcNS, "dc:source", doc.documentInfo().source()); + + if (!doc.documentInfo().relation().isEmpty()) + { + QDomElement relation = xmpDoc.createElement("dc:relation"); + descDC.appendChild(relation); + QDomElement bag10 = xmpDoc.createElement("rdf:Bag"); + relation.appendChild(bag10); + QDomElement li10 = xmpDoc.createElement("rdf:li"); + bag10.appendChild(li10); + li10.appendChild(xmpDoc.createTextNode(doc.documentInfo().relation())); + } if (PDF_IsPDFX()) { |
|
To illustrate the graphical changes, see attached screenshot. In the long run docInfo.format property should probably removed entirely, including the GUI element. However, I'm mainly concerned with hopefully getting some of these changes into 1.6.1, so I'd love some feedback before I take this any further... Any tips on debugging the XMP issue would also be appreciated. |
|
So the XMP issue was a bit silly, and it's fixed, but I did a minor refactor of the relevant code that initially caused my silly error, and split it up into a seperate patch (see pdflib-hasxmp.patch) pdflib-dc-meta-2.patch (5,737 bytes)
diff -Nurpd a/scribus/pdflib_core.cpp b/scribus/pdflib_core.cpp --- a/scribus/pdflib_core.cpp 2023-12-31 16:58:30.000000000 +0100 +++ b/scribus/pdflib_core.cpp 2024-01-02 18:19:37.347046496 +0100 @@ -11721,34 +11721,127 @@ void PDFLibCore::generateXMP(const QStri QDomElement descDC = desc.cloneNode().toElement(); rdf.appendChild(descDC); QString dcNS = "http://purl.org/dc/elements/1.1/"; + descDC.setAttributeNS(dcNS, "dc:format", "application/pdf"); + + if (!doc.documentInfo().cover().isEmpty()) + descDC.setAttributeNS(dcNS, "dc:coverage", doc.documentInfo().cover()); + + QString xmlLang = "x-default"; + if (!doc.documentInfo().langInfo().isEmpty()) + { + QDomElement language = xmpDoc.createElement("dc:language"); + descDC.appendChild(language); + QDomElement bag1 = xmpDoc.createElement("rdf:Bag"); + language.appendChild(bag1); + QDomElement li1 = xmpDoc.createElement("rdf:li"); + bag1.appendChild(li1); + li1.appendChild(xmpDoc.createTextNode(doc.documentInfo().langInfo())); + xmlLang = doc.documentInfo().langInfo(); + } + QDomElement title = xmpDoc.createElement("dc:title"); descDC.appendChild(title); - QDomElement alt1 = xmpDoc.createElement("rdf:Alt"); - title.appendChild(alt1); - QDomElement li1 = xmpDoc.createElement("rdf:li"); - li1.setAttribute("xml:lang", "x-default"); - alt1.appendChild(li1); + QDomElement alt2 = xmpDoc.createElement("rdf:Alt"); + title.appendChild(alt2); + QDomElement li2 = xmpDoc.createElement("rdf:li"); + li2.setAttribute("xml:lang", xmlLang); + alt2.appendChild(li2); QString docTitle = doc.documentInfo().title(); if ((PDF_IsPDFX()) && (docTitle.isEmpty())) docTitle = doc.documentFileName(); - li1.appendChild(xmpDoc.createTextNode(docTitle)); + li2.appendChild(xmpDoc.createTextNode(docTitle)); + + if (!doc.documentInfo().publisher().isEmpty()) + { + QDomElement publisher = xmpDoc.createElement("dc:publisher"); + descDC.appendChild(publisher); + QDomElement bag3 = xmpDoc.createElement("rdf:Bag"); + publisher.appendChild(bag3); + QDomElement li3 = xmpDoc.createElement("rdf:li"); + bag3.appendChild(li3); + li3.appendChild(xmpDoc.createTextNode(doc.documentInfo().publisher())); + } + QDomElement creator = xmpDoc.createElement("dc:creator"); descDC.appendChild(creator); - QDomElement seq = xmpDoc.createElement("rdf:Seq"); - creator.appendChild(seq); - QDomElement li2 = xmpDoc.createElement("rdf:li"); - seq.appendChild(li2); - li2.appendChild(xmpDoc.createTextNode(doc.documentInfo().author())); + QDomElement seq4 = xmpDoc.createElement("rdf:Seq"); + creator.appendChild(seq4); + QDomElement li4 = xmpDoc.createElement("rdf:li"); + seq4.appendChild(li4); + li4.appendChild(xmpDoc.createTextNode(doc.documentInfo().author())); + + if (!doc.documentInfo().contrib().isEmpty()) + { + QDomElement contributor = xmpDoc.createElement("dc:contributor"); + descDC.appendChild(contributor); + QDomElement bag5 = xmpDoc.createElement("rdf:Bag"); + contributor.appendChild(bag5); + QDomElement li5 = xmpDoc.createElement("rdf:li"); + bag5.appendChild(li5); + li5.appendChild(xmpDoc.createTextNode(doc.documentInfo().contrib())); + } + // Subject's entry in Document Info dictionary is actually dc:description in XMP, not dc:subject. QDomElement description = xmpDoc.createElement("dc:description"); descDC.appendChild(description); - QDomElement alt2 = xmpDoc.createElement("rdf:Alt"); - description.appendChild(alt2); - QDomElement li3 = xmpDoc.createElement("rdf:li"); - li3.setAttribute("xml:lang", "x-default"); - alt2.appendChild(li3); - li3.appendChild(xmpDoc.createTextNode(doc.documentInfo().subject())); + QDomElement alt6 = xmpDoc.createElement("rdf:Alt"); + description.appendChild(alt6); + QDomElement li6 = xmpDoc.createElement("rdf:li"); + li6.setAttribute("xml:lang", xmlLang); + alt6.appendChild(li6); + li6.appendChild(xmpDoc.createTextNode(doc.documentInfo().subject())); + + if (!doc.documentInfo().type().isEmpty()) + { + QDomElement type = xmpDoc.createElement("dc:type"); + descDC.appendChild(type); + QDomElement bag7 = xmpDoc.createElement("rdf:Bag"); + type.appendChild(bag7); + QDomElement li7 = xmpDoc.createElement("rdf:li"); + bag7.appendChild(li7); + li7.appendChild(xmpDoc.createTextNode(doc.documentInfo().type())); + } + + if (!doc.documentInfo().rights().isEmpty()) + { + QDomElement rights = xmpDoc.createElement("dc:rights"); + descDC.appendChild(rights); + QDomElement alt8 = xmpDoc.createElement("rdf:Alt"); + rights.appendChild(alt8); + QDomElement li8 = xmpDoc.createElement("rdf:li"); + li8.setAttribute("xml:lang", xmlLang); + alt8.appendChild(li8); + li8.appendChild(xmpDoc.createTextNode(doc.documentInfo().rights())); + } + + if (!doc.documentInfo().date().isEmpty()) + { + QDomElement date = xmpDoc.createElement("dc:date"); + descDC.appendChild(date); + QDomElement seq9 = xmpDoc.createElement("rdf:Seq"); + date.appendChild(seq9); + QDomElement li9 = xmpDoc.createElement("rdf:li"); + seq9.appendChild(li9); + li9.appendChild(xmpDoc.createTextNode(doc.documentInfo().date())); + } + + if (!doc.documentInfo().ident().isEmpty()) + descDC.setAttributeNS(dcNS, "dc:identifier", doc.documentInfo().ident()); + + if (!doc.documentInfo().source().isEmpty()) + descDC.setAttributeNS(dcNS, "dc:source", doc.documentInfo().source()); + + if (!doc.documentInfo().relation().isEmpty()) + { + QDomElement relation = xmpDoc.createElement("dc:relation"); + descDC.appendChild(relation); + QDomElement bag10 = xmpDoc.createElement("rdf:Bag"); + relation.appendChild(bag10); + QDomElement li10 = xmpDoc.createElement("rdf:li"); + bag10.appendChild(li10); + li10.appendChild(xmpDoc.createTextNode(doc.documentInfo().relation())); + } if (PDF_IsPDFX()) { pdflib-hasxmp.patch (1,905 bytes)
diff -Nurpd a/scribus/pdflib_core.cpp b/scribus/pdflib_core.cpp --- a/scribus/pdflib_core.cpp 2023-12-31 16:58:30.000000000 +0100 +++ b/scribus/pdflib_core.cpp 2024-01-03 17:08:01.373569901 +0100 @@ -562,6 +562,14 @@ PDFLibCore::~PDFLibCore() delete progressDialog; } +bool PDFLibCore::PDF_HasXMP() const +{ + if (Options.Version == PDFVersion::PDF_16) + return true; + if (Options.Version == PDFVersion::PDF_X4) + return true; + return false; +} bool PDFLibCore::PDF_IsPDFX() const { @@ -969,7 +977,7 @@ void PDFLibCore::PDF_Begin_Catalog() writer.OutputIntentObj = writer.newObject(); PutDoc("/OutputIntents [ " + Pdf::toObjRef(writer.OutputIntentObj) + " ]\n"); } - if (Options.Version == PDFVersion::PDF_X4) + if (PDF_HasXMP()) { writer.MetaDataObj = writer.newObject(); PutDoc("/Metadata " + Pdf::toObjRef(writer.MetaDataObj) + "\n"); @@ -1020,8 +1028,7 @@ void PDFLibCore::PDF_Begin_Catalog() // Datum += tmp; // Datum += "Z"; - // only include XMP to PDF/X-4 at the moment, could easily be extended to include it to any PDF - if (Options.Version == PDFVersion::PDF_X4) + if (PDF_HasXMP()) generateXMP(dt.toString("yyyy-MM-ddThh:mm:ssZ")); /* The following code makes the resulting PDF "Reader enabled" in Acrobat Reader 8 @@ -11653,7 +11660,7 @@ bool PDFLibCore::PDF_End_OutputProfile(c void PDFLibCore::PDF_End_Metadata() { - if (Options.Version == PDFVersion::PDF_X4) + if (PDF_HasXMP()) { // if (Options.useLayers) // OCProperties dictionary was included as '9 0 obj', OutputIntents was included as '10 0 obj' // { diff -Nurpd a/scribus/pdflib_core.h b/scribus/pdflib_core.h --- a/scribus/pdflib_core.h 2023-12-31 16:58:33.000000000 +0100 +++ b/scribus/pdflib_core.h 2024-01-03 17:08:34.265660822 +0100 @@ -133,6 +133,7 @@ private: } }; + bool PDF_HasXMP() const; bool PDF_IsPDFX() const; bool PDF_IsPDFX(const PDFVersion& ver) const; |
|
On a sidenote: https://github.com/scribusproject/scribus/blob/Version16x/scribus/pdflib_core.cpp#L11782 any clue why that's happening? Presumably some RIP compat workaround? Also, given how the PDF versions are structured: https://github.com/scribusproject/scribus/blob/Version16x/scribus/pdfversion.h Which makes https://github.com/scribusproject/scribus/blob/Version16x/scribus/pdflib_core.cpp#L10623 a bit fragile, though technically correct. |
|
TODO: 1) dc-meta-2.patch has all possible values for Type, which could probably be trimmed, as some don't seem applicable 2) dc-meta-2.patch only has a few example languages, and I don't know how to elegantly add the full list, but if the full list was added, docinfo-combobox-3.patch should probably have the language combobox set to non editable. 3) contributor newlines should probably result in separate rdf:li entries? but I'm not sure how to achieve that... |
|
BTW, exiftool properly parses PDF's exported with pdflib-dc-meta-2.patch applied. I'd love some feedback on my work so far. |
|
This latest version of docinfo-combobox pulls data out of QLocale to fill the languages and coverage comboboxes. docinfo-combobox-4.patch (9,469 bytes)
diff -Nurpd a/scribus/ui/prefs_documentinformationbase.ui b/scribus/ui/prefs_documentinformationbase.ui --- a/scribus/ui/prefs_documentinformationbase.ui 2023-12-31 16:58:17.000000000 +0100 +++ b/scribus/ui/prefs_documentinformationbase.ui 2024-01-04 19:36:20.048738097 +0100 @@ -99,7 +99,11 @@ </widget> </item> <item row="3" column="1"> - <widget class="QTextEdit" name="keywordsTextEdit"/> + <widget class="QTextEdit" name="keywordsTextEdit"> + <property name="tabChangesFocus"> + <bool>true</bool> + </property> + </widget> </item> <item row="4" column="0"> <widget class="QLabel" name="label_6"> @@ -109,7 +113,11 @@ </widget> </item> <item row="4" column="1"> - <widget class="QTextEdit" name="descriptionTextEdit"/> + <widget class="QTextEdit" name="descriptionTextEdit"> + <property name="tabChangesFocus"> + <bool>true</bool> + </property> + </widget> </item> </layout> </widget> @@ -171,7 +179,11 @@ </widget> </item> <item row="1" column="1"> - <widget class="QTextEdit" name="contributorsTextEdit"/> + <widget class="QTextEdit" name="contributorsTextEdit"> + <property name="tabChangesFocus"> + <bool>true</bool> + </property> + </widget> </item> <item row="2" column="0"> <widget class="QLabel" name="label_9"> @@ -181,7 +193,11 @@ </widget> </item> <item row="2" column="1"> - <widget class="QLineEdit" name="dateLineEdit"/> + <widget class="QComboBox" name="dateLineEdit"> + <property name="editable"> + <bool>true</bool> + </property> + </widget> </item> <item row="3" column="0"> <widget class="QLabel" name="label_10"> @@ -191,7 +207,11 @@ </widget> </item> <item row="3" column="1"> - <widget class="QLineEdit" name="typeLineEdit"/> + <widget class="QComboBox" name="typeLineEdit"> + <property name="editable"> + <bool>true</bool> + </property> + </widget> </item> <item row="4" column="0"> <widget class="QLabel" name="label_11"> @@ -201,7 +221,11 @@ </widget> </item> <item row="4" column="1"> - <widget class="QLineEdit" name="formatLineEdit"/> + <widget class="QLineEdit" name="formatLineEdit"> + <property name="enabled"> + <bool>false</bool> + </property> + </widget> </item> <item row="5" column="0"> <widget class="QLabel" name="label_12"> @@ -231,7 +255,11 @@ </widget> </item> <item row="7" column="1"> - <widget class="QLineEdit" name="languageLineEdit"/> + <widget class="QComboBox" name="languageLineEdit"> + <property name="editable"> + <bool>true</bool> + </property> + </widget> </item> <item row="8" column="0"> <widget class="QLabel" name="label_15"> @@ -251,7 +279,11 @@ </widget> </item> <item row="9" column="1"> - <widget class="QLineEdit" name="coverageLineEdit"/> + <widget class="QComboBox" name="coverageLineEdit"> + <property name="editable"> + <bool>true</bool> + </property> + </widget> </item> <item row="10" column="0"> <widget class="QLabel" name="label_17"> @@ -261,7 +293,11 @@ </widget> </item> <item row="10" column="1"> - <widget class="QLineEdit" name="rightsLineEdit"/> + <widget class="QComboBox" name="rightsLineEdit"> + <property name="editable"> + <bool>true</bool> + </property> + </widget> </item> </layout> </item> diff -Nurpd a/scribus/ui/prefs_documentinformation.cpp b/scribus/ui/prefs_documentinformation.cpp --- a/scribus/ui/prefs_documentinformation.cpp 2023-12-31 16:58:17.000000000 +0100 +++ b/scribus/ui/prefs_documentinformation.cpp 2024-01-04 19:38:43.289448893 +0100 @@ -5,6 +5,8 @@ a copyright and/or license notice that p for which a new license (GPL+exception) is in place. */ +#include <QDateTime> +#include <QLocale> #include "prefs_documentinformation.h" #include "prefsstructs.h" #include "scribusdoc.h" @@ -20,6 +22,49 @@ Prefs_DocumentInformation::Prefs_Documen m_caption = tr("Document Information"); m_icon = "documentinfo.png"; + + dateLineEdit->addItem(QDateTime::currentDateTime().toString("yyyy-MM-dd")); + + // DCT1 from https://www.dublincore.org/specifications/dublin-core/resource-typelist/ + typeLineEdit->addItem("Collection"); + typeLineEdit->addItem("Dataset"); + typeLineEdit->addItem("Event"); + typeLineEdit->addItem("Image"); + typeLineEdit->addItem("InteractiveResource"); + typeLineEdit->addItem("Model"); + typeLineEdit->addItem("Party"); + typeLineEdit->addItem("PhysicalObject"); + typeLineEdit->addItem("Place"); + typeLineEdit->addItem("Service"); + typeLineEdit->addItem("Software"); + typeLineEdit->addItem("Sound"); + typeLineEdit->addItem("Text"); + + QStringList languages; + for (const QLocale &locale : QLocale::matchingLocales(QLocale::AnyLanguage, QLocale::AnyScript, QLocale::AnyCountry)) + languages << locale.bcp47Name(); + languages.sort(); + languages.removeDuplicates(); + for (const auto& language : languages) + languageLineEdit->addItem(language);; + + QStringList countries; + for (const QLocale &locale : QLocale::matchingLocales(QLocale::AnyLanguage, QLocale::AnyScript, QLocale::AnyCountry)) + countries << QLocale::countryToString(locale.country()); + countries.sort(); + countries.removeDuplicates(); + coverageLineEdit->addItem("Worldwide"); + for (const auto& country : countries) + coverageLineEdit->addItem(country); + + rightsLineEdit->addItem("All Rights Reserved"); + rightsLineEdit->addItem("Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International"); + rightsLineEdit->addItem("Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International"); + rightsLineEdit->addItem("Creative Commons Attribution-NonCommercial 4.0 International"); + rightsLineEdit->addItem("Creative Commons Attribution-NoDerivatives 4.0 International"); + rightsLineEdit->addItem("Creative Commons Attribution-ShareAlike 4.0 International"); + rightsLineEdit->addItem("Creative Commons Attribution 4.0 International"); + rightsLineEdit->addItem("Creative Commons Zero 1.0 Universal Public Domain Dedication"); } void Prefs_DocumentInformation::languageChange() @@ -35,15 +80,15 @@ void Prefs_DocumentInformation::restoreD descriptionTextEdit->setText(prefsData->docInfo.comments()); publisherLineEdit->setText(prefsData->docInfo.publisher()); contributorsTextEdit->setText(prefsData->docInfo.contrib()); - dateLineEdit->setText(prefsData->docInfo.date()); - typeLineEdit->setText(prefsData->docInfo.type()); - formatLineEdit->setText(prefsData->docInfo.format()); + dateLineEdit->setEditText(prefsData->docInfo.date()); + typeLineEdit->setEditText(prefsData->docInfo.type()); + formatLineEdit->setText("application/pdf"); identifierLineEdit->setText(prefsData->docInfo.ident()); sourceLineEdit->setText(prefsData->docInfo.source()); - languageLineEdit->setText(prefsData->docInfo.langInfo()); + languageLineEdit->setEditText(prefsData->docInfo.langInfo()); relationLineEdit->setText(prefsData->docInfo.relation()); - coverageLineEdit->setText(prefsData->docInfo.cover()); - rightsLineEdit->setText(prefsData->docInfo.rights()); + coverageLineEdit->setEditText(prefsData->docInfo.cover()); + rightsLineEdit->setEditText(prefsData->docInfo.rights()); } void Prefs_DocumentInformation::saveGuiToPrefs(struct ApplicationPrefs *prefsData) const @@ -55,14 +100,14 @@ void Prefs_DocumentInformation::saveGuiT prefsData->docInfo.setComments(descriptionTextEdit->toPlainText()); prefsData->docInfo.setPublisher(publisherLineEdit->text()); prefsData->docInfo.setContrib(contributorsTextEdit->toPlainText()); - prefsData->docInfo.setDate(dateLineEdit->text()); - prefsData->docInfo.setType(typeLineEdit->text()); + prefsData->docInfo.setDate(dateLineEdit->currentText()); + prefsData->docInfo.setType(typeLineEdit->currentText()); prefsData->docInfo.setFormat(formatLineEdit->text()); prefsData->docInfo.setIdent(identifierLineEdit->text()); prefsData->docInfo.setSource(sourceLineEdit->text()); - prefsData->docInfo.setLangInfo(languageLineEdit->text()); + prefsData->docInfo.setLangInfo(languageLineEdit->currentText()); prefsData->docInfo.setRelation(relationLineEdit->text()); - prefsData->docInfo.setCover(coverageLineEdit->text()); - prefsData->docInfo.setRights(rightsLineEdit->text()); + prefsData->docInfo.setCover(coverageLineEdit->currentText()); + prefsData->docInfo.setRights(rightsLineEdit->currentText()); } |
|
This latest version of pdflib-dc-meta splits the contributors into seperate rdf:li entries. I've also tried to add some metadata like <xmpRights:Marked> and <cc:license rdf:resource=""/>, but I'm not getting that right... pdflib-dc-meta-3.patch (8,098 bytes)
diff -Nurpd a/scribus/pdflib_core.cpp b/scribus/pdflib_core.cpp --- a/scribus/pdflib_core.cpp 2023-12-31 16:58:30.000000000 +0100 +++ b/scribus/pdflib_core.cpp 2024-01-04 19:17:52.534340633 +0100 @@ -51,6 +51,7 @@ for which a new license (GPL+exception) #include <QPainterPath> #include <QRect> #include <QRegExp> +#include <QRegularExpression> #include <QScopedPointer> #include <QStack> #include <QString> @@ -11721,34 +11722,164 @@ void PDFLibCore::generateXMP(const QStri QDomElement descDC = desc.cloneNode().toElement(); rdf.appendChild(descDC); QString dcNS = "http://purl.org/dc/elements/1.1/"; + descDC.setAttributeNS(dcNS, "dc:format", "application/pdf"); + + if (!doc.documentInfo().cover().isEmpty()) + descDC.setAttributeNS(dcNS, "dc:coverage", doc.documentInfo().cover()); + + if (!doc.documentInfo().langInfo().isEmpty()) + { + QDomElement language = xmpDoc.createElement("dc:language"); + descDC.appendChild(language); + QDomElement bag1 = xmpDoc.createElement("rdf:Bag"); + language.appendChild(bag1); + QDomElement li1 = xmpDoc.createElement("rdf:li"); + bag1.appendChild(li1); + li1.appendChild(xmpDoc.createTextNode(doc.documentInfo().langInfo())); + } + QDomElement title = xmpDoc.createElement("dc:title"); descDC.appendChild(title); - QDomElement alt1 = xmpDoc.createElement("rdf:Alt"); - title.appendChild(alt1); - QDomElement li1 = xmpDoc.createElement("rdf:li"); - li1.setAttribute("xml:lang", "x-default"); - alt1.appendChild(li1); + QDomElement alt2 = xmpDoc.createElement("rdf:Alt"); + title.appendChild(alt2); + QDomElement li2 = xmpDoc.createElement("rdf:li"); + li2.setAttribute("xml:lang", "x-default"); + alt2.appendChild(li2); QString docTitle = doc.documentInfo().title(); if ((PDF_IsPDFX()) && (docTitle.isEmpty())) docTitle = doc.documentFileName(); - li1.appendChild(xmpDoc.createTextNode(docTitle)); + li2.appendChild(xmpDoc.createTextNode(docTitle)); + + if (!doc.documentInfo().publisher().isEmpty()) + { + QDomElement publisher = xmpDoc.createElement("dc:publisher"); + descDC.appendChild(publisher); + QDomElement bag3 = xmpDoc.createElement("rdf:Bag"); + publisher.appendChild(bag3); + QDomElement li3 = xmpDoc.createElement("rdf:li"); + bag3.appendChild(li3); + li3.appendChild(xmpDoc.createTextNode(doc.documentInfo().publisher())); + } + QDomElement creator = xmpDoc.createElement("dc:creator"); descDC.appendChild(creator); - QDomElement seq = xmpDoc.createElement("rdf:Seq"); - creator.appendChild(seq); - QDomElement li2 = xmpDoc.createElement("rdf:li"); - seq.appendChild(li2); - li2.appendChild(xmpDoc.createTextNode(doc.documentInfo().author())); + QDomElement seq4 = xmpDoc.createElement("rdf:Seq"); + creator.appendChild(seq4); + QDomElement li4 = xmpDoc.createElement("rdf:li"); + seq4.appendChild(li4); + li4.appendChild(xmpDoc.createTextNode(doc.documentInfo().author())); + + if (!doc.documentInfo().contrib().isEmpty()) + { + QDomElement contributor = xmpDoc.createElement("dc:contributor"); + descDC.appendChild(contributor); + QDomElement bag5 = xmpDoc.createElement("rdf:Bag"); + contributor.appendChild(bag5); + + for (const QString &contrib : doc.documentInfo().contrib().split(QRegularExpression(" *[;\n] *"), Qt::SkipEmptyParts)) + { + QDomElement li5 = xmpDoc.createElement("rdf:li"); + bag5.appendChild(li5); + li5.appendChild(xmpDoc.createTextNode(contrib)); + } + } + // Subject's entry in Document Info dictionary is actually dc:description in XMP, not dc:subject. QDomElement description = xmpDoc.createElement("dc:description"); descDC.appendChild(description); - QDomElement alt2 = xmpDoc.createElement("rdf:Alt"); - description.appendChild(alt2); - QDomElement li3 = xmpDoc.createElement("rdf:li"); - li3.setAttribute("xml:lang", "x-default"); - alt2.appendChild(li3); - li3.appendChild(xmpDoc.createTextNode(doc.documentInfo().subject())); + QDomElement alt6 = xmpDoc.createElement("rdf:Alt"); + description.appendChild(alt6); + QDomElement li6 = xmpDoc.createElement("rdf:li"); + li6.setAttribute("xml:lang", "x-default"); + alt6.appendChild(li6); + li6.appendChild(xmpDoc.createTextNode(doc.documentInfo().subject())); + + if (!doc.documentInfo().type().isEmpty()) + { + QDomElement type = xmpDoc.createElement("dc:type"); + descDC.appendChild(type); + QDomElement bag7 = xmpDoc.createElement("rdf:Bag"); + type.appendChild(bag7); + QDomElement li7 = xmpDoc.createElement("rdf:li"); + bag7.appendChild(li7); + li7.appendChild(xmpDoc.createTextNode(doc.documentInfo().type())); + } + + if (!doc.documentInfo().rights().isEmpty()) + { + QDomElement rights = xmpDoc.createElement("dc:rights"); + descDC.appendChild(rights); + QDomElement alt8 = xmpDoc.createElement("rdf:Alt"); + rights.appendChild(alt8); + QDomElement li8 = xmpDoc.createElement("rdf:li"); + li8.setAttribute("xml:lang", "x-default"); + alt8.appendChild(li8); + li8.appendChild(xmpDoc.createTextNode(doc.documentInfo().rights())); + + QString xmpRightsMarked = "True"; + if (doc.documentInfo().rights() == "Creative Commons Zero 1.0 Universal Public Domain Dedication") + xmpRightsMarked = "False"; + QString xmpRightsNS = "http://ns.adobe.com/xap/1.0/rights/"; + QDomElement descXMPrights = xmpDoc.createElementNS(xmpRightsNS, "rdf:RDF"); + rdf.appendChild(descXMPrights); + QDomElement marked = xmpDoc.createElement("xmpRights:Marked"); + descXMPrights.appendChild(marked); + marked.appendChild(xmpDoc.createTextNode("True")); + + QString ccLicenseURL = ""; + if (doc.documentInfo().rights() == "Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International") + ccLicenseURL = "http://creativecommons.org/licenses/by-nc-nd/4.0/"; + if (doc.documentInfo().rights() == "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International") + ccLicenseURL = "https://creativecommons.org/licenses/by-nc-sa/4.0/"; + if (doc.documentInfo().rights() == "Creative Commons Attribution-NonCommercial 4.0 International") + ccLicenseURL = "https://creativecommons.org/licenses/by-nc/4.0/"; + if (doc.documentInfo().rights() == "Creative Commons Attribution-NoDerivatives 4.0 International") + ccLicenseURL = "https://creativecommons.org/licenses/by-nd/4.0/"; + if (doc.documentInfo().rights() == "Creative Commons Attribution-ShareAlike 4.0 International") + ccLicenseURL = "https://creativecommons.org/licenses/by-sa/4.0/"; + if (doc.documentInfo().rights() == "Creative Commons Attribution 4.0 International") + ccLicenseURL = "https://creativecommons.org/licenses/by/4.0/"; + if (doc.documentInfo().rights() == "Creative Commons Zero 1.0 Universal Public Domain Dedication") + ccLicenseURL = "https://creativecommons.org/publicdomain/zero/1.0/"; + if (!ccLicenseURL.isEmpty()) + { + QString ccNS = "http://creativecommons.org/ns#"; + QDomElement cc = xmpDoc.createElementNS(ccNS, "rdf:RDF"); + rdf.appendChild(cc); + QDomElement ccLicense = xmpDoc.createElement("cc:license"); + ccLicense.setAttribute("rdf:resource", ccLicenseURL); + cc.appendChild(ccLicense); + } + } + + if (!doc.documentInfo().date().isEmpty()) + { + QDomElement date = xmpDoc.createElement("dc:date"); + descDC.appendChild(date); + QDomElement seq9 = xmpDoc.createElement("rdf:Seq"); + date.appendChild(seq9); + QDomElement li9 = xmpDoc.createElement("rdf:li"); + seq9.appendChild(li9); + li9.appendChild(xmpDoc.createTextNode(doc.documentInfo().date())); + } + + if (!doc.documentInfo().ident().isEmpty()) + descDC.setAttributeNS(dcNS, "dc:identifier", doc.documentInfo().ident()); + + if (!doc.documentInfo().source().isEmpty()) + descDC.setAttributeNS(dcNS, "dc:source", doc.documentInfo().source()); + + if (!doc.documentInfo().relation().isEmpty()) + { + QDomElement relation = xmpDoc.createElement("dc:relation"); + descDC.appendChild(relation); + QDomElement bag10 = xmpDoc.createElement("rdf:Bag"); + relation.appendChild(bag10); + QDomElement li10 = xmpDoc.createElement("rdf:li"); + bag10.appendChild(li10); + li10.appendChild(xmpDoc.createTextNode(doc.documentInfo().relation())); + } if (PDF_IsPDFX()) { |
|
hi pmjdebruijn sorry, i can't give much feedback on your work: i don't really understand what you are trying to achieve and those fields are good for... just one small feedback for something i think i've understood (but i'm not 100% sure i'm right): you should probably not use the QLocale for guessing any value about that tell anything about the document: many people use one of the english locales just to have a sane environment (because they want their computer to speak english to them...) but are not living in an english speaking country (and by far not in the one they have selected). p.s.: and i might have written my note in very broken english : - ( but, as i said, i might misunderstood what you are trying to do. |
|
@pmjdebruijn, I like what you did here. I plan to commit your combobox patch this week-end with some minor modifications, for eg avoid duplicate calls to QLocale::matchingLocales. The XML patches look good too, I'll use this week-end to make some tests in the old Acrobat version I have. |
|
@ale, I wasn't, so we're good :) @jghali, I'm very happy to hear that :) Summarizing: pdflib-hasxmp (ready as-is) - Enables XMP for PDF 1.6 (PDF-X4 was already enabled) - refactors the conditionals into a dedicated function, replacing three if conditionals which needed to be kept in sync docinfo-combobox (mostly there) - QTextEdit tabChangesFocus is enabled to keep GUI control flow consistent (I didn't check other parts of Scribus whether there are other QTextEdit that also might need this). - Replaces some QLineExit's by QComboBox in the "Further Information" tab, the QComboBox are filled with example metadata values. - TODO: the Coverage/Language QComboBoxes seeded by QLocale, have some values that should probably BE filtered, like "default" and "world". pdflib-dc-meta (mostly there) - Actually adds DublinCore metadata to PDFs, specified on the "Further Information" tab. - TODO: The 'xmpRights:Marked' and 'cc:license' parts aren't quite right, so if you can figure them out, I suggest to drop the QString xmpRightsMarked = "True"; ... cc.appendChild(ccLicense); } part of the patch for now, it can always be added back later. |
|
I've committed the comboboxes patches with following modifications: - keep format edit box for now - avoid duplicate calls to QLocale::matchingLocales The hasxmp patch has also been committed. I will look at the dc metadata patch tomorrow, I have it already applied here. |
|
I did a few fixes to the dc metadata patch, there was some wrong tag being used (rdf:RDF elements cannot be childs of another rdf:RDF element). But the dc metadata patch has now also been committed. |
|
Seems to work, Atril (given it's an Evince fork, Evince will likely too) shows the properties now as well: |
Date Modified | Username | Field | Change |
---|---|---|---|
2024-01-01 12:32 | pmjdebruijn | New Issue | |
2024-01-01 12:33 | pmjdebruijn | Note Added: 0050736 | |
2024-01-01 12:33 | pmjdebruijn | File Added: docinfo-combobox.patch | |
2024-01-01 16:16 | pmjdebruijn | Note Added: 0050741 | |
2024-01-02 17:32 | pmjdebruijn | Note Added: 0050755 | |
2024-01-02 17:35 | pmjdebruijn | Note Added: 0050756 | |
2024-01-02 17:35 | pmjdebruijn | File Added: docinfo-combobox-2.patch | |
2024-01-02 19:09 | pmjdebruijn | Note Added: 0050757 | |
2024-01-02 19:09 | pmjdebruijn | File Added: docinfo-combobox-3.patch | |
2024-01-02 19:12 | pmjdebruijn | Note Added: 0050758 | |
2024-01-02 19:12 | pmjdebruijn | File Added: pdflib-dc-meta.patch | |
2024-01-02 19:16 | pmjdebruijn | Note Added: 0050760 | |
2024-01-02 19:16 | pmjdebruijn | File Added: scribus_docinfo_patch.png | |
2024-01-03 16:32 | pmjdebruijn | Note Added: 0050782 | |
2024-01-03 16:32 | pmjdebruijn | File Added: pdflib-dc-meta-2.patch | |
2024-01-03 16:32 | pmjdebruijn | File Added: pdflib-hasxmp.patch | |
2024-01-03 16:37 | pmjdebruijn | Note Added: 0050783 | |
2024-01-03 17:05 | pmjdebruijn | Note Added: 0050784 | |
2024-01-03 17:42 | pmjdebruijn | Note Added: 0050785 | |
2024-01-04 18:50 | pmjdebruijn | Note Added: 0050798 | |
2024-01-04 18:50 | pmjdebruijn | File Added: docinfo-combobox-4.patch | |
2024-01-04 18:52 | pmjdebruijn | Note Added: 0050799 | |
2024-01-04 18:52 | pmjdebruijn | File Added: pdflib-dc-meta-3.patch | |
2024-01-04 20:34 | ale | Note Added: 0050800 | |
2024-01-04 22:25 | jghali | Note Added: 0050806 | |
2024-01-05 09:58 | pmjdebruijn | Note Added: 0050810 | |
2024-01-05 10:24 | ale | Note Edited: 0050800 | |
2024-01-05 23:32 | jghali | Note Added: 0050839 | |
2024-01-06 22:23 | jghali | Note Added: 0050841 | |
2024-01-06 22:23 | jghali | Assigned To | => jghali |
2024-01-06 22:23 | jghali | Status | new => resolved |
2024-01-06 22:23 | jghali | Resolution | open => fixed |
2024-01-06 22:23 | jghali | Fixed in Version | => 1.6.1.svn |
2024-01-07 09:58 | pmjdebruijn | Note Added: 0050842 | |
2024-01-07 09:58 | pmjdebruijn | File Added: atril-properties-document-license.png | |
2024-01-07 16:24 | cbradney | Status | resolved => closed |