![]() |
LeenO computo metrico con LibreOffice
3.22.0
Il software libero per la gestione di computi metrici e contabilità lavori.
|
Membri pubblici | |
| def | __init__ (self) |
| def | getObject (self, ido) |
| def | addPage (self, page) |
| def | insertPage (self, page, index=0) |
| def | getPage (self, pageNumber) |
| def | getNumPages (self) |
| def | addBlankPage (self, width=None, height=None) |
| def | insertBlankPage (self, width=None, height=None, index=0) |
| def | addJS (self, javascript) |
| def | addAttachment (self, fname, fdata) |
| def | appendPagesFromReader (self, reader, after_page_append=None) |
| def | updatePageFormFieldValues (self, page, fields) |
| def | cloneReaderDocumentRoot (self, reader) |
| def | cloneDocumentFromReader (self, reader, after_page_append=None) |
| def | encrypt (self, user_pwd, owner_pwd=None, use_128bit=True) |
| def | write (self, stream) |
| def | addMetadata (self, infos) |
| def | getReference (self, obj) |
| def | getOutlineRoot (self) |
| def | getNamedDestRoot (self) |
| def | addBookmarkDestination (self, dest, parent=None) |
| def | addBookmarkDict (self, bookmark, parent=None) |
| def | addBookmark (self, title, pagenum, parent=None, color=None, bold=False, italic=False, fit='/Fit', *args) |
| def | addNamedDestinationObject (self, dest) |
| def | addNamedDestination (self, title, pagenum) |
| def | removeLinks (self) |
| def | removeImages (self, ignoreByteStringObject=False) |
| def | removeText (self, ignoreByteStringObject=False) |
| def | addLink (self, pagenum, pagedest, rect, border=None, fit='/Fit', *args) |
| def | getPageLayout (self) |
| def | setPageLayout (self, layout) |
| def | getPageMode (self) |
| def | setPageMode (self, mode) |
Attributi pubblici | |
| stack | |
Proprietà | |
| pageLayout = property(getPageLayout, setPageLayout) | |
| pageMode = property(getPageMode, setPageMode) | |
This class supports writing PDF files out, given pages produced by another class (typically :class:`PdfFileReader<PdfFileReader>`).
| def pdf.PdfFileWriter.addAttachment | ( | self, | |
| fname, | |||
| fdata | |||
| ) |
Embed a file inside the PDF.
:param str fname: The filename to display.
:param str fdata: The data in the file.
Reference:
https://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/PDF32000_2008.pdf
Section 7.11.3
Sample: 8 0 obj << /Length 12 /Type /EmbeddedFile >> stream Hello world! endstream endobj
| def pdf.PdfFileWriter.addBlankPage | ( | self, | |
width = None, |
|||
height = None |
|||
| ) |
Appends a blank page to this PDF file and returns it. If no page size
is specified, use the size of the last page.
:param float width: The width of the new page expressed in default user
space units.
:param float height: The height of the new page expressed in default
user space units.
:return: the newly appended page
:rtype: :class:`PageObject<PyPDF2.pdf.PageObject>`
:raises PageSizeNotDefinedError: if width and height are not defined
and previous page does not exist.
| def pdf.PdfFileWriter.addBookmark | ( | self, | |
| title, | |||
| pagenum, | |||
parent = None, |
|||
color = None, |
|||
bold = False, |
|||
italic = False, |
|||
fit = '/Fit', |
|||
| * | args | ||
| ) |
Add a bookmark to this PDF file.
:param str title: Title to use for this bookmark.
:param int pagenum: Page number this bookmark will point to.
:param parent: A reference to a parent bookmark to create nested
bookmarks.
:param tuple color: Color of the bookmark as a red, green, blue tuple
from 0.0 to 1.0
:param bool bold: Bookmark is bold
:param bool italic: Bookmark is italic
:param str fit: The fit of the destination page. See
:meth:`addLink()<addLink>` for details.
| def pdf.PdfFileWriter.addBookmarkDestination | ( | self, | |
| dest, | |||
parent = None |
|||
| ) |
| def pdf.PdfFileWriter.addBookmarkDict | ( | self, | |
| bookmark, | |||
parent = None |
|||
| ) |
| def pdf.PdfFileWriter.addJS | ( | self, | |
| javascript | |||
| ) |
| def pdf.PdfFileWriter.addLink | ( | self, | |
| pagenum, | |||
| pagedest, | |||
| rect, | |||
border = None, |
|||
fit = '/Fit', |
|||
| * | args | ||
| ) |
Add an internal link from a rectangular area to the specified page.
:param int pagenum: index of the page on which to place the link.
:param int pagedest: index of the page to which the link should go.
:param rect: :class:`RectangleObject<PyPDF2.generic.RectangleObject>` or array of four
integers specifying the clickable rectangular area
``[xLL, yLL, xUR, yUR]``, or string in the form ``"[ xLL yLL xUR yUR ]"``.
:param border: if provided, an array describing border-drawing
properties. See the PDF spec for details. No border will be
drawn if this argument is omitted.
:param str fit: Page fit or 'zoom' option (see below). Additional arguments may need
to be supplied. Passing ``None`` will be read as a null value for that coordinate.
Valid zoom arguments (see Table 8.2 of the PDF 1.7 reference for details):
/Fit No additional arguments
/XYZ [left] [top] [zoomFactor]
/FitH [top]
/FitV [left]
/FitR [left] [bottom] [right] [top]
/FitB No additional arguments
/FitBH [top]
/FitBV [left]
| def pdf.PdfFileWriter.addMetadata | ( | self, | |
| infos | |||
| ) |
| def pdf.PdfFileWriter.addNamedDestination | ( | self, | |
| title, | |||
| pagenum | |||
| ) |
| def pdf.PdfFileWriter.addNamedDestinationObject | ( | self, | |
| dest | |||
| ) |
| def pdf.PdfFileWriter.addPage | ( | self, | |
| page | |||
| ) |
| def pdf.PdfFileWriter.appendPagesFromReader | ( | self, | |
| reader, | |||
after_page_append = None |
|||
| ) |
Copy pages from reader to writer. Includes an optional callback parameter
which is invoked after pages are appended to the writer.
:param reader: a PdfFileReader object from which to copy page
annotations to this writer object. The writer's annots
will then be updated
:callback after_page_append (function): Callback function that is invoked after
each page is appended to the writer. Callback signature:
:param writer_pageref (PDF page reference): Reference to the page
appended to the writer.
| def pdf.PdfFileWriter.cloneDocumentFromReader | ( | self, | |
| reader, | |||
after_page_append = None |
|||
| ) |
Create a copy (clone) of a document from a PDF file reader
:param reader: PDF file reader instance from which the clone
should be created.
:callback after_page_append (function): Callback function that is invoked after
each page is appended to the writer. Signature includes a reference to the
appended page (delegates to appendPagesFromReader). Callback signature:
:param writer_pageref (PDF page reference): Reference to the page just
appended to the document.
| def pdf.PdfFileWriter.cloneReaderDocumentRoot | ( | self, | |
| reader | |||
| ) |
| def pdf.PdfFileWriter.encrypt | ( | self, | |
| user_pwd, | |||
owner_pwd = None, |
|||
use_128bit = True |
|||
| ) |
Encrypt this PDF file with the PDF Standard encryption handler.
:param str user_pwd: The "user password", which allows for opening
and reading the PDF file with the restrictions provided.
:param str owner_pwd: The "owner password", which allows for
opening the PDF files without any restrictions. By default,
the owner password is the same as the user password.
:param bool use_128bit: flag as to whether to use 128bit
encryption. When false, 40bit encryption will be used. By default,
this flag is on.
| def pdf.PdfFileWriter.getNumPages | ( | self | ) |
| def pdf.PdfFileWriter.getPage | ( | self, | |
| pageNumber | |||
| ) |
| def pdf.PdfFileWriter.getPageLayout | ( | self | ) |
| def pdf.PdfFileWriter.getPageMode | ( | self | ) |
| def pdf.PdfFileWriter.insertBlankPage | ( | self, | |
width = None, |
|||
height = None, |
|||
index = 0 |
|||
| ) |
Inserts a blank page to this PDF file and returns it. If no page size
is specified, use the size of the last page.
:param float width: The width of the new page expressed in default user
space units.
:param float height: The height of the new page expressed in default
user space units.
:param int index: Position to add the page.
:return: the newly appended page
:rtype: :class:`PageObject<PyPDF2.pdf.PageObject>`
:raises PageSizeNotDefinedError: if width and height are not defined
and previous page does not exist.
| def pdf.PdfFileWriter.insertPage | ( | self, | |
| page, | |||
index = 0 |
|||
| ) |
Insert a page in this PDF file. The page is usually acquired from a
:class:`PdfFileReader<PdfFileReader>` instance.
:param PageObject page: The page to add to the document. This
argument should be an instance of :class:`PageObject<pdf.PageObject>`.
:param int index: Position at which the page will be inserted.
| def pdf.PdfFileWriter.removeImages | ( | self, | |
ignoreByteStringObject = False |
|||
| ) |
| def pdf.PdfFileWriter.removeLinks | ( | self | ) |
| def pdf.PdfFileWriter.removeText | ( | self, | |
ignoreByteStringObject = False |
|||
| ) |
| def pdf.PdfFileWriter.setPageLayout | ( | self, | |
| layout | |||
| ) |
Set the page layout
:param str layout: The page layout to be used
Valid layouts are:
/NoLayout Layout explicitly not specified
/SinglePage Show one page at a time
/OneColumn Show one column at a time
/TwoColumnLeft Show pages in two columns, odd-numbered pages on the left
/TwoColumnRight Show pages in two columns, odd-numbered pages on the right
/TwoPageLeft Show two pages at a time, odd-numbered pages on the left
/TwoPageRight Show two pages at a time, odd-numbered pages on the right
| def pdf.PdfFileWriter.setPageMode | ( | self, | |
| mode | |||
| ) |
Set the page mode.
:param str mode: The page mode to use.
Valid modes are:
/UseNone Do not show outlines or thumbnails panels
/UseOutlines Show outlines (aka bookmarks) panel
/UseThumbs Show page thumbnails panel
/FullScreen Fullscreen view
/UseOC Show Optional Content Group (OCG) panel
/UseAttachments Show attachments panel
| def pdf.PdfFileWriter.updatePageFormFieldValues | ( | self, | |
| page, | |||
| fields | |||
| ) |
Update the form field values for a given page from a fields dictionary.
Copy field texts and values from fields to page.
:param page: Page reference from PDF writer where the annotations
and field data will be updated.
:param fields: a Python dictionary of field names (/T) and text
values (/V)
| def pdf.PdfFileWriter.write | ( | self, | |
| stream | |||
| ) |
|
static |
|
static |
1.8.16