r19693 by jghali - #8959: PDFfile->save() doesn't use the checkbox value of Use Document Bleeds
scribus-commit
scribus-commit at lists.scribus.net
Sat Dec 27 21:07:33 UTC 2014
Author: jghali
Date: Sat Dec 27 21:07:33 2014
New Revision: 19693
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=19693
Log:
#8959: PDFfile->save() doesn't use the checkbox value of Use Document Bleeds
Modified:
trunk/Scribus/scribus/plugins/scriptplugin/objpdffile.cpp
Modified: trunk/Scribus/scribus/plugins/scriptplugin/objpdffile.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19693&path=/trunk/Scribus/scribus/plugins/scriptplugin/objpdffile.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/objpdffile.cpp (original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/objpdffile.cpp Sat Dec 27 21:07:33 2014
@@ -94,6 +94,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;
@@ -260,6 +261,7 @@
self->bleedl = 0; // double -
self->bleedr = 0; // double -
self->bleedb = 0; // double -
+ self->usedocbleeds = 1; // bool
}
return (PyObject *) self;
}
@@ -543,6 +545,7 @@
self->bleedl = ScCore->primaryMainWindow()->doc->pdfOptions().bleeds.Left*ScCore->primaryMainWindow()->doc->unitRatio(); // double -
self->bleedr = ScCore->primaryMainWindow()->doc->pdfOptions().bleeds.Right*ScCore->primaryMainWindow()->doc->unitRatio(); // double -
self->bleedb = ScCore->primaryMainWindow()->doc->pdfOptions().bleeds.Bottom*ScCore->primaryMainWindow()->doc->unitRatio(); // double -
+ self->usedocbleeds = ScCore->primaryMainWindow()->doc->pdfOptions().useDocBleeds; // bool
return 0;
}
@@ -582,6 +585,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
};
@@ -1174,14 +1178,6 @@
if (profile.colorSpace() == ColorSpace_Cmy)
Components = 3;
ScCore->primaryMainWindow()->doc->pdfOptions().Info = PyString_AsString(self->info);
- self->bleedt = minmaxd(self->bleedt, 0, ScCore->primaryMainWindow()->view->Doc->pageHeight()*ScCore->primaryMainWindow()->view->Doc->unitRatio());
- ScCore->primaryMainWindow()->doc->pdfOptions().bleeds.Top = self->bleedt/ScCore->primaryMainWindow()->view->Doc->unitRatio();
- self->bleedl = minmaxd(self->bleedl, 0, ScCore->primaryMainWindow()->view->Doc->pageWidth()*ScCore->primaryMainWindow()->view->Doc->unitRatio());
- ScCore->primaryMainWindow()->doc->pdfOptions().bleeds.Left = self->bleedl/ScCore->primaryMainWindow()->view->Doc->unitRatio();
- self->bleedr = minmaxd(self->bleedr, 0, ScCore->primaryMainWindow()->view->Doc->pageWidth()*ScCore->primaryMainWindow()->view->Doc->unitRatio());
- ScCore->primaryMainWindow()->doc->pdfOptions().bleeds.Right = self->bleedr/ScCore->primaryMainWindow()->view->Doc->unitRatio();
- self->bleedb = minmaxd(self->bleedb, 0, ScCore->primaryMainWindow()->view->Doc->pageHeight()*ScCore->primaryMainWindow()->view->Doc->unitRatio());
- ScCore->primaryMainWindow()->doc->pdfOptions().bleeds.Bottom = self->bleedb/ScCore->primaryMainWindow()->view->Doc->unitRatio();
ScCore->primaryMainWindow()->doc->pdfOptions().Encrypt = false;
ScCore->primaryMainWindow()->doc->pdfOptions().PresentMode = false;
}
@@ -1201,17 +1197,37 @@
thumbs.insert(pageNs[ap], pm);
}
ReOrderText(ScCore->primaryMainWindow()->doc, ScCore->primaryMainWindow()->view);
+
+ MarginStruct optBleeds(ScCore->primaryMainWindow()->doc->pdfOptions().bleeds);
+ ScCore->primaryMainWindow()->doc->pdfOptions().useDocBleeds = self->usedocbleeds;
+ if (self->usedocbleeds)
+ ScCore->primaryMainWindow()->doc->pdfOptions().bleeds = ScCore->primaryMainWindow()->doc->bleedsVal();
+ else {
+ self->bleedt = minmaxd(self->bleedt, 0, ScCore->primaryMainWindow()->view->Doc->pageHeight()*ScCore->primaryMainWindow()->view->Doc->unitRatio());
+ ScCore->primaryMainWindow()->doc->pdfOptions().bleeds.Top = self->bleedt/ScCore->primaryMainWindow()->view->Doc->unitRatio();
+ self->bleedl = minmaxd(self->bleedl, 0, ScCore->primaryMainWindow()->view->Doc->pageWidth()*ScCore->primaryMainWindow()->view->Doc->unitRatio());
+ ScCore->primaryMainWindow()->doc->pdfOptions().bleeds.Left = self->bleedl/ScCore->primaryMainWindow()->view->Doc->unitRatio();
+ self->bleedr = minmaxd(self->bleedr, 0, ScCore->primaryMainWindow()->view->Doc->pageWidth()*ScCore->primaryMainWindow()->view->Doc->unitRatio());
+ ScCore->primaryMainWindow()->doc->pdfOptions().bleeds.Right = self->bleedr/ScCore->primaryMainWindow()->view->Doc->unitRatio();
+ self->bleedb = minmaxd(self->bleedb, 0, ScCore->primaryMainWindow()->view->Doc->pageHeight()*ScCore->primaryMainWindow()->view->Doc->unitRatio());
+ ScCore->primaryMainWindow()->doc->pdfOptions().bleeds.Bottom = self->bleedb/ScCore->primaryMainWindow()->view->Doc->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.toLatin1());
- return NULL;
- }
-// Py_INCREF(Py_None);
-// return Py_None;
- Py_RETURN_NONE;
+ }
+
+ if (self->usedocbleeds)
+ ScCore->primaryMainWindow()->doc->pdfOptions().bleeds = optBleeds;
+
+ if (success)
+ Py_RETURN_NONE;
+ return NULL;
}
static PyMethodDef PDFfile_methods[] = {
More information about the scribus-commit
mailing list