Which Version do I need?

PDF-XChange Viewer SDK for Developer's
(ActiveX and Simple DLL Versions)

Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Vasyl - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange

gunnarphilipp
User
Posts: 6
Joined: Tue Feb 08, 2011 4:38 pm

Which Version do I need?

Post by gunnarphilipp »

Hello.

I am creating a simple app in vb.net / VS2010.

This app requires a PDF viewer, no controls are needed other then programmatically load and close a pdf document and print and save through GUI.

However, I am looking for one additional functionality:
Being able (through my programs code) to jump to a specific place inside the pdf, not a specific page but rather a given coordinate location.

An added bonus, but not required, to be able to highlight that area I am jumping to - also through my code.

Which of the many versions and packages there are would be able to do this.

I have downloaded the SDK Tools package, but could not see in any of the examples given that capability. Also I was unsuccessful running the examples, even though I copied all of the dlls into the bin folder.

Any suggestions and/or advice is greatly appreciated.

Gunnar Philipp
User avatar
John - Tracker Supp
Site Admin
Posts: 5223
Joined: Tue Jun 29, 2004 10:34 am

Re: Which Version do I need?

Post by John - Tracker Supp »

Hi,

For sure you would need to use the PDF-XChange Viewer ActiveX SDK ofr your required print operation of the PDF and this is provided for limited distribution as a component of the PDF-Tools SDK (you can deliver to a maximum of 2500 end user desktops before additional licensing is required if using the Viewer Ax)

You can also jump to a specific page and designate a location on the page using the Ax - but you cannot highlight text in the manner desired if I understand your request correctly - this would have to be done by a user in the UI.

HTH
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.

Best regards
Tracker Support
http://www.tracker-software.com
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2448
Joined: Thu Jun 30, 2005 4:11 pm

Re: Which Version do I need?

Post by Vasyl - PDF-XChange »

Hi, Philipp.

For your case you may use our PDF-XChange Viewer ActiveX SDK.

To jump to a specific place inside the pdf you may use one undocumented feature:

Code: Select all

string page = "Pages[" + pageIndex + "];
viewerCtrl.DoDocumentVerb(docId, page, "MovePagePointToScreenPoint", dataIn(pageX, pageY, screenX, screenY), NULL, 0); 
// dataIn is SAFEARRAY with four numbers, also you may use PDFXCargs aux. object for simple building of SAFEARRAY structure...
// pageX, pageY - point on the pdf page, in points 
// screenX, screenY - screen point, relative to desktop, in pixels
HTH.
PDF-XChange Co. LTD (Project Developer)

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
gunnarphilipp
User
Posts: 6
Joined: Tue Feb 08, 2011 4:38 pm

Re: Which Version do I need?

Post by gunnarphilipp »

Thank you for your direction.

I have downloaded the PDF-XChange Viewer SDK - Version 2.x. and installed on my machine.

in order to try to run the "Commands" example i have registered the ActiveX control as descriped in the help file.

however, when i run the app (your vb.net commands example) from VS2010 i get the following error.

Code: Select all

An error occurred creating the form. See Exception.InnerException for details.  The error is: Could not load file or assembly 'Interop.PDFXCviewAxLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.
any idea as to what i am doing wrong?
gunnarphilipp
User
Posts: 6
Joined: Tue Feb 08, 2011 4:38 pm

Re: Which Version do I need?

Post by gunnarphilipp »

Vasyl-Tracker Dev Team wrote:Hi, Philipp.

For your case you may use our PDF-XChange Viewer ActiveX SDK.

To jump to a specific place inside the pdf you may use one undocumented feature:

Code: Select all

string page = "Pages[" + pageIndex + "];
viewerCtrl.DoDocumentVerb(docId, page, "MovePagePointToScreenPoint", dataIn(pageX, pageY, screenX, screenY), NULL, 0); 
// dataIn is SAFEARRAY with four numbers, also you may use PDFXCargs aux. object for simple building of SAFEARRAY structure...
// pageX, pageY - point on the pdf page, in points 
// screenX, screenY - screen point, relative to desktop, in pixels
HTH.
That sounds exactly like what i need - just need to get it to work now :oops:

Code: Select all

            Dim args As PDFXCviewAxLib.IPDFXCargs
            Dim dataOut, dataIn As Object
            dataIn = Nothing
            dataOut = Nothing

            Me.AxAcroPDF1.DoVerb("", ".ARGS", dataIn, dataOut, 0)
            args = DirectCast(dataOut, PDFXCviewAxLib.IPDFXCargs)

            args.Init(4)
            args(0) = 100
            args(1) = 300
            args(2) = 600
            args(3) = 400

            Dim page As String = "Pages[0]"
            Me.AxAcroPDF1.DoDocumentVerb(0, page, "MovePagePointToScreenPoint", args, Nothing, 0)
The above throughs an error

Code: Select all

An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in AxInterop.PDFXCviewAxLib.dll

Additional information: Exception from HRESULT: 0x82132714
can anyone see what iam doing wrong here?
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2448
Joined: Thu Jun 30, 2005 4:11 pm

Re: Which Version do I need?

Post by Vasyl - PDF-XChange »

Hi, Philipp.

My mistake, sorry :oops:
The correct operation name is "MovePointToScreenPoint" , so:

Code: Select all

