py-pdf / pypdf

A pure-python PDF library capable of splitting, merging, cropping, and transforming the pages of PDF files
https://pypdf.readthedocs.io/en/latest/
Other
8.26k stars 1.4k forks source link

Allow Annotations to have different formats #2305

Open Fellow-Bennse opened 11 months ago

Fellow-Bennse commented 11 months ago

Explanation

(on FreeText) Right now, the /DS and /DA created from pypdf looks something like: '/DA': '0.9333333333333333 0.9333333333333333 0.9333333333333333 rg' '/DS': 'font: Helvetica 44pt5pt;text-align:left;color:#0000f5'

The "Problem" is, that many Browsers/Programs have struggles reading this specific format. From what I tested (and seen from programs/browser-addons), a (so called) Stream-Format seems to be a more "universal" format to be used. Also, it does not use /DS at all. Example: '/DA': '/Helv 10.5 Tf 0 Tc 11.76 TL 0 0.470588 0.831373 rg '

Would be cool if there could be some "Format-Change" or Converter added to pypdf.

ssjkamei commented 3 weeks ago

/DS is addressed in #2893.

I think the read compatibility is a bug or no bug issue, and the format change is a functionality issue. I think the ability to change the internal format is out of the pypdf.

It looks like this one can be closed unless you decide you need the ability to change the internal format.