View Issue Details

IDProjectCategoryView StatusLast Update
0012768ScribusPDFpublic2014-10-14 20:07
Reporterwilliam Assigned Tojghali  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
PlatformIntel 64 bitOSFedora LinuxOS Version20
Product Version1.5.0svn 
Fixed in Version1.5.0svn 
Summary0012768: Allow custom order of pages when exporting PDF from scripter
DescriptionThis patch from Juraj eliminates an extra sort.
When exporting PDF in GUI we can set page order to be exported in custom order (for example: 1,4,3,2). Allow this feature for the scripter too.
TagsNo tags attached.
Patch

Activities

jghali

2014-10-11 17:09

administrator   ~0033980

Last edited: 2014-10-11 17:10

Those two patches have not been tested. They affect embedded fonts, not page order. When correct patch will be provided, I will likely only apply it to 1.5.0svn as this patch imply a behavior change.

william

2014-10-12 21:07

updater  

0002-Allow-custom-order-of-pages-exporting-PDF-from-script-v144.patch (942 bytes)   
From 2a2f12606291e100619c913db8dd4e2773271f40 Mon Sep 17 00:00:00 2001
From: Juraj Fedel <wtxnh-scribus@yahoo.com.au>
Date: Sun Oct 12 09:59:00 2014 +0200
Subject: [PATCH 2/2] Allow custom order of pages exporting PDF from scripter

When exporting PDF in GUI we can set page order to be exported in custom
order (for example: 1,4,3,2). Allow this feature for scripter too.
---
 scribus/plugins/scriptplugin/objpdffile.cpp |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/scribus/plugins/scriptplugin/objpdffile.cpp b/scribus/plugins/scriptplugin/objpdffile.cpp
index 29d56eb..c3266de 100644
--- a/scribus/plugins/scriptplugin/objpdffile.cpp
+++ b/scribus/plugins/scriptplugin/objpdffile.cpp
@@ -634,7 +634,6 @@ static int PDFfile_setpages(PDFfile *self, PyObject *value, void * /*closure*/)
 	Py_DECREF(self->pages);
 	Py_INCREF(value);
 	self->pages = value;
-	PyList_Sort(self->pages);
 	return 0;
 }
 
-- 
1.7.2.3

william

2014-10-12 21:08

updater  

0002-Allow-custom-order-of-pages-exporting-PDF-from-script-v150.patch (942 bytes)   
From 2c694973cf0cf63f7ecd932335b513a4c486f41f Mon Sep 17 00:00:00 2001
From: Juraj Fedel <wtxnh-scribus@yahoo.com.au>
Date: Sun Oct 12 09:59:00 2014 +0200
Subject: [PATCH 2/2] Allow custom order of pages exporting PDF from scripter

When exporting PDF in GUI we can set page order to be exported in custom
order (for example: 1,4,3,2). Allow this feature for scripter too.
---
 scribus/plugins/scriptplugin/objpdffile.cpp |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/scribus/plugins/scriptplugin/objpdffile.cpp b/scribus/plugins/scriptplugin/objpdffile.cpp
index 4aea73d..5fe17e7 100644
--- a/scribus/plugins/scriptplugin/objpdffile.cpp
+++ b/scribus/plugins/scriptplugin/objpdffile.cpp
@@ -677,7 +677,6 @@ static int PDFfile_setpages(PDFfile *self, PyObject *value, void * /*closure*/)
 	Py_DECREF(self->pages);
 	Py_INCREF(value);
 	self->pages = value;
-	PyList_Sort(self->pages);
 	return 0;
 }
 
-- 
1.7.2.3

william

2014-10-12 21:08

updater  

pages_order.py (501 bytes)   
import scribus

scribus.newDocument(scribus.PAPER_A4,  (0,0,0,0),  scribus.PORTRAIT, 1, scribus.UNIT_POINTS,  scribus.PAGE_1, 1, 4)

for p in range(4):
    page = p+1
    scribus.gotoPage(page)
    txt=scribus.createText(250, 70, 120,  30)
    scribus.setText("Page %i" % page, txt)
    try:
        setFont("Arial Regular", txt)
    except:
        setFont("FreeSans Medium", txt)
    scribus.setFontSize(12, txt)

pdf = scribus.PDFfile()
pdf.pages=[1,4,3,2]
pdf.file = 'pages_order.pdf'
pdf.save()

pages_order.py (501 bytes)   

william

2014-10-12 21:15

updater   ~0033992

Last edited: 2014-10-12 21:33

Sorry about that.
I have removed the original patches and uploaded revised patches that really do preserve the page order.
The pages_order.py script tests the patches.
It builds a document with four pages and then writes them with
  pdf = scribus.PDFfile()
  pdf.pages=[1,4,3,2]
  pdf.file = 'pages_order.pdf'
  pdf.save()
Before the patches, the pages in the PDF are in the order 1,2,3,4.
After the patches, the pages in the PDF will be in the order 1,4,3,2.

jghali

2014-10-13 17:53

administrator   ~0034003

Thanks for the updated patch. As indicated previously, I applied the patch to 1.5.0svn only. As this patch brings a behavior change, I did not apply it to 1.4.x.

Issue History

Date Modified Username Field Change
2014-10-11 16:53 william New Issue
2014-10-11 16:53 william File Added: 0002-Allow-custom-order-of-pages-exporting-PDF-from-script-v144.patch
2014-10-11 16:53 william File Added: 0002-Allow-custom-order-of-pages-exporting-PDF-from-script-v150.patch
2014-10-11 17:09 jghali Note Added: 0033980
2014-10-11 17:10 jghali Note Edited: 0033980
2014-10-12 21:06 william File Deleted: 0002-Allow-custom-order-of-pages-exporting-PDF-from-script-v144.patch
2014-10-12 21:06 william File Deleted: 0002-Allow-custom-order-of-pages-exporting-PDF-from-script-v150.patch
2014-10-12 21:07 william File Added: 0002-Allow-custom-order-of-pages-exporting-PDF-from-script-v144.patch
2014-10-12 21:08 william File Added: 0002-Allow-custom-order-of-pages-exporting-PDF-from-script-v150.patch
2014-10-12 21:08 william File Added: pages_order.py
2014-10-12 21:15 william Note Added: 0033992
2014-10-12 21:33 william Note Edited: 0033992
2014-10-13 17:50 jghali Summary [patches for 1.4 and 1.5] Allow custom order of pages exporting PDF from scripter => Allow custom order of pages when exporting PDF from scripter
2014-10-13 17:53 jghali Note Added: 0034003
2014-10-13 17:53 jghali Status new => resolved
2014-10-13 17:53 jghali Fixed in Version => 1.5.0svn
2014-10-13 17:53 jghali Resolution open => fixed
2014-10-13 17:53 jghali Assigned To => jghali
2014-10-14 20:07 cbradney Status resolved => closed