LeenO computo metrico con LibreOffice  3.22.0
Il software libero per la gestione di computi metrici e contabilità lavori.
Membri pubblici | Attributi pubblici | Proprietà | Elenco di tutti i membri
Riferimenti per la classe pdf.PdfFileWriter

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)
 

Descrizione dettagliata

This class supports writing PDF files out, given pages produced by another
class (typically :class:`PdfFileReader<PdfFileReader>`).

Definizione alla linea 79 del file pdf.py.

Documentazione dei costruttori e dei distruttori

◆ __init__()

def pdf.PdfFileWriter.__init__ (   self)

Definizione alla linea 84 del file pdf.py.

Documentazione delle funzioni membro

◆ addAttachment()

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        

Definizione alla linea 247 del file pdf.py.

◆ addBlankPage()

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.

Definizione alla linea 172 del file pdf.py.

◆ addBookmark()

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.

Definizione alla linea 690 del file pdf.py.

◆ addBookmarkDestination()

def pdf.PdfFileWriter.addBookmarkDestination (   self,
  dest,
  parent = None 
)

Definizione alla linea 651 del file pdf.py.

◆ addBookmarkDict()

def pdf.PdfFileWriter.addBookmarkDict (   self,
  bookmark,
  parent = None 
)

Definizione alla linea 665 del file pdf.py.

◆ addJS()

def pdf.PdfFileWriter.addJS (   self,
  javascript 
)
Add Javascript which will launch upon opening this PDF.

:param str javascript: Your Javascript.

>>> output.addJS("this.print({bUI:true,bSilent:false,bShrinkToFit:true});")
# Example: This will launch the print window when the PDF is opened.

Definizione alla linea 214 del file pdf.py.

◆ addLink()

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]

Definizione alla linea 893 del file pdf.py.

◆ addMetadata()

def pdf.PdfFileWriter.addMetadata (   self,
  infos 
)
Add custom metadata to the output.

:param dict infos: a Python dictionary where each key is a field
    and each value is your new metadata.

Definizione alla linea 529 del file pdf.py.

◆ addNamedDestination()

def pdf.PdfFileWriter.addNamedDestination (   self,
  title,
  pagenum 
)

Definizione alla linea 759 del file pdf.py.

◆ addNamedDestinationObject()

def pdf.PdfFileWriter.addNamedDestinationObject (   self,
  dest 
)

Definizione alla linea 751 del file pdf.py.

◆ addPage()

def pdf.PdfFileWriter.addPage (   self,
  page 
)
Adds a page to this PDF file.  The page is usually acquired from a
:class:`PdfFileReader<PdfFileReader>` instance.

:param PageObject page: The page to add to the document. Should be
    an instance of :class:`PageObject<PyPDF2.pdf.PageObject>`

Definizione alla linea 130 del file pdf.py.

◆ appendPagesFromReader()

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.

Definizione alla linea 328 del file pdf.py.

◆ cloneDocumentFromReader()

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.

Definizione alla linea 382 del file pdf.py.

◆ cloneReaderDocumentRoot()

def pdf.PdfFileWriter.cloneReaderDocumentRoot (   self,
  reader 
)
Copy the reader document root to the writer.

:param reader:  PdfFileReader from the document root should be copied.
:callback after_page_append

Definizione alla linea 373 del file pdf.py.

◆ encrypt()

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.

Definizione alla linea 398 del file pdf.py.

◆ getNamedDestRoot()

def pdf.PdfFileWriter.getNamedDestRoot (   self)

Definizione alla linea 616 del file pdf.py.

◆ getNumPages()

def pdf.PdfFileWriter.getNumPages (   self)
:return: the number of pages.
:rtype: int

Definizione alla linea 164 del file pdf.py.

◆ getObject()

def pdf.PdfFileWriter.getObject (   self,
  ido 
)

Definizione alla linea 117 del file pdf.py.

◆ getOutlineRoot()

def pdf.PdfFileWriter.getOutlineRoot (   self)

Definizione alla linea 602 del file pdf.py.

◆ getPage()

def pdf.PdfFileWriter.getPage (   self,
  pageNumber 
)
Retrieves a page by number from this PDF file.

:param int pageNumber: The page number to retrieve
    (pages begin at zero)
:return: the page at the index given by *pageNumber*
:rtype: :class:`PageObject<pdf.PageObject>`

Definizione alla linea 151 del file pdf.py.

◆ getPageLayout()

def pdf.PdfFileWriter.getPageLayout (   self)
Get the page layout.
See :meth:`setPageLayout()<PdfFileWriter.setPageLayout>` for a description of valid layouts.

:return: Page layout currently being used.
:rtype: str, None if not specified

Definizione alla linea 965 del file pdf.py.

◆ getPageMode()

def pdf.PdfFileWriter.getPageMode (   self)
Get the page mode.
See :meth:`setPageMode()<PdfFileWriter.setPageMode>` for a description
of valid modes.

:return: Page mode currently being used.
:rtype: str, None if not specified

Definizione alla linea 1005 del file pdf.py.

◆ getReference()

def pdf.PdfFileWriter.getReference (   self,
  obj 
)

Definizione alla linea 596 del file pdf.py.

◆ insertBlankPage()

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.

Definizione alla linea 190 del file pdf.py.

◆ insertPage()

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.

Definizione alla linea 140 del file pdf.py.

◆ removeImages()

def pdf.PdfFileWriter.removeImages (   self,
  ignoreByteStringObject = False 
)
Removes images from this output.

:param bool ignoreByteStringObject: optional parameter
    to ignore ByteString Objects.

Definizione alla linea 784 del file pdf.py.

◆ removeLinks()

def pdf.PdfFileWriter.removeLinks (   self)
Removes links and annotations from this output.

Definizione alla linea 774 del file pdf.py.

◆ removeText()

def pdf.PdfFileWriter.removeText (   self,
  ignoreByteStringObject = False 
)
Removes images from this output.

:param bool ignoreByteStringObject: optional parameter
    to ignore ByteString Objects.

Definizione alla linea 839 del file pdf.py.

◆ setPageLayout()

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

Definizione alla linea 978 del file pdf.py.

◆ setPageMode()

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

Definizione alla linea 1019 del file pdf.py.

◆ updatePageFormFieldValues()

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)

Definizione alla linea 354 del file pdf.py.

◆ write()

def pdf.PdfFileWriter.write (   self,
  stream 
)
Writes the collection of pages added to this object out as a PDF file.

:param stream: An object to write the file to.  The object must support
    the write method and the tell method, similar to a file object.

Definizione alla linea 445 del file pdf.py.

Documentazione dei membri dato

◆ stack

pdf.PdfFileWriter.stack

Definizione alla linea 480 del file pdf.py.

Documentazione delle proprietà

◆ pageLayout

pdf.PdfFileWriter.pageLayout = property(getPageLayout, setPageLayout)
static

Definizione alla linea 999 del file pdf.py.

◆ pageMode

pdf.PdfFileWriter.pageMode = property(getPageMode, setPageMode)
static

Definizione alla linea 1039 del file pdf.py.


La documentazione per questa classe è stata generata a partire dal seguente file: