gettalong / hexapdf

Versatile PDF creation and manipulation for Ruby
https://hexapdf.gettalong.org
Other
1.25k stars 70 forks source link

Adding DSS Streams #339

Closed cw6365 closed 3 weeks ago

cw6365 commented 3 weeks ago

@gettalong how would i got about adding certificate streams in a DSS store like below?

Screenshot 2024-11-08 at 17 24 14

I have a DER encoded object of the streams i want to insert. Do i use the HexaPDF::Stream | HexaPDF::StreamData ? Do you have any examples of how i would create these please?

gettalong commented 3 weeks ago

Best way would be to use HexaPDF::Document#add, like this: obj = doc.add({}, stream: data_as_string).

You would use a StreamData object if the data is not already stored in a string but in an IO or a file, see https://hexapdf.gettalong.org/documentation/api/HexaPDF/StreamData.html, e.g. obj = doc.add({}, stream: HexaPDF::StreamData.new(filename)).