args.Init(4)
// fill page point
args(0) = 100.0 ' should be double number, pageX
args(1) = 300.0 ' should be double number, pageY
// fill absolute screen point
Dim absX As Integer
Dim absY As Integer
' obtain absX, absY - screen coordinates of TopLeft point of our ActiveX-control on the your form
' Note: if our control displays some toolbars above or left of internal "Pages View" window - absX, absY will be some wrong.
' To resolve this problem we will add new feature in the next build like as:
' ctr.GetDocumentProperty(docId, "Pages.ScreenX", out absX, 0);
' ctr.GetDocumentProperty(docId, "Pages.ScreenY", out absY, 0);
' ---
args(2) = absX + 100 ' should be integer number
args(3) = absY + 0 ' should be integer number 

Me.AxAcroPDF1.DoDocumentVerb(0, "Pages[0]", "MovePointToScreenPoint", args, Nothing, 0)
HTH
PDF-XChange Co. LTD (Project Developer)

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
gunnarphilipp
User
Posts: 6
Joined: Tue Feb 08, 2011 4:38 pm

Re: Which Version do I need?

Post by gunnarphilipp »

Vasyl-Tracker Dev Team wrote:Hi, Philipp.

My mistake, sorry :oops:
The correct operation name is "MovePointToScreenPoint" , so:

Code: Select all

args.Init(4)
// fill page point
args(0) = 100.0 ' should be double number, pageX
args(1) = 300.0 ' should be double number, pageY
// fill absolute screen point
Dim absX As Integer
Dim absY As Integer
' obtain absX, absY - screen coordinates of TopLeft point of our ActiveX-control on the your form
' Note: if our control displays some toolbars above or left of internal "Pages View" window - absX, absY will be some wrong.
' To resolve this problem we will add new feature in the next build like as:
' ctr.GetDocumentProperty(docId, "Pages.ScreenX", out absX, 0);
' ctr.GetDocumentProperty(docId, "Pages.ScreenY", out absY, 0);
' ---
args(2) = absX + 100 ' should be integer number
args(3) = absY + 0 ' should be integer number 

Me.AxAcroPDF1.DoDocumentVerb(0, "Pages[0]", "MovePointToScreenPoint", args, Nothing, 0)
HTH

Thank you for your code and help.

However, I am still getting an error

Code: Select all

An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in AxInterop.PDFXCviewAxLib.dll

Additional information: Exception from HRESULT: 0x82000001
gunnarphilipp
User
Posts: 6
Joined: Tue Feb 08, 2011 4:38 pm

Re: Which Version do I need?

Post by gunnarphilipp »

Forget the last messsage - i am just st.... :?

It works - exactly what i needed.

Got 2 more questions, however:

- You mentioned in the next build the additional functionality will be included - you got any timeline on that?

- now i need a way, where the user can click on a loaded pdf and a function returns the xy coordinates to me, so that i can store them in my table and use with the from you above mentioned function.

Thank you so much for your help!
:D
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19913
Joined: Mon Jan 12, 2009 8:07 am

Re: Which Version do I need?

Post by Stefan - PDF-XChange »

Hello gunnarphilipp,

The timeframe is usually 2-4 weeks in between builds, but now with all the preparation for the upcoming ver3 those might be a bit longer.

As for grabbing the click location - have a look at TranslateScreenPoint: Converts the screen coordinates in pixels of a specified point on the screen to document page coordinates in points.

Regards,
Stefan
gunnarphilipp
User
Posts: 6
Joined: Tue Feb 08, 2011 4:38 pm

Re: Which Version do I need?

Post by gunnarphilipp »

Tracker Supp-Stefan wrote:Hello gunnarphilipp,

The timeframe is usually 2-4 weeks in between builds, but now with all the preparation for the upcoming ver3 those might be a bit longer.

As for grabbing the click location - have a look at TranslateScreenPoint: Converts the screen coordinates in pixels of a specified point on the screen to document page coordinates in points.

Regards,
Stefan

Thank you again for all your help!

I'll check out the TranslateScreenPoint function.

I'll post my results.

thanks!
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19913
Joined: Mon Jan 12, 2009 8:07 am

Re: Which Version do I need?

Post by Stefan - PDF-XChange »

Sure we would love to hear your comments gunnarphillip,

There is also a sample (in pseudocode) in the manual - so do have a look :)

Regards,
Stefan
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2448
Joined: Thu Jun 30, 2005 4:11 pm

Re: Which Version do I need?

Post by Vasyl - PDF-XChange »

Hi, Philipp.
- now i need a way, where the user can click on a loaded pdf and a function returns the xy coordinates to me, so that i can store them in my table and use with the from you above mentioned function.
You may use next method:

Code: Select all

// 1. keep current pages view
// fill screen top/left coordinates of pages view control, absX, absY - should be calculated as in my previous post
...
args.Init(2)
args(0) = absX + 0 
args(1) = absY + 0
...

Dim dataOut As Object
Me.AxAcroPDF1.DoDocumentVerb(docId, "Pages[0]", "TranslateScreenPoints", args, dataOut, PXCVA_OutArgs)
args = DirectCast(dataOut, PDFXCviewAxLib.IPDFXCargs)
pageX = args(0) 
pageY = args(1) 

// 2. restore last pages view in the new session
args.Init(4)
args(0) = pageX 
args(1) = pageY
args(2) = newAbsX + 0
args(3) = newAbsX + 0
Me.AxAcroPDF1.DoDocumentVerb(docId, "Pages[0]", "MovePointToScreenPoint", args, Nothing, 0)
...
HTH
PDF-XChange Co. LTD (Project Developer)

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.