How to remove content from a PDF page (e.g when splitting the page) ?


I have a pdf file in which I need to split each page into 2 pages. I
am able to do this
using the following code:

                    crop_box = curPage.GetCropBox();
                    crop_box.x1 = (crop_box.x2 / 2) - 300;
                    _new_doc = new PDFDoc();

                    _new_doc.Save("right.pdf", 0);

My problem is that this seems to keep all the elements and such the
size remains the same. Can you help direct me on how to do a crop that
removes all content that I crop via the crop box?

Modifying the crop box does not affect the page content. So, after
cropping, page content is there, even though it is not visible.

If you need to remove all invisible content this can be done by
copying page Elements, one by one, to a new page. If the element
bounding box (element.GetBBox()) is outside of crop rectangle than you
can skip writing the element to the destination page. For relevant
code samples you may want to check ElementEdit & TextExtract sample
projects (these are located in Samples folder).