Page 1 of 1

Crop tool not remove every outside of box

Posted: Mon Jun 28, 2021 2:46 pm
by lidds
I am using the croppage tool to crop a page and my code below. This code works, but since upgrading to 354 it crops the area, but does not remove every element on the page outside of the cropbox region (see images below, showing this in the FullDemo project). Any help would really appreciated, even a work around if it's an issue in the build?

Code: Select all

	Dim nID As Integer = Me.docPreview.Inst.Str2ID("op.document.cropPages", False)
            Dim Op As PDFXEdit.IOperation = Me.docPreview.Inst.CreateOp(nID)
            Dim input As PDFXEdit.ICabNode = Op.Params.Root("Input")
            input.v = Me.docPreview.Doc.CoreDoc
            Dim options As PDFXEdit.ICabNode = Op.Params.Root("Options")
            options("Flags").v = 514
            options("IsOffset").v = False
            options("CropBox.top").v = top
            options("CropBox.left").v = left
            options("CropBox.right").v = right
            options("CropBox.bottom").v = bottom
            Op.Do()
As you can see below it crops the area OK and looks like it has done it properly.
Cropped page.jpg
However if you resize the paper size you can see there are lots of elements from the original document that have not been removed.
Cropped page - resized.jpg
Thanks

Simon

Re: Crop tool not remove every outside of box

Posted: Tue Jun 29, 2021 8:24 am
by Sasha - PDF-XChange
Hello lidds,

Just tried your code - everything worked correctly on the latest version (showing you a Crop Pages dialog to see the results):
image.png
Also, here's the same result with comments on the page:
image1.png
Probably the behavior that you are experiencing is due to that we have added some new flags (and the things that you see on the page are the comments) - updated the Wiki Page:
https://sdkhelp.pdf-xchange.com/vi ... ions_Table

Cheers,

Re: Crop tool not remove every outside of box

Posted: Tue Jun 29, 2021 9:40 pm
by lidds
Hi,

I think the reason why it is working for you is that you are not cropping an actual PDF with graphical data on it, but a blank document with annots.

I can confirm that the surplus elements that remain are not annots, but actually original PDF graphical elements.

I have emailed to your support email a copy of the document so you can test on your side as the document is confidential.

Thanks

Simon

Re: Crop tool not remove every outside of box

Posted: Wed Jun 30, 2021 7:34 am
by Sasha - PDF-XChange
Hello lidds,

Thanks for the file - found the problem.
The items that you are seeing overlap with the crop area rectangle, thus they are left - that is OK. But what is wrong here is that the clip rectangle is not being applied correctly - thus you can see those leftovers. I will forward this to the responsible developer.

Cheers,
Alex

Re: Crop tool not remove every outside of box

Posted: Wed Jun 30, 2021 8:24 am
by lidds
Hi Alex,

Glad that you can reproduce the error as that is normally half the battle when developing products, as we all know.

This is quite urgent from my side as the crop tool is used a lot in my product, so if your developer has some code as a work around until incorporated into your next release then I would be happy with that. As you can see from my supplied code I already have the cropbox region info.

Thanks

Simon

Re: Crop tool not remove every outside of box

Posted: Thu Jul 01, 2021 2:36 pm
by Sasha - PDF-XChange
Hello lidds,

Hopefully we've made a fix and will include this in the next release if all goes well.

Cheers,
Alex

Re: Crop tool not remove every outside of box

Posted: Thu Jul 01, 2021 3:10 pm
by lidds
Thanks for the update Alex, however I would imagine it will be weeks for an update, which is understandable.

As I said previously is there a way using current API features that I could remove elements outside the crop region as a temporary fix. Even if it means looping through pdf elements and comparing if the position is within the crop box bounds?

Thanks

Simon

Re: Crop tool not remove every outside of box

Posted: Fri Jul 02, 2021 7:30 am
by Sasha - PDF-XChange
Hello lidds,

Well not weeks - we are planning to launch the release on 12 of July if all goes well.

Cheers,
Alex