pdftools_toolbox.pdf.page_list
Classes
|
- class pdftools_toolbox.pdf.page_list.PageList(handle)[source]
Bases:
_NativeObject
,list
- static copy(target_document: Document, page_list: PageList, options: PageCopyOptions | None) PageList [source]
Copy a page list
Copy pages from an input document to the given targetDocument. The returned list is associated with the given target document but not yet part of it. It can be appended to the document’s page list.
- Parameters:
targetDocument (pdftools_toolbox.pdf.document.Document) – the output document with which the returned object is associated
pageList (pdftools_toolbox.pdf.page_list.PageList) – a page list of a different document
options (Optional[pdftools_toolbox.pdf.page_copy_options.PageCopyOptions]) – the copy options
- Returns:
the copied page list, associated with the target document.
- Return type:
- Raises:
OSError – Error reading from the source document or writing to the target document
pdftools_toolbox.corrupt_error.CorruptError – The source document is corrupt
pdftools_toolbox.conformance_error.ConformanceError – The conformance level of the source document is not compatible with the conformance level of the target document.
pdftools_toolbox.conformance_error.ConformanceError – The explicitly requested conformance level is PDF/A Level A (
pdftools_toolbox.pdf.conformance.Conformance.PDFA1A
,pdftools_toolbox.pdf.conformance.Conformance.PDFA2A
, orpdftools_toolbox.pdf.conformance.Conformance.PDFA3A
) and the copy optionpdftools_toolbox.pdf.page_copy_options.PageCopyOptions.copy_logical_structure
is not set.ValueError – if the targetDocument argument has already been closed
ValueError – if the targetDocument argument is read-only
ValueError – if the pageList object is not associated with an input document
ValueError – if the document associated with pageList has already been closed
ValueError – if the argument options has
pdftools_toolbox.pdf.page_copy_options.PageCopyOptions.form_fields
set topdftools_toolbox.pdf.forms.form_field_copy_strategy.FormFieldCopyStrategy.COPY
and the targetDocument contains form fields that have either been copied explicitly withpdftools_toolbox.pdf.forms.field_node.FieldNode.copy()
or created withpdftools_toolbox.pdf.forms.check_box.CheckBox.create()
,pdftools_toolbox.pdf.forms.combo_box.ComboBox.create()
,pdftools_toolbox.pdf.forms.comb_text_field.CombTextField.create()
,pdftools_toolbox.pdf.forms.general_text_field.GeneralTextField.create()
,pdftools_toolbox.pdf.forms.list_box.ListBox.create()
,pdftools_toolbox.pdf.forms.radio_button_group.RadioButtonGroup.create()
, orpdftools_toolbox.pdf.forms.sub_form.SubForm.create()
.ValueError – if the argument options has
pdftools_toolbox.pdf.page_copy_options.PageCopyOptions.unsigned_signatures
set topdftools_toolbox.pdf.copy_strategy.CopyStrategy.COPY
and the targetDocument contains form fields that have either been copied explicitly withpdftools_toolbox.pdf.forms.field_node.FieldNode.copy()
or created withpdftools_toolbox.pdf.forms.check_box.CheckBox.create()
,pdftools_toolbox.pdf.forms.combo_box.ComboBox.create()
,pdftools_toolbox.pdf.forms.comb_text_field.CombTextField.create()
,pdftools_toolbox.pdf.forms.general_text_field.GeneralTextField.create()
,pdftools_toolbox.pdf.forms.list_box.ListBox.create()
,pdftools_toolbox.pdf.forms.radio_button_group.RadioButtonGroup.create()
, orpdftools_toolbox.pdf.forms.sub_form.SubForm.create()
.ValueError – if options has
pdftools_toolbox.pdf.page_copy_options.PageCopyOptions.copy_outline_items
set to True and the targetDocument contains outline items that have been copied explicitly withpdftools_toolbox.pdf.navigation.outline_item.OutlineItem.copy()
.
- remove(index: int) None [source]
Remove first occurrence of value.
Raises ValueError if the value is not present.
- pop(index: int = -1) Any [source]
Remove and return item at index (default last).
Raises IndexError if list is empty or index is out of range.
- sort(key=None, reverse=False) None [source]
Sort the list in ascending order and return None.
The sort is in-place (i.e. the list itself is modified) and stable (i.e. the order of two equal elements is maintained).
If a key function is given, apply it once to each list item and sort them, ascending or descending, according to their function values.
The reverse flag can be set to sort in descending order.