difficult to copy elements of some spot color

57 views
Skip to first unread message

jeferson flamini

unread,
Jul 4, 2014, 11:14:56 PM7/4/14
to pdfne...@googlegroups.com
Hi, i have a page that i would like to remove all elements that are not of some colorspace. This works very well to documents with mediabox = cropbox, but when they are different, the content of e_form is moved. I would like to maintan elements on original position.

The code to handle e_form is the same of ElementEdit

case Element.e_form: {
writer.writeElement(element); // write Form XObject reference to current stream
Obj form_obj = element.getXObject();
if (!visited.contains((int) form_obj.getObjNum())) // if this XObject has not been processed
{
// recursively process the Form XObject
visited.add((int) form_obj.getObjNum());
ElementWriter new_writer = new ElementWriter();
reader.formBegin();
new_writer.begin(form_obj);
doIt(type, reader, new_writer);
new_writer.end();
reader.end();
}


Any tip will be appreciated. Thanks in advance.

Jef

Aaron

unread,
Jul 7, 2014, 4:10:22 PM7/7/14
to pdfne...@googlegroups.com
Hello Jef,

It sounds like there may be some entries in the Form Xobject you may need to copy over.  Please see the following for more details:

https://groups.google.com/d/msg/pdfnet-sdk/t0xlC27i10Q/xdJLPXUakLoJ

Support

unread,
Jul 15, 2014, 1:01:16 PM7/15/14
to pdfne...@googlegroups.com

The above code (based on current ElementEdit sample) should keep BBox, Matrix, and other XObject entries intact, so it is unclear where is the problem.

One thing to keep in mind is that if the crop box is not the same as media box your page origin may not be 0,0. You could use GetDefaultMatrix (
https://groups.google.com/forum/#!searchin/pdfnet-sdk/GetDefaultMatrix) to transform points back and forth between cropped and rotated color space.

But again since it seems you are not directly testing for any intersections in is unclear where is the issue. If you could share a sample file along with a short code snippet we will take a further look.
Reply all
Reply to author
Forward
0 new messages