Skip to content

Commit 7f90f94

Browse files
docs/document.rst: add raise_on_repair and repair().
Document Document.save()'s new <raise_on_repair>. Document new Document.repair(). Also document Document.save()'s <compression_effort>.
1 parent f90318d commit 7f90f94

1 file changed

Lines changed: 21 additions & 2 deletions

File tree

docs/document.rst

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1246,6 +1246,14 @@ For details on **embedded files** refer to Appendix 3.
12461246

12471247
Check whether the document can be saved incrementally. Use it to choose the right option without encountering exceptions.
12481248

1249+
.. method:: repair()
1250+
1251+
Repair document.
1252+
1253+
* Slow for large documents.
1254+
* Does nothing on non-PDF documents.
1255+
* New in v1.27.0
1256+
12491257
.. method:: scrub(attached_files=True, clean_pages=True, embedded_files=True, hidden_text=True, javascript=True, metadata=True, redactions=True, redact_images=0, remove_links=True, reset_fields=True, reset_responses=True, thumbnails=True, xml_metadata=True)
12501258

12511259
* New in v1.16.14
@@ -1267,7 +1275,7 @@ For details on **embedded files** refer to Appendix 3.
12671275
:arg bool xml_metadata: Remove XML metadata.
12681276

12691277

1270-
.. method:: save(outfile, garbage=0, clean=False, deflate=False, deflate_images=False, deflate_fonts=False, incremental=False, ascii=False, expand=0, linear=False, pretty=False, no_new_id=False, encryption=PDF_ENCRYPT_NONE, permissions=-1, owner_pw=None, user_pw=None, use_objstms=0)
1278+
.. method:: save(outfile, garbage=0, clean=False, deflate=False, deflate_images=False, deflate_fonts=False, incremental=False, ascii=False, expand=0, linear=False, pretty=False, no_new_id=False, encryption=PDF_ENCRYPT_NONE, permissions=-1, owner_pw=None, user_pw=None, use_objstms=0, compression_effort=0, raise_on_repair=False)
12711279

12721280
* Changed in v1.18.7
12731281
* Changed in v1.19.0
@@ -1318,8 +1326,19 @@ For details on **embedded files** refer to Appendix 3.
13181326

13191327
:arg int use_objstms: *(new in v1.24.0)* compression option that converts eligible PDF object definitions to information that is stored in some other object's :data:`stream` data. Depending on the `deflate` parameter value, the converted object definitions will be compressed -- which can lead to very significant file size reductions.
13201328

1321-
.. warning:: The method does not check, whether a file of that name already exists, will hence not ask for confirmation, and overwrite the file. It is your responsibility as a programmer to handle this.
1329+
.. warning:: The method does not check, whether a file of that name already exists, will hence not ask for confirmation, and overwrite the file. It is your responsibility as a programmer to handle this.
13221330

1331+
:arg int compression_effort:
1332+
1333+
* 0 for default
1334+
* 1 for minimum effort.
1335+
* 100 for maximum effort.
1336+
1337+
:arg bool raise_on_repair: *(new in v1.27.0)* If true we raise an exception if the save caused a repair.
1338+
This is useful because repairs can cause changes to be lost.
1339+
1340+
Also see `Document.repair()`.
1341+
13231342
.. note::
13241343

13251344
**File size reduction**

0 commit comments

Comments
 (0)