Problems registering, no confirmation email - see http://wiki.scribus.net/canvas/Forums_Registration
Quote from: jirib on May 11, 2025, 10:57:27 AMSo, it generates cover with 'cover_pairs'..., however, logically, it places crop marks and spine marks only on the first/outside cover page.
Quote from: jirib on May 11, 2025, 11:07:27 AM...
CROP_OFFSET = 6 * pt
CROP_LINE_WIDTH = 0.2 * pt
CROP_LEN = 5 * mm
...
BLEED = 5 * mm
...
Quote from: a.l.e on May 10, 2025, 02:56:25 PM(...) it might also be interesting to have a version that runs inside of Scribus and adds the marks on a dedicated layer.
Quote from: jirib on May 11, 2025, 09:52:30 AMI even did not know how crop marks or spine marks should look like :/ I could not find an exact description. Maybe in the scribus source (for crop marks)
...
CROP_OFFSET = 6 * pt
CROP_LINE_WIDTH = 0.2 * pt
CROP_LEN = 5 * mm
...
BLEED = 5 * mm
...
Quote from: Nermander on May 11, 2025, 10:39:52 AMDo I understand it right, this script takes a PDF and make a cover of the first and last page?
So, with a 12 page PDF, pages 1 and 12 end up in a cover PDF (landscape, 2-up, with a spine between the pages) and the pages 2-11 end up in a "content only" PDF?
And the width of the spine is calculated based on the number of pages and an assumed page thickness of 0.083?
But what about the insides of the cover? Those will be blank?
...
cover_pairs = [
(reader.pages[total_pages - 1], reader.pages[0]),
(reader.pages[1], reader.pages[total_pages - 2])
]
...
# === Generate 2-page cover PDF
cover_writer = PdfWriter()
for i, (left, right) in enumerate(cover_pairs):
merged = PageObject.create_blank_page(None, TOTAL_WIDTH, TOTAL_HEIGHT)
if i == 0:
packet = BytesIO()
c = canvas.Canvas(packet, pagesize=(TOTAL_WIDTH, TOTAL_HEIGHT))
draw_marks(c, TOTAL_WIDTH, TOTAL_HEIGHT, spine_width)
c.showPage()
c.save()
packet.seek(0)
marks = PdfReader(packet).pages[0]
merged.merge_page(marks)
merged.merge_translated_page(left, tx=BLEED, ty=BLEED)
merged.merge_translated_page(right, tx=BLEED + A5_WIDTH + spine_width, ty=BLEED)
cover_writer.add_page(merged)
with open(cover_out, "wb") as f:
cover_writer.write(f)
...