pdfdol.util#
Utils for pdfdol
Functions
|
Add a suffix and/or prefix to a filepath. |
|
If target is None, affix the source filepath and return it. |
|
Ensure that pages are given as a sequence of PageObject objects. |
|
Check if a PDF page is empty. |
|
Remove empty pages from a PDF file. |
- pdfdol.util.add_affix(string, *, prefix=None, suffix=None)[source]#
Add a suffix and/or prefix to a filepath.
>>> add_affix('file.pdf', prefix='new_', suffix='_for_you') 'new_file_for_you.pdf'
- pdfdol.util.affix_source_if_target_not_given(src, target=None, *, prefix=None, suffix=None)[source]#
If target is None, affix the source filepath and return it.
>>> affix_source_if_target_not_given( ... 'file.pdf', 'target_exists', prefix='new_', suffix='_for_you' ... ) 'target_exists' >>> affix_source_if_target_not_given( ... 'file.pdf', None, prefix='new_', suffix='_for_you' ... ) 'new_file_for_you.pdf'
- pdfdol.util.ensure_pages(pages)[source]#
Ensure that pages are given as a sequence of PageObject objects.
- Return type:
Iterable[PageObject]