update python splits

This commit is contained in:
John Whitington
2022-01-23 13:06:53 +00:00
parent 3988de1cea
commit 0f52366328
9 changed files with 71 additions and 23 deletions

View File

@@ -25,6 +25,16 @@ def blankDocument(w, h, pages):
with pages of the given width (in points), height (in points), and number
of pages."""
def textToPDF(w, h, font, fontsize, filename):
"""textToPDF(w, h, font, fontsize, filename) typesets a UTF8 text file
ragged right on a page of size w * h in points in the given font and font
size."""
def textToPDFPaper(papersize, font, fontsize, filename):
"""textToPDF(papersize font, fontsize, filename) typesets a UTF8 text file
ragged right on a page of the given size in the given font and font
size."""
def blankDocumentPaper(papersize, pages):
"""Create a blank document with pages of the given paper size, and number
of pages. """
@@ -48,9 +58,9 @@ def inOfPt(i):
"""Convert a figure in points to inches (72 points to 1 inch)."""
def parsePagespec(pdf, pagespec):
"""Parse a page specification such as "1-3,8-end" to a range with reference to
a given PDF (the PDF is supplied so that page ranges which reference pages
which do not exist are rejected)."""
"""Parse a page specification such as "1-3,8-end" to a range with reference
to a given PDF (the PDF is supplied so that page ranges which reference
pages which do not exist are rejected)."""
def validatePagespec(pagespec):
"""Validate a page specification, returning True or False, so far as is
@@ -95,6 +105,7 @@ def rangeLength(r):
def rangeGet(r, n):
"""Get the page number at position n in a range, where
n runs from 0 to rangeLength - 1."""
def rangeAdd(r, p):
"""Add the page to a range, if it is not already
@@ -105,9 +116,6 @@ def isInRange(r, p):
def pages(pdf):
"""Return the number of pages in a PDF."""
r = libc.pycpdf_pages(pdf.pdf)
checkerror()
return r
def pagesFast(userpw, filename):
"""Return the number of pages in a given
@@ -129,16 +137,12 @@ def toFileExt(pdf, filename, linearize, make_id, preserve_objstm,
will be compressed (what we usually want). WARNING: the pdf argument will
be invalid after this call and should not be used again."""
def toMemory(pdf, linearize, make_id):
"""Write a file to memory, returning the buffer as a byte array of type
bytes."""
def isEncrypted(pdf):
"""Returns True if a documented is encrypted, False otherwise."""
r = libc.pycpdf_isEncrypted(pdf.pdf)
checkerror()
return r
def toFileEncrypted(pdf, method, permissions, ownerpw, userpw, linearize,
makeid, filename):