Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
Line: 143 to 143 | ||||||||
| ||||||||
Added: | ||||||||
> > |
| |||||||
PyMuPDF: https://github.com/pymupdf/PyMuPDF-Utilities/blob/master/demo/demo.py![]() |
Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
Line: 132 to 132 | ||||||||
| ||||||||
Changed: | ||||||||
< < |
| |||||||
> > |
| |||||||
| ||||||||
Changed: | ||||||||
< < |
| |||||||
> > |
| |||||||
| ||||||||
Added: | ||||||||
> > |
| |||||||
PyMuPDF: https://github.com/pymupdf/PyMuPDF-Utilities/blob/master/demo/demo.py![]() |
Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
Line: 6 to 6 | ||||||||
Status | ||||||||
Changed: | ||||||||
< < | As of 2021-2-2: | |||||||
> > | As of 2021-2-4: | |||||||
| ||||||||
Line: 137 to 137 | ||||||||
| ||||||||
Added: | ||||||||
> > |
| |||||||
| ||||||||
Line: 223 to 226 | ||||||||
-- ![]() Comments | ||||||||
Deleted: | ||||||||
< < |
Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
Added: | ||||||||
> > | ||||||||
Auto-generated C++ and Python APIs for mupdf.Status | ||||||||
Changed: | ||||||||
< < | As of 2020-5-11: | |||||||
> > | As of 2021-2-2:
| |||||||
Customer page: | ||||||||
Line: 121 to 127 | ||||||||
Added: | ||||||||
> > | Comparison with PyMuPDF
![]() #! /usr/bin/env python3 import mupdf import os import sys assert len(sys.argv) == 7 filename, page_num, zoom, rotate, output, needle = sys.argv[1:] page_num = int(page_num) zoom = int(zoom) rotate = int(rotate) document = mupdf.Document(filename) print('') print(f'Document {filename} has {document.count_pages()} pages.') print('') print(f'Metadata Information:') print(f'mupdf.metadata_keys={mupdf.metadata_keys}') for key in mupdf.metadata_keys: value = document.lookup_metadata(key) print(f' {key}: {value!r}') print('') outline = mupdf.Outline(document) for o in outline: print(f' {" "*4*o.m_depth}{o.m_depth}: {o.m_outline.title()}') if page_num > document.count_pages(): raise SystemExit(f'page_num={page_num} is out of range - {filename} has {document.count_pages()} pages') page = document.load_page(page_num) links = page.load_links() if links: print(f'Links on page {page_num}:') for link in links: if link.m_internal: print(f' extern={mupdf.is_external_link(link.uri())}: {link.uri()}') else: print(f'No links on page {page_num}') trans = mupdf.Matrix.scale(zoom / 100.0, zoom / 100.0).pre_rotate(rotate) pixmap = page.new_pixmap_from_page(trans, mupdf.Colorspace(mupdf.Colorspace.Fixed_RGB), alpha=False) def save_pixmap(path): suffix = os.path.splitext(path)[1] if 0: pass elif suffix == '.pam': pixmap.save_pixmap_as_pam(path) elif suffix == '.pbm': pixmap.save_pixmap_as_pbm(path) elif suffix == '.pcl': pixmap.save_pixmap_as_pcl(path, append=0, options=mupdf.PclOptions()) elif suffix == '.pclm': pixmap.save_pixmap_as_pclm(path, append=0, options=mupdf.PclmOptions()) elif suffix == '.pdfocr':pixmap.save_pixmap_as_pdfocr(path, append=0, options=mupdf.PdfocrOptions()) elif suffix == '.pkm': pixmap.save_pixmap_as_pkm(path) elif suffix == '.png': pixmap.save_pixmap_as_png(path) elif suffix == '.pnm': pixmap.save_pixmap_as_pnm(path) elif suffix == '.ppm': pixmap.save_pixmap_as_ppm(path) elif suffix == '.ps': pixmap.save_pixmap_as_ps(path, append=0) elif suffix == '.psd': pixmap.save_pixmap_as_psd(path) elif suffix == '.pwg': pixmap.save_pixmap_as_pwg(path, append=0, pwg=mupdf.PwgOptions()) else: raise Exception(f'Unrecognised output format: {path}') save_pixmap(output) hit_quads = page.search_page(needle, max=16) print(f'search text {needle!r} found {len(hit_quads)} on the page') for hit_quad in hit_quads: pixmap.invert_pixmap_rect(hit_quad.rect_from_quad().irect_from_rect()) save_pixmap(f'dl-{output}') | |||||||
Added: | ||||||||
> > | print('finished') | |||||||
|
Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|
Auto-generated C++ and Python APIs for mupdf. | ||||||||
Line: 8 to 8 | ||||||||
C++ | ||||||||
Deleted: | ||||||||
< < |
| |||||||
| ||||||||
Added: | ||||||||
> > |
| |||||||
Python
| ||||||||
Changed: | ||||||||
< < |
| |||||||
> > |
| |||||||
General
|
Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|
Auto-generated C++ and Python APIs for mupdf.Status | ||||||||
Changed: | ||||||||
< < | As of 2020-5-4: | |||||||
> > | As of 2020-5-11: | |||||||
C++
| ||||||||
Changed: | ||||||||
< < |
| |||||||
> > |
| |||||||
| ||||||||
Changed: | ||||||||
< < |
| |||||||
> > |
| |||||||
Python | ||||||||
Line: 32 to 32 | ||||||||
Comments | ||||||||
Changed: | ||||||||
< < |
| |||||||
> > |
| |||||||
Here are Doxygen html representations of the mupdf C API and the generated mupdf C++ API: | ||||||||
Changed: | ||||||||
< < | ||||||||
> > | ||||||||
And pydoc html representation of the generated mupdf.py API: | ||||||||
Changed: | ||||||||
< < | ||||||||
> > | ||||||||
mutool.py | ||||||||
Changed: | ||||||||
< < | mudpdf:scripts/mutool*.py are a Python re-implementation of the mutool application. They do not use threads, or the include/mupdf/pdf/ functionality. | |||||||
> > | mudpdf:scripts/mutool*.py are an incomplete Python re-implementation of the mutool application. | |||||||
Files | ||||||||
Line: 59 to 57 | ||||||||
Changed: | ||||||||
< < | Information about fz_*() fns that are not in the class-based API: | |||||||
> > | Information about fz_*() and pdf_*() fns that are not in the class-based API: | |||||||
Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
Changed: | ||||||||
< < | Auto-generated mupdf C++ wrappers | |||||||
> > | Auto-generated C++ and Python APIs for mupdf. | |||||||
Status | ||||||||
Changed: | ||||||||
< < | As of 2020-4-28: | |||||||
> > | As of 2020-5-4: | |||||||
Changed: | ||||||||
< < |
| |||||||
> > | C++
| |||||||
| ||||||||
Deleted: | ||||||||
< < |
| |||||||
| ||||||||
Changed: | ||||||||
< < |
| |||||||
> > |
Python
| |||||||
| ||||||||
Changed: | ||||||||
< < |
| |||||||
> > |
General
| |||||||
Comments | ||||||||
Line: 31 to 44 | ||||||||
Added: | ||||||||
> > |
mutool.pymudpdf:scripts/mutool*.py are a Python re-implementation of the mutool application. They do not use threads, or the include/mupdf/pdf/ functionality. | |||||||
FilesAuto-generated C++ headers and implementation files, plus test outputs (.html files have syntax-colouring): | ||||||||
Line: 48 to 69 | ||||||||
The generated Python module is tested by the (rather hacky) test_mupdfcpp_swig() function in mupdfwrap.py. For convenience, this function and its output can be viewed in https://ghostscript.com/~julian/mupdf/platform/python![]() | ||||||||
Deleted: | ||||||||
< < | In mupdfwrap.py:
| |||||||
Integration with mupdf git. | ||||||||
Deleted: | ||||||||
< < | In mupdf, have added various things: | |||||||
mupdf/ build/ | ||||||||
Changed: | ||||||||
< < | release-shared/ libmupdf.so [generated file] libmupdfcpp.so [generated file, implements C++ API] debug-shared/ | |||||||
> > | shared-release/ | |||||||
libmupdf.so [generated file] libmupdfcpp.so [generated file, implements C++ API] | ||||||||
Added: | ||||||||
> > | mupdf.py [generated file, implements Python API] _mupdf.so [generated file, implements Python API internals] shared-debug/ libmupdf.so libmupdfcpp.so [implements C++ API] mupdf.py [implements Python API] _mupdf.so [implements Python API internals] | |||||||
platform/ c++/ implementation/ | ||||||||
Line: 75 to 94 | ||||||||
mupdf/ *.h [generated files] python/ | ||||||||
Changed: | ||||||||
< < | mudf.py [generated file, implements Python API] _mupdf.so [generated file, implements Python API internals] | |||||||
> > | mupdfcpp_swig.cpp [generated by SWIG] mupdf_swig.i [generated by mupdfwraw.pynput to SWIG] | |||||||
scripts/ mupdfwrap.py jlib.py | ||||||||
Added: | ||||||||
> > | mutool.py mutool_draw.py | |||||||
Line: 98 to 119 | ||||||||
Changed: | ||||||||
< < | Have also added crude support for building mupdf as a shared object, which is required for integrating with the SWIG python module. At the moment, mupdfwrap.py drives this to build mupdf.so. | |||||||
> > | ||||||||
|
Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|
Auto-generated mupdf C++ wrappersStatus | ||||||||
Changed: | ||||||||
< < | As of 2020-4-24: | |||||||
> > | As of 2020-4-28: | |||||||
| ||||||||
Changed: | ||||||||
< < |
| |||||||
> > |
| |||||||
Comments | ||||||||
Line: 58 to 61 | ||||||||
mupdf/ build/ | ||||||||
Changed: | ||||||||
< < | shared/ | |||||||
> > | release-shared/ libmupdf.so [generated file] libmupdfcpp.so [generated file, implements C++ API] debug-shared/ | |||||||
libmupdf.so [generated file] libmupdfcpp.so [generated file, implements C++ API] platform/ c++/ | ||||||||
Deleted: | ||||||||
< < | Makefile | |||||||
implementation/ *.cpp [generated files] include/ mupdf/ *.h [generated files] python/ | ||||||||
Deleted: | ||||||||
< < | Makefile | |||||||
mudf.py [generated file, implements Python API] _mupdf.so [generated file, implements Python API internals] scripts/ | ||||||||
Line: 90 to 94 | ||||||||
cd mupdf/ | ||||||||
Changed: | ||||||||
< < | ./scripts/mupdf.py -b 0123 -t | |||||||
> > | ./scripts/mupdfwrap.py -b all -t | |||||||
Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|
Auto-generated mupdf C++ wrappers | ||||||||
Line: 19 to 19 | ||||||||
| ||||||||
Added: | ||||||||
> > | Here are Doxygen html representations of the mupdf C API and the generated mupdf C++ API: And pydoc html representation of the generated mupdf.py API: | |||||||
FilesAuto-generated C++ headers and implementation files, plus test outputs (.html files have syntax-colouring): |
Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|
Auto-generated mupdf C++ wrappers | ||||||||
Added: | ||||||||
> > | StatusAs of 2020-4-24:
Comments
Files | |||||||
Auto-generated C++ headers and implementation files, plus test outputs (.html files have syntax-colouring): | ||||||||
Added: | ||||||||
> > | Information about fz_*() fns that are not in the class-based API: | |||||||
These were generated by the mupdfwrap.py programme, which also runs g++ and SWIG to generate a Python module that gives a Python API: | ||||||||
Line: 57 to 80 | ||||||||
| ||||||||
Changed: | ||||||||
< < | cd mupdf/platform/python make make test | |||||||
> > | cd mupdf/ ./scripts/mupdf.py -b 0123 -t | |||||||
Deleted: | ||||||||
< < | The makefiles build things by running ../../scripts/mupdfwrap.py. | |||||||
Have also added crude support for building mupdf as a shared object, which is required for integrating with the SWIG python module. At the moment, mupdfwrap.py drives this to build mupdf.so. |
Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|
Auto-generated mupdf C++ wrappersAuto-generated C++ headers and implementation files, plus test outputs (.html files have syntax-colouring): | ||||||||
Changed: | ||||||||
< < | ||||||||
> > | ||||||||
These were generated by the mupdfwrap.py programme, which also runs g++ and SWIG to generate a Python module that gives a Python API: | ||||||||
Changed: | ||||||||
< < | ||||||||
> > | ||||||||
Changed: | ||||||||
< < | The generated Python module is tested by the (rather hacky) test_mupdfcpp_swig() function in mupdfwrap.py. For convenience, this function and its output can be viewed separately: | |||||||
> > | The generated Python module is tested by the (rather hacky) test_mupdfcpp_swig() function in mupdfwrap.py. For convenience, this function and its output can be viewed in https://ghostscript.com/~julian/mupdf/platform/python![]() | |||||||
In mupdfwrap.py:
| ||||||||
Deleted: | ||||||||
< < | The files linked to above are updated periodically (e.g. every 1-2 days), so don't pay particular attention to the date stamp below, which is for this twiki page alone. | |||||||
Integration with mupdf git. | ||||||||
Line: 44 to 41 | ||||||||
Makefile mudf.py [generated file, implements Python API] _mupdf.so [generated file, implements Python API internals] | ||||||||
Added: | ||||||||
> > | scripts/ mupdfwrap.py jlib.py | |||||||
See: | ||||||||
Deleted: | ||||||||
< < | ||||||||
Changed: | ||||||||
< < | To build, ensure that julian-tools is checked out next to mupdf, then: | |||||||
> > | To build: | |||||||
| ||||||||
Line: 63 to 63 | ||||||||
Changed: | ||||||||
< < | The makefiles build things by running ../../../julian-tools/mupdfwrap.py. | |||||||
> > | The makefiles build things by running ../../scripts/mupdfwrap.py. | |||||||
Have also added crude support for building mupdf as a shared object, which is required for integrating with the SWIG python module. At the moment, |
Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|
Auto-generated mupdf C++ wrappers | ||||||||
Line: 21 to 21 | ||||||||
The files linked to above are updated periodically (e.g. every 1-2 days), so don't pay particular attention to the date stamp below, which is for this twiki page alone. | ||||||||
Added: | ||||||||
> > | Integration with mupdf git. | |||||||
Changed: | ||||||||
< < | mutool.py | |||||||
> > | In mupdf, have added various things: | |||||||
Changed: | ||||||||
< < | Python implementation of mutool. As of 2020-4-3, this implements "trace", "convert" and "draw" sub-commands. It will have lots of bugs, but works in a few simple tests. | |||||||
> > |
mupdf/ build/ shared/ libmupdf.so [generated file] libmupdfcpp.so [generated file, implements C++ API] platform/ c++/ Makefile implementation/ *.cpp [generated files] include/ mupdf/ *.h [generated files] python/ Makefile mudf.py [generated file, implements Python API] _mupdf.so [generated file, implements Python API internals] | |||||||
See: | ||||||||
Changed: | ||||||||
< < | ||||||||
> > |
cd mupdf/platform/python make make testThe makefiles build things by running ../../../julian-tools/mupdfwrap.py. Have also added crude support for building mupdf as a shared object, which is required for integrating with the SWIG python module. At the moment, mupdfwrap.py drives this to build mupdf.so. | |||||||
-- ![]() |
Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|
Auto-generated mupdf C++ wrappers | ||||||||
Line: 24 to 24 | ||||||||
mutool.py | ||||||||
Changed: | ||||||||
< < | Python implementation of mutool. as of 2020-4-1, this only implements some of the "trace" sub-command. See: | |||||||
> > | Python implementation of mutool. | |||||||
Changed: | ||||||||
< < | * https://git.ghostscript.com/?p=user/julian/julian-tools.git;a=blob;f=mutool.py;hb=HEAD![]() | |||||||
> > | As of 2020-4-3, this implements "trace", "convert" and "draw" sub-commands. It will have lots of bugs, but works in a few simple tests. See: | |||||||
Added: | ||||||||
> > | ||||||||
-- ![]() |
Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|
Auto-generated mupdf C++ wrappers | ||||||||
Line: 22 to 22 | ||||||||
The files linked to above are updated periodically (e.g. every 1-2 days), so don't pay particular attention to the date stamp below, which is for this twiki page alone. | ||||||||
Added: | ||||||||
> > | mutool.pyPython implementation of mutool. as of 2020-4-1, this only implements some of the "trace" sub-command. See: * https://git.ghostscript.com/?p=user/julian/julian-tools.git;a=blob;f=mutool.py;hb=HEAD![]() | |||||||
-- ![]() Comments |
Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|
Auto-generated mupdf C++ wrappers | ||||||||
Line: 12 to 12 | ||||||||
The generated Python module is tested by the (rather hacky) test_mupdfcpp_swig() function in mupdfwrap.py. For convenience, this function and its output can be viewed separately: | ||||||||
Changed: | ||||||||
< < | ||||||||
> > | ||||||||
In mupdfwrap.py: |
Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|
Auto-generated mupdf C++ wrappers | ||||||||
Changed: | ||||||||
< < | Generated wrappers: | |||||||
> > | Auto-generated C++ headers and implementation files, plus test outputs (.html files have syntax-colouring): | |||||||
Deleted: | ||||||||
< < |
| |||||||
Changed: | ||||||||
< < | These were generated by: | |||||||
> > | These were generated by the mupdfwrap.py programme, which also runs g++ and SWIG to generate a Python module that gives a Python API: | |||||||
Added: | ||||||||
> > | The generated Python module is tested by the (rather hacky) test_mupdfcpp_swig() function in mupdfwrap.py. For convenience, this function and its output can be viewed separately: | |||||||
In mupdfwrap.py: | ||||||||
Deleted: | ||||||||
< < |
| |||||||
|
Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|
Auto-generated mupdf C++ wrappers | ||||||||
Line: 16 to 16 | ||||||||
| ||||||||
Added: | ||||||||
> > | The files linked to above are updated periodically (e.g. every 1-2 days), so don't pay particular attention to the date stamp below, which is for this twiki page alone. | |||||||
-- ![]() Comments |
Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|
Auto-generated mupdf C++ wrappersGenerated wrappers: | ||||||||
Changed: | ||||||||
< < |
| |||||||
> > |
| |||||||
These were generated by: | ||||||||
Changed: | ||||||||
< < | See test_mupdfcpp_swig() function for example python code that uses the generated API. | |||||||
> > | In mupdfwrap.py:
| |||||||
-- ![]() |
Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|
Auto-generated mupdf C++ wrappersGenerated wrappers: | ||||||||
Added: | ||||||||
> > |
| |||||||
These were generated by: | ||||||||
Added: | ||||||||
> > | See test_mupdfcpp_swig() function for example python code that uses the generated API. | |||||||
-- ![]() |
Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|
Auto-generated mupdf C++ wrappers | ||||||||
Line: 8 to 8 | ||||||||
These were generated by: | ||||||||
Changed: | ||||||||
< < | ||||||||
> > | ||||||||
Deleted: | ||||||||
< < | Also this (very hacky at moment) script uses SWIG to generate python version of C++ API: | |||||||
-- ![]() |
Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|
Auto-generated mupdf C++ wrappers | ||||||||
Line: 10 to 10 | ||||||||
Added: | ||||||||
> > | Also this (very hacky at moment) script uses SWIG to generate python version of C++ API: | |||||||
Added: | ||||||||
> > | ||||||||
-- ![]() |
Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|
Auto-generated mupdf C++ wrappers | ||||||||
Changed: | ||||||||
< < | Article text. | |||||||
> > | Generated wrappers: | |||||||
Changed: | ||||||||
< < | Standard wrappers: Using class template for exceptions: | |||||||
> > | ||||||||
These were generated by: |
Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|
Added: | ||||||||
> > |
Auto-generated mupdf C++ wrappersArticle text. Standard wrappers: Using class template for exceptions:
![]() Comments |