You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PDF Outline Items can have an RGB color encoding and be bold and/or italicized. This information cannot be get / set via the OutlineItem interface and should be added as one of the properties of this object, so that it can be read via document.loadOutline(); and outlineIterator.item();. and written via outlineIterator.insert(item); and outlineIterator.update(item);.
I understand that this information can already be retrieved or set via Object access, using the C and F entries of the corresponding pdf object, but this is more complex than it should be. I have implemented my own solution in this gist: https://gist.github.com/HeimMatthias/f628b8dd2ed9062e72cea544fffb3f40
Because my script's creates an Outline-Iterator and traverses the entire outline-tree every time to access the outline-item's corresponding object, however, it tends to fail with many complex documents. But this method works fine without the abstraction (i.e. if I follow the outline-objects from the trailer while parsing the outline).
The text was updated successfully, but these errors were encountered:
@HeimMatthias Thanks for this - this looks really interesting! I'm going to test the functionality in the gist you supplied and get back to you. If all good I think we could then hopefully integrate this formally via a PR. :)
PDF Outline Items can have an RGB color encoding and be bold and/or italicized. This information cannot be get / set via the OutlineItem interface and should be added as one of the properties of this object, so that it can be read via
document.loadOutline();
andoutlineIterator.item();
. and written viaoutlineIterator.insert(item);
andoutlineIterator.update(item);
.I propose to keep the new interface properties as close to the Adobe implementation as possible, so
.color
(https://opensource.adobe.com/dc-acrobat-sdk-docs/library/jsapiref/JS_API_AcroJS.html#color), would be a color array with the color space before it. But I understand that MuPDF handles colors differently, and the implementation might have to mirror that behaviour (https://mupdfjs.readthedocs.io/en/latest/glossary/index.html#colors) (though accessing outline items is usually device-independent, so I'm not sure how that would work in practice). For all intents and purposes an RGB-implementation would suffice, since the PDF-standard (PDF32000_2008, p. 369) only allows DeviceRGB anyway, but the length of the color-array itself could be used to define the color space..style
, where "0 is normal, 1 is italic, 2 is bold, and 3 is bold-italic" (https://opensource.adobe.com/dc-acrobat-sdk-docs/library/jsapiref/JS_API_AcroJS.html#id247)I understand that this information can already be retrieved or set via Object access, using the C and F entries of the corresponding pdf object, but this is more complex than it should be. I have implemented my own solution in this gist: https://gist.github.com/HeimMatthias/f628b8dd2ed9062e72cea544fffb3f40
Because my script's creates an Outline-Iterator and traverses the entire outline-tree every time to access the outline-item's corresponding object, however, it tends to fail with many complex documents. But this method works fine without the abstraction (i.e. if I follow the outline-objects from the trailer while parsing the outline).
The text was updated successfully, but these errors were encountered: