Resize Page

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

Resize Page

Post by lidds »

Is there a way that I can achieve the "Resize Pages" functionality via code, but pass a paper size and orientation e.g. 297 x 420 Landscape?

Basically to achieve the same thing that the "Resize Pages" form does, as shown below:
ResizePage.png
Thanks

Simon
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Resize Page

Post by Sasha - Tracker Dev Team »

Hello Simon,

Of course. You will have to use this operation and modify it's Options to your liking:
https://sdkhelp.pdf-xchange.com/vi ... esizePages

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

Re: Resize Page

Post by lidds »

Thanks Alex,

I am using the below code to resize my page. However I have found something a bit strange. If I use a standard page size e.g. A3 which is StdPaperIndex 3 it all works fine. However if I specify a custom paper size e.g. W = 419.9 H = 269.9 the code works but sets the paper size to W = 148.1 H = 95.2 which is a bit strange, am I doing something wrong?

Code: Select all

	nID = Inst.Str2ID("op.document.resizePages", False)
        Op = Inst.CreateOp(nID)
        input = Op.Params.Root("Input")
        input.v = Me.docPreview.Doc.CoreDoc
        options = Op.Params.Root("Options")
        options("PaperType").v = 2
        options("Width").v = 419.9
        options("Height").v = 269.9
        'options("PaperType").v = 1
        'options("StdPaperIndex").v = 3
        'options("Landscape").v = True
        Op.Do()
Thanks

Simon
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Resize Page

Post by Sasha - Tracker Dev Team »

Hello Simon,

To use Custom values, you will have to specify Custom PaperType value.

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

Re: Resize Page

Post by lidds »

Alex,

I am specifying the PaperType value to 2 which is custom, see code in original post. Please note the standard PaperType code is commented out.

Thanks

Simon
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Resize Page

Post by Sasha - Tracker Dev Team »

Hello Simon,

Well, if you look carefully, the input parameters are in points, and I suspect that the current unit in your application is millimeters.

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

Re: Resize Page

Post by lidds »

Alex,

You are absolutely correct, sorry my error. However now another question, is there a way to get the page size in points, or a way to convert a page size from mm to points?

Thanks

Simon
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Resize Page

Post by Sasha - Tracker Dev Team »

Hello Simon,

If you get page size from the IPXC_Page's rectangle - it's always in points.

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

Re: Resize Page

Post by lidds »

Thanks Alex, and also googled and you can multiply points by 2.835 to get to millimetres.

Thanks

Simon
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Resize Page

Post by Sasha - Tracker Dev Team »

:)
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Post Reply