From 4383441863c05f40c944215140605acf857d574f Mon Sep 17 00:00:00 2001 From: Samuel Seng Date: Sat, 26 Nov 2022 13:45:22 -0500 Subject: [PATCH] Fix broken link in README.md Comparing the [old examples/image-maintaince.py](https://github.com/pymupdf/PyMuPDF-Utilities/blob/ceb27639b6a7e1057178d448c5fdf7bc9d357406/examples/image-maintenance.py) with [the new examples/edit-images/edit.py](https://github.com/pymupdf/PyMuPDF-Utilities/blob/master/examples/edit-images/edit.py) are all changes to the documentation or updating to the new API which replaced camel casing with underscores ```bash diff -w old.py new.py 1,2d0 < # -*- coding: utf-8 -*- < 4,11c2,4 < @created: 2020-08-05 13:00:00 < @author: Jorj X. McKie < Let the user select a PDF file to maintain its images. < Dependencies: < PyMuPDF v1.17.5, wxPython Phoenix version < License: < GNU GPL 3.x, GNU AFFERO GPL 3 < Copyright: --- > Edit images in a PDF document > ------------------------------------------------------------------------------- > License: GNU AFFERO GPL 3 12a6,11 > Usage > ----- > python edit.py > Dependencies > ------------ > PyMuPDF v1.17.5, wxPython Phoenix version 13a13 > 136c136 < img_rect = page.getImageBbox(img) --- > img_rect = page.get_image_bbox(img) 148c148 < if img_rect.isInfinite: --- > if img_rect.is_infinite: 157,158c157,158 < for xref in page.getContents(): < cont = doc.xrefStream(xref) --- > for xref in page.get_contents(): > cont = doc.xref_stream(xref) 222c222 < mat_test = calc_matrix(1, 1, img_rect * ~page.transformationMatrix, rotate=deg) --- > mat_test = calc_matrix(1, 1, img_rect * ~page.transformation_matrix, rotate=deg) 232d231 < 236c235 < img_list = [img[-3] for img in page.getImageList(True) if img[-1] == 0] --- > img_list = [img[-3] for img in page.get_images(True) if img[-1] == 0] 280c279 < if self.doc.needsPass: # check password protection --- > if self.doc.needs_pass: # check password protection 282c281 < if self.doc.isEncrypted: # quit if we cannot decrypt --- > if self.doc.is_encrypted: # quit if we cannot decrypt 694c693 < page = min(page, self.doc.pageCount) # cannot go beyond last page --- > page = min(page, self.doc.page_count) # cannot go beyond last page 742c741 < tar_rect = new_rect * ~page.transformationMatrix --- > tar_rect = new_rect * ~page.transformation_matrix 745c744 < cont = bytearray(self.doc.xrefStream(xref)) # modifyable version! --- > cont = bytearray(self.doc.xref_stream(xref)) # modifyable version! 750c749 < self.doc.updateStream(xref, bytes(cont)) # rewrite stream --- > self.doc.update_stream(xref, bytes(cont)) # rewrite stream 761d759 < 776c774 < tar_rect = rect * ~page.transformationMatrix --- > tar_rect = rect * ~page.transformation_matrix 779c777 < cont = bytearray(self.doc.xrefStream(xref)) # modifyable version! --- > cont = bytearray(self.doc.xref_stream(xref)) # modifyable version! 781c779 < self.doc.updateStream(xref, bytes(cont)) --- > self.doc.update_stream(xref, bytes(cont)) 784,785c782,783 < if not page._isWrapped: < page.wrapContents() --- > if not page.is_wrapped: > page.wrap_contents() 787c785 < page.cleanContents() --- > page.clean_contents() 808c806 < cont = bytearray(self.doc.xrefStream(xref)) # modifyable version! --- > cont = bytearray(self.doc.xref_stream(xref)) # modifyable version! 810,811c808,809 < self.doc.updateStream(xref, bytes(cont)) < page.cleanContents() --- > self.doc.update_stream(xref, bytes(cont)) > page.clean_contents() 843c841 < if self.doc.needsPass or not self.doc.can_save_incrementally(): --- > if self.doc.needs_pass or not self.doc.can_save_incrementally(): 852c850 < if self.doc.needsPass or not self.doc.can_save_incrementally(): --- > if self.doc.needs_pass or not self.doc.can_save_incrementally(): 862d859 < self.doc._delXmlMetadata() 883c880 < page.insertImage(r, filename=path) --- > page.insert_image(r, filename=path) 1029c1026 < if not rect.isInfinite: --- > if not rect.is_infinite: 1118c1115 < pix = page.getPixmap(matrix=self.zoom, alpha=False) --- > pix = page.get_pixmap(matrix=self.zoom, alpha=False) 1143c1140 < if self.doc.isEncrypted: --- > if self.doc.is_encrypted: ``` --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f83d8e692..a8bab7ec4 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ For all supported document types (i.e. **_including images_**) you can For **PDF documents,** there exists a plethora of additional features: they can be created, joined or split up. Pages can be inserted, deleted, re-arranged or modified in many ways (including annotations and form fields). * Images and fonts can be extracted or inserted. - > You may want to have a look at [this](https://github.com/pymupdf/PyMuPDF-Utilities/blob/master/examples/image-maintenance.py) cool GUI example script, which lets you **_insert, delete, replace_** or **_re-position_** images under your visual control. + > You may want to have a look at [this](https://github.com/pymupdf/PyMuPDF-Utilities/blob/master/examples/edit-images/edit.py) cool GUI example script, which lets you **_insert, delete, replace_** or **_re-position_** images under your visual control. > If [fontTools](https://pypi.org/project/fonttools/) is installed, subsets can be built for eligible fonts based on their usage in the document. Especially for new PDFs, this can lead to significant file size reductions. * Embedded files are fully supported.