cpdf-source/docsplits/pysplits/c04.tex

73 lines
2.5 KiB
TeX
Raw Normal View History

2021-08-10 15:41:18 +02:00
def scalePages(pdf, r, sx, sy):
2021-09-01 19:41:10 +02:00
"""Scale the page dimensions and content of the given range of pages by
the given scale (sx, sy), about (0, 0). Other boxes (crop etc. are altered
as appropriate)."""
2021-08-10 15:41:18 +02:00
2021-09-01 19:41:10 +02:00
def scaleToFit(pdf, r, w, h, scale_to_fit_scale):
"""Scales the pages in the range to fit new page dimensions (w and h)
multiplied by scale_to_fit_scale (typically 1.0). Other boxes (crop etc.)
are altered as appropriate."""
2021-08-10 15:41:18 +02:00
def scaleToFitPaper(pdf, r, papersize, scale_to_fit_scale):
2021-09-01 19:41:10 +02:00
"""Scales the given pages to fit the given page size, possibly multiplied
2024-04-17 01:59:48 +02:00
by scale_to_fit_scale (typically 1.0)."""
2021-08-10 15:41:18 +02:00
def scaleContents(pdf, r, pos, scale):
2021-09-01 19:41:10 +02:00
"""Scales the contents of the pages in the range about the point given by
the position, by the scale given."""
2021-08-10 15:41:18 +02:00
def shiftContents(pdf, r, dx, dy):
2021-09-01 19:41:10 +02:00
"""Shift the content of the pages in the range by (dx, dy)."""
2024-04-17 01:59:48 +02:00
r = range_of_list(r)
def shiftBoxes(pdf, r, dx, dy):
"""Shift the pages boxes in the range by (dx, dy)."""
2021-08-10 15:41:18 +02:00
def rotate(pdf, r, rotation):
2024-04-17 01:59:48 +02:00
"""Change the viewing rotation of the pages in the range to an absolute
value. Appropriate rotations are 0, 90, 180, 270."""
2021-08-10 15:41:18 +02:00
def rotateBy(pdf, r, rotation):
2024-04-17 01:59:48 +02:00
"""Change the viewing rotation of the pages in the range by a given number
of degrees. Appropriate values are 90, 180, 270."""
2021-08-10 15:41:18 +02:00
def rotateContents(pdf, r, rotation):
2024-04-17 01:59:48 +02:00
"""Rotate the content about the centre of the page by the given number of
degrees, in a clockwise direction."""
2021-08-10 15:41:18 +02:00
def upright(pdf, r):
2021-09-01 19:41:10 +02:00
"""Change the viewing rotation of the pages in the range, counter-rotating
the dimensions and content such that there is no visual change."""
2021-08-10 15:41:18 +02:00
def hFlip(pdf, r):
2021-09-01 19:41:10 +02:00
"""Flip horizontally the pages in the range."""
2021-08-10 15:41:18 +02:00
def vFlip(pdf, r):
2021-09-01 19:41:10 +02:00
"""Flip vertically the pages in the range."""
2021-08-10 15:41:18 +02:00
def crop(pdf, r, x, y, w, h):
2021-09-01 19:41:10 +02:00
"""Crop a page to the box defined by (x, y, w, h), replacing any existing
crop box."""
2021-08-10 15:41:18 +02:00
def removeCrop(pdf, r):
2021-09-01 19:41:10 +02:00
"""Remove any crop box from pages in the range."""
2021-08-10 15:41:18 +02:00
def removeTrim(pdf, r):
2021-09-01 19:41:10 +02:00
"""Remove any trim box from pages in the range."""
2021-08-10 15:41:18 +02:00
def removeArt(pdf, r):
2021-09-01 19:41:10 +02:00
"""Remove any art box from pages in the range."""
2021-08-10 15:41:18 +02:00
def removeBleed(pdf, r):
2021-09-01 19:41:10 +02:00
"""Remove any bleed box from pages in the range."""
2021-08-10 15:41:18 +02:00
def trimMarks(pdf, r):
2021-09-01 19:41:10 +02:00
"""Add trim marks to the given pages, if the trimbox exists."""
2021-08-10 15:41:18 +02:00
def showBoxes(pdf, r):
2021-09-01 19:41:10 +02:00
"""Show the boxes on the given pages, for debug."""
2021-08-10 15:41:18 +02:00
def hardBox(pdf, r, boxname):
2021-09-01 19:41:10 +02:00
"""Make a given box a 'hard box' i.e clip it explicitly. Boxname could be,
for example "/TrimBox"."""