Q: I am using PDFNet to edit PDF content streams and now I would like
to edit Form XObjects instead of flattening them in a single content
I want to simply change the color values in the content stream. How
can I access content stream data to edit it? I have the following
object which I need to edit:
799 0 obj
<</BBox [325.32 535.227 516.48 457.467]/Filter /FlateDecode/Group 38 0
R/Length 65/Matrix [1 0 0 1 0 0]/Resources <</ColorSpace <</CS1 8 0
/ExtGState <</GS1 798 0 R>>/ProcSet [/PDF /Text /ImageB /ImageC
325.32 535.227 191.16 -77.76 re
I basically want to switch the colorspace to point to a DeviceCMYK
space, and switch the "1 scn" with "1 0 0 0 k".
I am having to do it this way since these are Group XObjects in Form
XObjects, and if I attempt to flatten the form's content stream right
into the page's content stream directly, I lose all the transparency
Do you have any ideas?
A: You can use another ElementWriter and replace the content using
This way you can edit form xobject directly without flattening it with
the page content stream.