Page 1 of 1

Zoomfaktor for OpenDocFromPath

Posted: Fri May 24, 2019 12:29 pm
by AteBe
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

Re: Zoomfaktor for OpenDocFromPath

Posted: Fri May 24, 2019 12:36 pm
by Sasha - Tracker Dev Team
Hello AteBe,

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

Cheers,
Alex

Re: Zoomfaktor for OpenDocFromPath

Posted: Fri May 24, 2019 12:59 pm
by AteBe
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

Re: Zoomfaktor for OpenDocFromPath

Posted: Fri May 24, 2019 1:03 pm
by Sasha - Tracker Dev Team
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

Re: Zoomfaktor for OpenDocFromPath

Posted: Fri May 24, 2019 1:19 pm
by AteBe
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

Re: Zoomfaktor for OpenDocFromPath

Posted: Fri May 24, 2019 1:39 pm
by Sasha - Tracker Dev Team
Hello AteBe,

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

Cheers,
Alex

Re: Zoomfaktor for OpenDocFromPath

Posted: Mon May 27, 2019 6:52 am
by AteBe
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

Re: Zoomfaktor for OpenDocFromPath

Posted: Mon May 27, 2019 7:23 am
by Sasha - Tracker Dev Team
Hello AteBe,

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

Cheers,
Alex

Re: Zoomfaktor for OpenDocFromPath

Posted: Mon May 27, 2019 9:14 am
by AteBe
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

Re: Zoomfaktor for OpenDocFromPath

Posted: Mon May 27, 2019 9:20 am
by Sasha - Tracker Dev Team
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

Re: Zoomfaktor for OpenDocFromPath

Posted: Wed May 29, 2019 12:34 pm
by AnKeilha
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

Re: Zoomfaktor for OpenDocFromPath

Posted: Wed May 29, 2019 2:37 pm
by Sasha - Tracker Dev Team
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

Re: Zoomfaktor for OpenDocFromPath

Posted: Fri May 31, 2019 6:35 am
by AnKeilha
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

Re: Zoomfaktor for OpenDocFromPath

Posted: Tue Jun 04, 2019 7:31 am
by AteBe
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

Re: Zoomfaktor for OpenDocFromPath

Posted: Tue Jun 04, 2019 7:36 am
by Sasha - Tracker Dev Team
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

Re: Zoomfaktor for OpenDocFromPath

Posted: Tue Jun 04, 2019 10:54 am
by AteBe
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

Re: Zoomfaktor for OpenDocFromPath

Posted: Wed Jun 05, 2019 9:37 am
by Sasha - Tracker Dev Team
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