|
1 | 1 |
|
2 | 2 | .. include:: ../header.rst |
3 | 3 |
|
4 | | -.. include:: pymupdf-pro.rst |
| 4 | + |
| 5 | +.. _pymupdf-pro |
| 6 | +
|
| 7 | +PyMuPDF Pro |
| 8 | +============= |
| 9 | + |
| 10 | + |
| 11 | +|PyMuPDF Pro| is a set of *commercial extensions* for |PyMuPDF|. |
| 12 | + |
| 13 | +Enhance |PyMuPDF| capability with **Office** document support & **RAG/LLM** integrations. |
| 14 | + |
| 15 | +- Enables Office document handling, including ``doc``, ``docx``, ``hwp``, ``hwpx``, ``ppt``, ``pptx``, ``xls``, ``xlsx``, and others. |
| 16 | +- Supports text and table extraction, document conversion and more. |
| 17 | +- Includes the commercial version of |PyMuPDF4LLM|. |
| 18 | + |
| 19 | +To enquire about obtaining a commercial license, then `use this contact page <https://artifex.com/contact/>`_. |
| 20 | + |
| 21 | + |
| 22 | +.. note:: |
| 23 | + |
| 24 | + A licensed version of |PyMuPDF Pro| also gives you a licensed version of |PyMuPDF4LLM|. If you are interested in using the |PyMuPDF4LLM| package you should install it separately. |
| 25 | + |
| 26 | + |
| 27 | +Platform support |
| 28 | +-------------------- |
| 29 | + |
| 30 | +Available for these platforms only: |
| 31 | + |
| 32 | +- Windows x86_64. |
| 33 | +- Linux x86_64 (glibc). |
| 34 | +- MacOS x86_64. |
| 35 | +- MacOS arm64. |
| 36 | + |
| 37 | + |
| 38 | +Office file support |
| 39 | +---------------------- |
| 40 | + |
| 41 | +In addition to the `standard file types supported by PyMuPDF <Supported_File_Types>`, |PyMuPDF Pro| supports: |
| 42 | + |
| 43 | +.. list-table:: |
| 44 | + :header-rows: 1 |
| 45 | + |
| 46 | + * - **DOC/DOCX** |
| 47 | + - **XLS/XLSX** |
| 48 | + - **PPT/PPTX** |
| 49 | + - **HWP/HWPX** |
| 50 | + * - .. image:: ../images/icons/icon-docx.svg |
| 51 | + :width: 40 |
| 52 | + :height: 40 |
| 53 | + - .. image:: ../images/icons/icon-xlsx.svg |
| 54 | + :width: 40 |
| 55 | + :height: 40 |
| 56 | + - .. image:: ../images/icons/icon-pptx.svg |
| 57 | + :width: 40 |
| 58 | + :height: 40 |
| 59 | + - .. image:: ../images/icons/icon-hangul.svg |
| 60 | + :width: 40 |
| 61 | + :height: 40 |
| 62 | + |
| 63 | + |
| 64 | + |
| 65 | +Usage |
| 66 | +-------------- |
| 67 | + |
| 68 | +Installation |
| 69 | +~~~~~~~~~~~~~~~~~~ |
| 70 | + |
| 71 | +Install via pip with: |
| 72 | + |
| 73 | +.. code-block:: bash |
| 74 | +
|
| 75 | + pip install pymupdfpro |
| 76 | +
|
| 77 | +
|
| 78 | +Loading an **Office** document |
| 79 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 80 | + |
| 81 | +Import |PyMuPDF Pro| and you can then reference **Office** documents directly, e.g.: |
| 82 | + |
| 83 | +.. code-block:: python |
| 84 | +
|
| 85 | + import pymupdf.pro |
| 86 | + pymupdf.pro.unlock() |
| 87 | + # PyMuPDF has now been extended with PyMuPDF Pro features, with some restrictions. |
| 88 | + doc = pymupdf.open("my-office-doc.xls") |
| 89 | +
|
| 90 | +.. note:: |
| 91 | + |
| 92 | + All standard |PyMuPDF| functionality is exposed as expected - |PyMuPDF Pro| handles the extended **Office** file types |
| 93 | + |
| 94 | + |
| 95 | +From then on you can work with document pages just as you would do normally, but with respect to the `restrictions <PyMuPDFPro_Restrictions>`. |
| 96 | + |
| 97 | + |
| 98 | +Converting an **Office** document to |PDF| |
| 99 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 100 | + |
| 101 | +The following code snippet can convert your **Office** document to |PDF| format: |
| 102 | + |
| 103 | +.. code-block:: python |
| 104 | +
|
| 105 | + import pymupdf.pro |
| 106 | + pymupdf.pro.unlock() |
| 107 | +
|
| 108 | + doc = pymupdf.open("my-office-doc.xlsx") |
| 109 | +
|
| 110 | + pdfdata = doc.convert_to_pdf() |
| 111 | + with open('output.pdf', 'wb') as f: |
| 112 | + f.write(pdfdata) |
| 113 | +
|
| 114 | +
|
| 115 | +
|
| 116 | +.. _PyMuPDFPro_Restrictions: |
| 117 | + |
| 118 | +Restrictions |
| 119 | +~~~~~~~~~~~~~~~~~~~~ |
| 120 | + |
| 121 | + |
| 122 | +|PyMuPDF Pro| functionality is restricted without a license key as follows: |
| 123 | + |
| 124 | + **Only the first 3 pages of any document will be available.** |
| 125 | + |
| 126 | +To unlock full functionality you should `obtain a trial key <https://pymupdf.pro/try-pro/>`_. |
| 127 | + |
| 128 | + |
| 129 | +.. _PyMuPDFPro_TrialKeys: |
| 130 | + |
| 131 | +Trial keys |
| 132 | +----------------------- |
| 133 | + |
| 134 | +To obtain a license key `please fill out the form on this page <https://pymupdf.pro/try-pro/>`_. You will then have the trial key emailled to the address you submitted. |
| 135 | + |
| 136 | + |
| 137 | +Using a key |
| 138 | +~~~~~~~~~~~~~~~~ |
| 139 | + |
| 140 | + |
| 141 | +Initialize |PyMuPDF Pro| with a key as follows: |
| 142 | + |
| 143 | +.. code-block:: python |
| 144 | +
|
| 145 | + import pymupdf.pro |
| 146 | + pymupdf.pro.unlock(my_key) |
| 147 | + # PyMuPDF has now been extended with PyMuPDF Pro features. |
| 148 | +
|
| 149 | +This will allow you to evaluate the product for a limited time. If you want to use |PyMuPDF Pro| after this time you should then `enquire about obtaining a commercial license <https://artifex.com/products/pymupdf-pro/>`_. |
| 150 | + |
| 151 | + |
| 152 | +Fonts |
| 153 | +----------------------- |
| 154 | + |
| 155 | +By default `pymupdf.pro.unlock()` searches for all installed font directories. |
| 156 | + |
| 157 | +This can be controlled with keyword-only args: |
| 158 | + |
| 159 | +* `fontpath`: specific font directories, either as a list/tuple or `os.sep`-separated string. |
| 160 | + If None (the default), we use `os.environ['PYMUPDFPRO_FONT_PATH']` if set. |
| 161 | +* `fontpath_auto`: Whether to append system font directories. |
| 162 | + If None (the default) we use true if `os.environ['PYMUPDFPRO_FONT_PATH_AUTO']` is '1'. |
| 163 | + If true we append all system font directories. |
| 164 | + |
| 165 | +Function `pymupdf.pro.get_fontpath()` returns a tuple of all font directories used by `unlock()`. |
| 166 | + |
| 167 | + |
| 168 | +.. raw:: html |
| 169 | + |
| 170 | + <button id="findOutAboutPyMuPDFPro" class="cta orange" onclick="window.location='https://pymupdf.pro/try-pro/?utm_source=rtd-pymupdf&utm_medium=rtd&utm_content=cta-button'">Ready to try PyMuPDF Pro?</button> |
| 171 | + |
| 172 | + |
5 | 173 |
|
6 | 174 | .. include:: ../footer.rst |
0 commit comments