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
5.2k stars 498 forks source link

Missig integer values for PDF_OC_* #3665

Closed saper-2 closed 2 months ago

saper-2 commented 2 months ago

Description of the bug

In doc there is no information what values have constant PDF_OC_ON , PDF_OC_TOGGLE , PDF_OC_OFF

https://github.com/pymupdf/PyMuPDF/blob/a83732bddc288acece9755e6c3d7dff28adb2e9a/docs/document.rst?plain=1#L449

This also apply for other ports of MuPDF (e.g.: MuPDF.NET)

How to reproduce the bug

Missig doc information.

PyMuPDF version

1.24.7

Operating system

Other

Python version

3.12

julian-smith-artifex-com commented 2 months ago

It's common practice to not document numerical values for these sort of constants, to encourage users to use the named constants instead of obscure numbers in their code.

The values can be found trivially with some Python:

import pymupdf
print(f'{pymupdf.PDF_OC_TOGGLE=}')
saper-2 commented 2 months ago

Initially, Ive been writing code in .net , and I used both net and python docs of MuPDF , so I noticed this. Since I was mainly using net I didn't even had a thought to 'search in pymupdf code' for those constant values. 🙃

But it'd be nice to update docs by this info.