Crop tool not remove every outside of box

PDF-XChange Editor SDK for Developers

Moderators: TrackerSupp-Daniel, Tracker Support, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan

Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.

When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
Post Reply
lidds
User
Posts: 510
Joined: Sat May 16, 2009 1:55 pm

Crop tool not remove every outside of box

Post 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
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Crop tool not remove every outside of box

Post by Sasha - Tracker Dev Team »

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,
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
lidds
User
Posts: 510
Joined: Sat May 16, 2009 1:55 pm

Re: Crop tool not remove every outside of box

Post 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
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Crop tool not remove every outside of box

Post by Sasha - Tracker Dev Team »

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
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
lidds
User
Posts: 510
Joined: Sat May 16, 2009 1:55 pm

Re: Crop tool not remove every outside of box

Post 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
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Crop tool not remove every outside of box

Post by Sasha - Tracker Dev Team »

Hello lidds,

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

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
lidds
User
Posts: 510
Joined: Sat May 16, 2009 1:55 pm

Re: Crop tool not remove every outside of box

Post 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
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Crop tool not remove every outside of box

Post by Sasha - Tracker Dev Team »

Hello lidds,

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

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Post Reply