Zoomfaktor for OpenDocFromPath

PDF-XChange Editor SDK for Developers

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

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
AteBe
User
Posts: 55
Joined: Thu Dec 06, 2018 7:02 am

Zoomfaktor for OpenDocFromPath

Post by AteBe » Fri May 24, 2019 12:29 pm

Hello,
I use the function OpenDocFromPath to open a PDF.
When opening the file, the zoom factor always appears to be PXV_ZoomMode.PXV_ZoomMode_FitWidth.
Is there a way to pass another zoom factor (eg PXV_ZoomMode_FitPage).
Atebe

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

Re: Zoomfaktor for OpenDocFromPath

Post by Sasha - Tracker Dev Team » Fri May 24, 2019 12:36 pm

Hello AteBe,

You can use this property to set the zoom factor:
https://sdkhelp.tracker-software.com/vi ... l_ZoomMode

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

AteBe
User
Posts: 55
Joined: Thu Dec 06, 2018 7:02 am

Re: Zoomfaktor for OpenDocFromPath

Post by AteBe » Fri May 24, 2019 12:59 pm

Hello Alex,
I have already tried setting the zoommode after opening the pdf and it works.
However, the pdf is drawn again, which leads to a flickering.
Is there no way to specify the wanted zoommode when opening the PDF so that it does not have to be adjusted later?
AteBe

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

Re: Zoomfaktor for OpenDocFromPath

Post by Sasha - Tracker Dev Team » Fri May 24, 2019 1:03 pm

Hello AteBe,

You can use the https://sdkhelp.tracker-software.com/vi ... nDocParams method to create the ICab to use as the second parameter.
In it, you can specify the InitialDest value with needed Type https://sdkhelp.tracker-software.com/vi ... DestParams

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

AteBe
User
Posts: 55
Joined: Thu Dec 06, 2018 7:02 am

Re: Zoomfaktor for OpenDocFromPath

Post by AteBe » Fri May 24, 2019 1:19 pm

Hello Alex,
I already pass the CreateOpenDocParams parameter.
However, I do not know how to pass an object of type dt_Dictionary.
Can you send me a short example?
Thank you
AteBe

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

Re: Zoomfaktor for OpenDocFromPath

Post by Sasha - Tracker Dev Team » Fri May 24, 2019 1:39 pm

Hello AteBe,

A Dictionary is just a container. You can go directly to it's inner items by simply using "InitialDest.Type".

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

AteBe
User
Posts: 55
Joined: Thu Dec 06, 2018 7:02 am

Re: Zoomfaktor for OpenDocFromPath

Post by AteBe » Mon May 27, 2019 6:52 am

Hello Alex,
according to https://sdkhelp.tracker-software.com/vi ... DestParams I can specify the position of the document with the Parameter Type.
I tried all possible values ​​for the type according https://sdkhelp.tracker-software.com/vi ... FDestTypes (0-1), but there was no change in the zoom.
Do i have to set the paramter left, top, zoom, .... too? And if so, how?
AteBe
Last edited by AteBe on Mon May 27, 2019 7:24 am, edited 1 time in total.

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

Re: Zoomfaktor for OpenDocFromPath

Post by Sasha - Tracker Dev Team » Mon May 27, 2019 7:23 am

Hello AteBe,

This topic will prove useful:
viewtopic.php?f=66&t=26241&p=102175&hil ... on#p102175

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

AteBe
User
Posts: 55
Joined: Thu Dec 06, 2018 7:02 am

Re: Zoomfaktor for OpenDocFromPath

Post by AteBe » Mon May 27, 2019 9:14 am

Hello Alex,
Unfortunately, the topic you referred to does not describe what I need.
I want to specify the zoom factor directly for openDocument() and not adjust it later when the document is already opened.
I can do this via the setZoom() method. However, this method call will cause a redraw and flickering.

As described above, I tried to set the structure InitialDest.
However, it does not matter which type I set. It does not affect the zoom factor. It always uses PXV_ZoomMode.PXV_ZoomMode_FitWidth.

Code: Select all

ICabNode initialDest = openDocParams.Root (). SubNode (new VARIANT ("InitialDest"), CabDataTypeID.dt_Dictionary);
initialDest.SetInt ("Type", 2);
Do I have to set other values for InitialDest and if so, which ones and how can I set them?

AteBe

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

Re: Zoomfaktor for OpenDocFromPath

Post by Sasha - Tracker Dev Team » Mon May 27, 2019 9:20 am

Hello AteBe,

There values are same as of the GoTo action. To understand the parameters correctly, you will have to read the PDF Specification as mentioned in the topic I gave you. Then you will understand how all of these values are used together.

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

AnKeilha
User
Posts: 26
Joined: Fri Apr 27, 2018 11:17 am

Re: Zoomfaktor for OpenDocFromPath

Post by AnKeilha » Wed May 29, 2019 12:34 pm

Hello,
we have a good workaround for this. Directly before we open the pdf we can use

PagesView.DefaultZoom

to set the default zoom as a percentage or 0 for "Fit width". This way we do not really need to use opendocparams. We are still struggling to set "Fit page" as the default zoom.

Is there any way to set "Fit page" as the default zoom :?:

Regards,
AnKeilha

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

