PyMuPDF icon indicating copy to clipboard operation
PyMuPDF copied to clipboard

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

Open tovrstra opened this issue 1 year ago • 3 comments

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

tovrstra avatar Jun 28 '24 09:06 tovrstra

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?

JorjMcKie avatar Jun 28 '24 11:06 JorjMcKie

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.

tovrstra avatar Jun 28 '24 14:06 tovrstra

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.

JorjMcKie avatar Jun 28 '24 14:06 JorjMcKie

Fixed in 1.24.8.