How do I delete an image from a PDF page?

83 views
Skip to first unread message

Support

unread,
Nov 12, 2010, 4:59:53 PM11/12/10
to PDFTron PDFNet SDK
Q: How do I delete an image from a PDF page using PDFTron PDFNet?

----------------------
A: There are couple of options:

a) Use ElementReader & ElementWriter as shown in ElementEdit sample
(http://www.pdftron.com/pdfnet/samplecode.html#ElementEdit)

b) Swap the image with an empty form xobject.

You can create empty as follows:

ElementWriter w = ElementWriter();
w.Begin(doc);
Obj xobj = w.End();


Then you can replace the existing image with the empty form using
sdfdoc.Swap(...). For example:

doc.GetSDFDoc().Swap(image_element.GetXObject().GetObjNum(),
xobj.GetObjNum());

The replaced images will be removed from the document duing doc.Save()
in 'remove-unused' or 'linearization' mode.
Reply all
Reply to author
Forward
0 new messages