fix page border computation (closes: #92)

This commit is contained in:
Johannes Schauer Marin Rodrigues 2021-04-13 13:10:34 +02:00
parent 8d2ae0f64e
commit 81325d3998
Signed by: josch
GPG key ID: F2CBA5C78FBD83E1

View file

@ -901,8 +901,8 @@ class pdfdoc(object):
page[PdfName.CropBox] = [ page[PdfName.CropBox] = [
cropborder[1], cropborder[1],
cropborder[0], cropborder[0],
pagewidth - 2 * cropborder[1], pagewidth - cropborder[1],
pageheight - 2 * cropborder[0], pageheight - cropborder[0],
] ]
if bleedborder is None: if bleedborder is None:
if PdfName.CropBox in page: if PdfName.CropBox in page:
@ -911,8 +911,8 @@ class pdfdoc(object):
page[PdfName.BleedBox] = [ page[PdfName.BleedBox] = [
bleedborder[1], bleedborder[1],
bleedborder[0], bleedborder[0],
pagewidth - 2 * bleedborder[1], pagewidth - bleedborder[1],
pageheight - 2 * bleedborder[0], pageheight - bleedborder[0],
] ]
if trimborder is None: if trimborder is None:
if PdfName.CropBox in page: if PdfName.CropBox in page:
@ -921,8 +921,8 @@ class pdfdoc(object):
page[PdfName.TrimBox] = [ page[PdfName.TrimBox] = [
trimborder[1], trimborder[1],
trimborder[0], trimborder[0],
pagewidth - 2 * trimborder[1], pagewidth - trimborder[1],
pageheight - 2 * trimborder[0], pageheight - trimborder[0],
] ]
if artborder is None: if artborder is None:
if PdfName.CropBox in page: if PdfName.CropBox in page:
@ -931,8 +931,8 @@ class pdfdoc(object):
page[PdfName.ArtBox] = [ page[PdfName.ArtBox] = [
artborder[1], artborder[1],
artborder[0], artborder[0],
pagewidth - 2 * artborder[1], pagewidth - artborder[1],
pageheight - 2 * artborder[0], pageheight - artborder[0],
] ]
page[PdfName.Resources] = resources page[PdfName.Resources] = resources
page[PdfName.Contents] = content page[PdfName.Contents] = content