pymupdf / PyMuPDF

PyMuPDF is a high performance Python library for data extraction, analysis, conversion & manipulation of PDF (and other) documents.
https://pymupdf.readthedocs.io
GNU Affero General Public License v3.0
4.49k stars 443 forks source link

API documentation for the `open` function is not obvious to find. #3636

Open tovrstra opened 3 days ago

tovrstra commented 3 days ago

Is your feature request related to a problem? Please describe.

No, just a suggestion to improve the documentation.

Describe the solution you'd like

The following pages describe the basics of the open function:

https://pymupdf.readthedocs.io/en/latest/how-to-open-a-file.html#howtoopenafile

It makes no reference to the API documentation of this function, and It is also not obvious (until one starts reading the source code) that it is a shorthand for the Document.__init__ constructor.

For completeness, this can be explained with a link to the documentation of the constructor. That will make it easier for the user to delve into the details when they like to.

Describe alternatives you've considered

Reading the source code.

Additional context

None

JorjMcKie commented 2 days ago

Thanks for submitting this. Let me see if I understood you correctly. Here is what I did:

  1. Enter "open" in the RTD search field.
  2. Response is a page titled "Opening Files".
  3. After an overview of files that PyMuPDF can open, we see a section titled "How to Open a File" with appropriate instructions.

What you seem to suggest is an additional comment along the lines: "Open is a synonym for creating a Document object. For a complete API documentation see ...".

About correct?

tovrstra commented 2 days ago

Yes, that would have been helpful. I was looking for all possible optional arguments of open(...), which are not so easy to find now, unless you know to that this info can be found in the Document.__init__ documentation.

JorjMcKie commented 2 days ago

Yes, that would have been helpful. I was looking for all possible optional arguments of open(...), which are not so easy to find now, unless you know to that this info can be found in the Document.__init__ documentation.

No, it suffices to know that pymupdf.open = pymupdf.Document. Then the documentation and help(pymupdf.Document) as well as help(pymupdf.open) tells you all you need.