Re: Zoomfaktor for OpenDocFromPath

Post by Sasha - Tracker Dev Team » Wed May 29, 2019 2:37 pm

Hello AnKeilha,

Why don't just use the OpenDocParams, not a workaround? What exactly are you struggling with in the specification that you can't use these parameters to your needs?

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

AnKeilha
User
Posts: 26
Joined: Fri Apr 27, 2018 11:17 am

Re: Zoomfaktor for OpenDocFromPath

Post by AnKeilha » Fri May 31, 2019 6:35 am

Hello Alex,
so far nothing we tried had any effect whatsoever. We are still working on it though and will give you some feedback on Monday. Meanwhile I will put the thing about DefaultZoom in a different post as this would be interesting for us in any case (see viewtopic.php?f=66&t=32682#p133964 ).

Best regards,
AnKeilha

AteBe
User
Posts: 55
Joined: Thu Dec 06, 2018 7:02 am

Re: Zoomfaktor for OpenDocFromPath

Post by AteBe » Tue Jun 04, 2019 7:31 am

AteBe
I've tried to set the parameters for the OpenDocFromPath() function according to your preferences (CreateOpenDocParams).
None of the variants I tried had any affect on the layout.
In the code sample, I listed some of the variants.

Code: Select all

openDocParams = getInst().CreateOpenDocParams();
ICabNode initialDest = openDocParams.Root().Item(new VARIANT("InitialDest"));
// attempt 1
initialDest.SetInt("Type", 0);	// XYZ
initialDest.SetDouble("v2", 200);	// 200%
initialDest.SetInt("NullFlags", 2);	// use v2

// attempt 2
// initialDest.SetInt("Type", 0);	// XYZ
// initialDest.SetDouble("v0", 200);
// initialDest.SetDouble("v1", 200);
// initialDest.SetDouble("v2", 200);
// initialDest.SetDouble("v3", 200);
// initialDest.SetInt("NullFlags", 15);	// use all v

// attempt 3
// initialDest.SetInt("Type", 1);	// Fit
// initialDest.SetDouble("v0", 100);
// initialDest.SetDouble("v1", 100);
// initialDest.SetInt("NullFlags", 12);	// use v0 and v1

getCtrl().OpenDocFromPath(pFilePath.trim(), openDocParams);
Did I forgot to set a Parameter or did I set a parameter wrong?

AteBe

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

Re: Zoomfaktor for OpenDocFromPath

Post by Sasha - Tracker Dev Team » Tue Jun 04, 2019 7:36 am

Hello AteBe,

Specifying NullFlags as 2 will ignore v1 - that's why they are called Null Flags. For example, specifying 1 | 4 | 8 flags will tell the engine to use the v1 and to ignore rest of them. Specifying for example 2 | 4 will use v0 and v3 flags. All of the rest is how the specification describes it as these flags vary based on the Type of the destination.

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

AteBe
User
Posts: 55
Joined: Thu Dec 06, 2018 7:02 am

Re: Zoomfaktor for OpenDocFromPath

Post by AteBe » Tue Jun 04, 2019 10:54 am

Hello Alex,
Unfortunately, I have not found a description for which the values ​​in v0, v1, v2 and v3 are used.
Therefore, I suppose that v0 is the x-coordinate, v1 is the y-coordinate, and v2 is the zoom-value.
What v3 is used for is not clear to me.

According to your specifications I tried to set the zoom factor to 200% as follows

Code: Select all

	ICabNode initialDest = openDocParams.Root().Item(new VARIANT("InitialDest"));
	initialDest.SetInt("Type", 0);
	initialDest.SetDouble("v2", 200);
	initialDest.SetInt("NullFlags", 11);
	//initialDest.SetDouble("v0", 200);
	//initialDest.SetInt("NullFlags", 14);
	//initialDest.SetDouble("v1", 200);
	//initialDest.SetInt("NullFlags", 13);
	//initialDest.SetDouble("v3", 200);
	//initialDest.SetInt("NullFlags", 7);
	getCtrl().OpenDocFromPath(pFilePath.trim(), openDocParams);
If I have understood your specifications correctly, now only v2 is used.
Unfortunately this had no effect on the zoom factor of the opened pdf.
I tried the same with v0 (NullFlags=14), v1(NullFlags=13) and v3(NullFlags=7).
Also no change.
AteBe

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

Re: Zoomfaktor for OpenDocFromPath

Post by Sasha - Tracker Dev Team » Wed Jun 05, 2019 9:37 am

Hello AteBe,

Here's a working sample for you that will redirect you to the PDF Specification's page (with 66% zoom) where the "vN" values are being characterized for each type:

Code: Select all

ICab openParams = pdfCtl.Inst.CreateOpenDocParams();
ICabNode openParamsRoot = openParams.Root;
ICabNode dest = openParamsRoot["InitialDest"];
dest.SetInt("Type", 0);
dest.SetInt("Page", 373);
dest.SetInt("NullFlags", 1 | 2 | 8);
dest.SetDouble("v2", 0.66); //66%
pdfCtl.OpenDocFromPath(@"https://www.adobe.com/content/dam/acom/en/devnet/pdf/pdfs/PDF32000_2008.pdf", openParams);
Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

Post Reply