r19739 by jghali - #8959: PDFfile->save() doesn't use the checkbox value of Use Document Bleeds (partial backport)
scribus-commit
scribus-commit at lists.scribus.net
Tue Jan 6 22:39:28 UTC 2015
Author: jghali
Date: Tue Jan 6 22:39:27 2015
New Revision: 19739
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=19739
Log:
#8959: PDFfile->save() doesn't use the checkbox value of Use Document Bleeds (partial backport)
Backport allows to use doc bleeds but the option is disabled by default so as to keep existing script working as previously in most cases.
Modified:
branches/Version14x/Scribus/scribus/doc/de/scripterapi-PDFfile.html
branches/Version14x/Scribus/scribus/doc/en/scripterapi-PDFfile.html
branches/Version14x/Scribus/scribus/doc/fr/scripterapi-PDFfile.html
branches/Version14x/Scribus/scribus/doc/it/scripterapi-PDFfile.html
branches/Version14x/Scribus/scribus/plugins/scriptplugin/objpdffile.cpp
Modified: branches/Version14x/Scribus/scribus/doc/de/scripterapi-PDFfile.html
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19739&path=/branches/Version14x/Scribus/scribus/doc/de/scripterapi-PDFfile.html
==============================================================================
--- branches/Version14x/Scribus/scribus/doc/de/scripterapi-PDFfile.html (original)
+++ branches/Version14x/Scribus/scribus/doc/de/scripterapi-PDFfile.html Tue Jan 6 22:39:27 2015
@@ -192,6 +192,9 @@
<dt><strong>thumbnails</strong> = <member 'thumbnails' of 'PDFfile' objects></dt>
<dd><code>Generate thumbnails. Bool value.</code></dd>
+<dt><strong>usedocbleeds</strong> = <attribute 'usedocbleeds' of 'PDFfile' objects></dt>
+<dd><code>Use the existing bleed settings from the document preferences. Bool value.</code></dd>
+
<dt><strong>uselpi</strong> = <member 'uselpi' of 'PDFfile' objects></dt>
<dd><code>Use Custom Rendering Settings. Bool value</code></dd>
Modified: branches/Version14x/Scribus/scribus/doc/en/scripterapi-PDFfile.html
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19739&path=/branches/Version14x/Scribus/scribus/doc/en/scripterapi-PDFfile.html
==============================================================================
--- branches/Version14x/Scribus/scribus/doc/en/scripterapi-PDFfile.html (original)
+++ branches/Version14x/Scribus/scribus/doc/en/scripterapi-PDFfile.html Tue Jan 6 22:39:27 2015
@@ -192,6 +192,9 @@
<dt><strong>thumbnails</strong> = <member 'thumbnails' of 'PDFfile' objects></dt>
<dd><code>Generate thumbnails. Bool value.</code></dd>
+<dt><strong>usedocbleeds</strong> = <attribute 'usedocbleeds' of 'PDFfile' objects></dt>
+<dd><code>Use the existing bleed settings from the document preferences. Bool value.</code></dd>
+
<dt><strong>uselpi</strong> = <member 'uselpi' of 'PDFfile' objects></dt>
<dd><code>Use Custom Rendering Settings. Bool value</code></dd>
Modified: branches/Version14x/Scribus/scribus/doc/fr/scripterapi-PDFfile.html
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19739&path=/branches/Version14x/Scribus/scribus/doc/fr/scripterapi-PDFfile.html
==============================================================================
--- branches/Version14x/Scribus/scribus/doc/fr/scripterapi-PDFfile.html (original)
+++ branches/Version14x/Scribus/scribus/doc/fr/scripterapi-PDFfile.html Tue Jan 6 22:39:27 2015
@@ -194,6 +194,9 @@
<dt><strong>thumbnails</strong> = <membre 'thumbnails' des objets 'PDFfile'></dt>
<dd><code>Génère les vignettes. Valeur booléenne.</code></dd>
+<dt><strong>usedocbleeds</strong> = <attribut 'usedocbleeds' de la classe 'PDFfile'></dt>
+<dd><code>Utilise les valeurs de fonds perdus configurées dans les préférences du document. Valeur booléenne.</code></dd>
+
<dt><strong>uselpi</strong> = <membre 'uselpi' des objets 'PDFfile'></dt>
<dd><code>Utilisation des paramètres personnalisés de rendu. Valeur booléenne</code></dd>
Modified: branches/Version14x/Scribus/scribus/doc/it/scripterapi-PDFfile.html
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19739&path=/branches/Version14x/Scribus/scribus/doc/it/scripterapi-PDFfile.html
==============================================================================
--- branches/Version14x/Scribus/scribus/doc/it/scripterapi-PDFfile.html (original)
+++ branches/Version14x/Scribus/scribus/doc/it/scripterapi-PDFfile.html Tue Jan 6 22:39:27 2015
@@ -192,6 +192,9 @@
<dt><strong>thumbnails</strong> = <member 'thumbnails' of 'PDFfile' objects></dt>
<dd><code>Generate thumbnails. Bool value.</code></dd>
+<dt><strong>usedocbleeds</strong> = <attribute 'usedocbleeds' of 'PDFfile' objects></dt>
+<dd><code>Use the existing bleed settings from the document preferences. Bool value.</code></dd>
+
<dt><strong>uselpi</strong> = <member 'uselpi' of 'PDFfile' objects></dt>
<dd><code>Use Custom Rendering Settings. Bool value</code></dd>
Modified: branches/Version14x/Scribus/scribus/plugins/scriptplugin/objpdffile.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19739&path=/branches/Version14x/Scribus/scribus/plugins/scriptplugin/objpdffile.cpp
==============================================================================
--- branches/Version14x/Scribus/scribus/plugins/scriptplugin/objpdffile.cpp (original)
+++ branches/Version14x/Scribus/scribus/plugins/scriptplugin/objpdffile.cpp Tue Jan 6 22:39:27 2015
@@ -86,6 +86,7 @@
double bleedl; // double - 0 to width of page
double bleedr; // double - 0 to width of page
double bleedb; // double - 0 to hight of page
+ int usedocbleeds; // bool
} PDFfile;
@@ -238,6 +239,7 @@
self->bleedl = 0; // double -
self->bleedr = 0; // double -
self->bleedb = 0; // double -
+ self->usedocbleeds = 0; // bool
}
return (PyObject *) self;
}
@@ -511,6 +513,7 @@
self->bleedl = pdfOptions.bleeds.Left * currentDoc->unitRatio(); // double -
self->bleedr = pdfOptions.bleeds.Right * currentDoc->unitRatio(); // double -
self->bleedb = pdfOptions.bleeds.Bottom * currentDoc->unitRatio(); // double -
+ self->usedocbleeds = 0; // bool
return 0;
}
@@ -543,6 +546,7 @@
{const_cast<char*>("bleedl"), T_DOUBLE, offsetof(PDFfile, bleedl), 0, const_cast<char*>("Bleed Left\n""Distance for bleed from the left of the physical page")},
{const_cast<char*>("bleedr"), T_DOUBLE, offsetof(PDFfile, bleedr), 0, const_cast<char*>("Bleed Right\n""Distance for bleed from the right of the physical page")},
{const_cast<char*>("bleedb"), T_DOUBLE, offsetof(PDFfile, bleedb), 0, const_cast<char*>("Bleed Bottom\n""Distance for bleed from the bottom of the physical page")},
+ {const_cast<char*>("usedocbleeds"), T_INT, offsetof(PDFfile, usedocbleeds), 0, const_cast<char*>("Use the existing bleed settings from the document preferences. Bool value")},
{NULL, 0, 0, 0, NULL} // sentinel
};
@@ -1125,14 +1129,6 @@
if (hIn.colorSpace() == ColorSpace_Gray)
Components = 3;
pdfOptions.Info = PyString_AsString(self->info);
- self->bleedt = minmaxd(self->bleedt, 0, currentDoc->pageHeight * currentDoc->unitRatio());
- pdfOptions.bleeds.Top = self->bleedt / currentDoc->unitRatio();
- self->bleedl = minmaxd(self->bleedl, 0, currentDoc->pageWidth * currentDoc->unitRatio());
- pdfOptions.bleeds.Left = self->bleedl / currentDoc->unitRatio();
- self->bleedr = minmaxd(self->bleedr, 0, currentDoc->pageWidth * currentDoc->unitRatio());
- pdfOptions.bleeds.Right = self->bleedr / currentDoc->unitRatio();
- self->bleedb = minmaxd(self->bleedb, 0, currentDoc->pageHeight * currentDoc->unitRatio());
- pdfOptions.bleeds.Bottom = self->bleedb / currentDoc->unitRatio();
pdfOptions.Encrypt = false;
pdfOptions.PresentMode = false;
}
@@ -1153,17 +1149,38 @@
thumbs.insert(pageNs[ap], pm);
}
ReOrderText(currentDoc, ScCore->primaryMainWindow()->view);
+
+ MarginStruct optBleeds(pdfOptions.bleeds);
+ pdfOptions.useDocBleeds = self->usedocbleeds;
+ if (self->usedocbleeds)
+ pdfOptions.bleeds = currentDoc->bleeds;
+ else {
+ self->bleedt = minmaxd(self->bleedt, 0, currentDoc->pageHeight * currentDoc->unitRatio());
+ pdfOptions.bleeds.Top = self->bleedt / currentDoc->unitRatio();
+ self->bleedl = minmaxd(self->bleedl, 0, currentDoc->pageWidth * currentDoc->unitRatio());
+ pdfOptions.bleeds.Left = self->bleedl / currentDoc->unitRatio();
+ self->bleedr = minmaxd(self->bleedr, 0, currentDoc->pageWidth * currentDoc->unitRatio());
+ pdfOptions.bleeds.Right = self->bleedr / currentDoc->unitRatio();
+ self->bleedb = minmaxd(self->bleedb, 0, currentDoc->pageHeight * currentDoc->unitRatio());
+ pdfOptions.bleeds.Bottom = self->bleedb / currentDoc->unitRatio();
+ }
+
QString errorMessage;
- if (!ScCore->primaryMainWindow()->getPDFDriver(fn, nam, Components, pageNs, thumbs, errorMessage)) {
+ bool success = ScCore->primaryMainWindow()->getPDFDriver(fn, nam, Components, pageNs, thumbs, errorMessage);
+ if (!success) {
fn = "Cannot write the File: " + fn;
if (!errorMessage.isEmpty())
fn += QString("\n%1").arg(errorMessage);
PyErr_SetString(PyExc_SystemError, fn.toAscii());
- return NULL;
- }
-// Py_INCREF(Py_None);
-// return Py_None;
- Py_RETURN_NONE;
+ }
+
+ if (self->usedocbleeds || (pdfOptions.Version != PDFOptions::PDFVersion_X1a &&
+ pdfOptions.Version != PDFOptions::PDFVersion_X3))
+ pdfOptions.bleeds = optBleeds;
+
+ if (success)
+ Py_RETURN_NONE;
+ return NULL;
}
static PyMethodDef PDFfile_methods[] = {
More information about the scribus-commit
mailing list