2021-08-10 15:41:18 +02:00
|
|
|
# CHAPTER 12. File Attachments
|
2021-07-26 20:50:33 +02:00
|
|
|
|
2021-08-10 15:41:18 +02:00
|
|
|
def attachFile(filename, pdf):
|
|
|
|
"""attachFile(filename, pdf) attaches a file to the pdf. It is attached at
|
|
|
|
document level."""
|
2021-07-26 20:50:33 +02:00
|
|
|
|
2021-08-10 15:41:18 +02:00
|
|
|
def attachFileToPage(filename, pdf, pagenumber):
|
|
|
|
"""attachFileToPage(filename, pdf, pagenumber) attaches a file, given its
|
|
|
|
file name, pdf, and the page number to which it should be attached."""
|
2021-07-26 20:50:33 +02:00
|
|
|
|
2021-08-10 15:41:18 +02:00
|
|
|
def attachFileFromMemory(data, filename, pdf):
|
|
|
|
"""attachFileFromMemory(memory, length, filename, pdf) attaches from
|
|
|
|
memory, just like attachFile."""
|
2021-07-26 20:50:33 +02:00
|
|
|
|
2021-08-10 15:41:18 +02:00
|
|
|
def attachFileToPageFromMemory(data, filename, pdf, pagenumber):
|
|
|
|
"""attachFileToPageFromMemory(memory, length, filename, pdf, pagenumber)
|
|
|
|
attaches from memory, just like attachFileToPage."""
|
2021-07-26 20:50:33 +02:00
|
|
|
|
2021-08-10 15:41:18 +02:00
|
|
|
def removeAttachedFiles(pdf):
|
|
|
|
"""Remove all page- and document-level attachments from a document"""
|
2021-07-26 20:50:33 +02:00
|
|
|
|
2021-08-10 15:41:18 +02:00
|
|
|
def getAttachments(pdf):
|
|
|
|
"""List information about attachements. Returns a list of tuples
|
|
|
|
(name, page number, byte array of data)"""
|