View Issue Details

IDProjectCategoryView StatusLast Update
0013914ScribusCanvaspublic2016-04-09 21:48
Reporterorbisvicis Assigned Tojghali  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
PlatformLinuxOSFedora 23, x86_64OS Version4.4.6-300.fc23
Product Version1.4.6 
Fixed in Version1.5.2.svn 
Summary0013914: Dual-Page Layout: Full-Width items duplicated on export
DescriptionFor items that span a dual page layout, scribus references the same item in both pages (left + right) without any cropping. The item in each page has the same origin, but each page's crop box masks the extraneous parts so when viewed it looks as expected.

There are two problems regarding full-width items, ie X-Pos=0 and Width=PageWidth
1] If the item is in a right page, scribus considers it part of the left page (only in the outliner, without physically moving the item on the canvas)
2] These items are then considered to span pages, ie to be on both pages, so during PDF export the left page contains content from the left page as well as the right page (outside the crop box), and the right page contains content from the right pages as well as the left page (outside the crop box)
Steps To Reproduce1] Use the attached scribus document "TestDuplicateItem.sla". The top-right text of page 3 (Text4) on the canvas, is in page 2 on the outliner.
2] Export as PDF, or use the attached PDF "TestDuplicateItem.pdf".
3] Run the attached script "impose.py" with line 57 commented out, then run the attached script with line 63 commented out - or use the attached PDFs "out-left.pdf" and "out-right.pdf"
Additional InformationUsing 1.4.5 from fedora 23
TagsNo tags attached.
PatchNo

Relationships

related to 0010990 confirmed Object page reference incorrect at 0.000 on facing page 
related to 0002683 acknowledged Margins need to be skipped for objects spanning facing pages 

Activities

orbisvicis

2016-04-05 15:28

reporter  

TestDuplicateItem.sla (17,967 bytes)

orbisvicis

2016-04-05 15:28

reporter  

TestDuplicateItem.pdf (28,130 bytes)

orbisvicis

2016-04-05 15:28

reporter  

impose.py (2,145 bytes)   
#!/usr/bin/env python3

# Copyright:
#   Yclept Nemo 
#       2016
#       pscjtwjdjtAhnbjm/dpn
# License:
#   GPLv3

import itertools
import argparse
import PyPDF2


def grouper(iterable, n, fillvalue=None):
    "Collect data into fixed-length chunks or blocks"
    # grouper('ABCDEFG', 3, 'x') --> ABC DEF Gxx"
    args = [iter(iterable)] * n
    return itertools.zip_longest(*args, fillvalue=fillvalue)

def pdf_page_size(page):
    return  ( page.mediaBox.lowerRight[0] - page.mediaBox.lowerLeft[0]
            , page.mediaBox.upperRight[1] - page.mediaBox.lowerRight[1]
            )

parser = argparse.ArgumentParser(description='Impose PDF files')
parser.add_argument("source", help="PDF, source path", type=argparse.FileType("rb"))
parser.add_argument("output", help="PDF, output path", type=argparse.FileType("wb"))
parser.add_argument("-s", "--spacer", help="PDF, spacer path", type=argparse.FileType("rb"))

args = parser.parse_args()

source = PyPDF2.PdfFileReader(args.source)
output = PyPDF2.PdfFileWriter()

spacer_page = None
spacer_size = [0,0]

if args.spacer is not None:
    spacer = PyPDF2.PdfFileReader(args.spacer)
    if spacer.getNumPages():
        spacer_page = spacer.getPage(0)
        spacer_size = pdf_page_size(spacer_page)

if source.getNumPages():
    output.addPage(source.getPage(0))

for i in grouper(range(1, source.getNumPages()), 2):
    pages = [None if j is None else source.getPage(j) for j in i]
    sizes = [(0,0) if j is None else pdf_page_size(j) for j in pages]
    out_size = [ sum(j[0] for j in sizes)
               , max(j[1] for j in sizes)
               ]
    if pages[1] is not None and spacer_page is not None:
        out_size[0] += spacer_size[0]
    out_page = output.addBlankPage(*out_size)
    out_page.mergePage(pages[0])
    if pages[1] is not None:
        offset = sizes[0][0]
        if spacer_page is not None:
            out_page.mergeTranslatedPage(spacer_page, offset, 0, True)
            offset += spacer_size[0]
        out_page.mergeTranslatedPage(pages[1], offset, 0, True)

output.addMetadata(source.getDocumentInfo())

output.write(args.output)

args.output.close()
impose.py (2,145 bytes)   

orbisvicis

2016-04-05 15:28

reporter  

out-left.pdf (96,525 bytes)

orbisvicis

2016-04-05 15:29

reporter  

out-right.pdf (96,561 bytes)

Kunda

2016-04-05 19:17

updater   ~0039825

Does this have anything to do with 0010442 ?

jghali

2016-04-05 19:54

administrator   ~0039829

No idea, but 0010990 for sure

orbisvicis

2016-04-08 20:46

reporter   ~0039924

The 1st note [1] is bug 0010990

The 2nd note [2] is new. The 2nd note only applies to page-spanning (pdf internals) during pdf export. Normally it is hidden by the crop-box, but causes problems during imposition.

They are probably both related.

Kunda

2016-04-09 16:21

updater   ~0039965

orbisvicis, could you please test 0010990 with 1.5.2svn with anything after r21175 ? (jghali just applied a fix)

jghali

2016-04-09 16:44

administrator   ~0039970

r21175 is enough to fix the item duplication when exporting PDF. I will not backport the fix to 1.4.x for now as it is on the risky side. Resolving this issue as the rest is covered by 0010990.

orbisvicis

2016-04-09 21:48

reporter   ~0039995

I can confirm that r21175 fixes [2] (item duplication) and [1] (page position/0010990), when page interior bleed is 0.

Issue History

Date Modified Username Field Change
2016-04-05 15:28 orbisvicis New Issue
2016-04-05 15:28 orbisvicis File Added: TestDuplicateItem.sla
2016-04-05 15:28 orbisvicis File Added: TestDuplicateItem.pdf
2016-04-05 15:28 orbisvicis File Added: impose.py
2016-04-05 15:28 orbisvicis File Added: out-left.pdf
2016-04-05 15:29 orbisvicis File Added: out-right.pdf
2016-04-05 19:17 Kunda Note Added: 0039825
2016-04-05 19:54 jghali Note Added: 0039829
2016-04-05 22:17 Kunda Relationship added related to 0010990
2016-04-05 22:27 Kunda Relationship added related to 0002683
2016-04-08 20:46 orbisvicis Note Added: 0039924
2016-04-09 16:21 Kunda Note Added: 0039965
2016-04-09 16:40 jghali Summary Dual-Page Layout: Full-Width items 1] on wrong page 2] duplicated => Dual-Page Layout: Full-Width items duplicated on export
2016-04-09 16:44 jghali Note Added: 0039970
2016-04-09 16:44 jghali Status new => resolved
2016-04-09 16:44 jghali Fixed in Version => 1.5.2.svn
2016-04-09 16:44 jghali Resolution open => fixed
2016-04-09 16:44 jghali Assigned To => jghali
2016-04-09 21:48 orbisvicis Note Added: 0039995
2016-04-09 21:48 orbisvicis Status resolved => closed