WPF Viewer Control

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

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

Post Reply
Max SAG
User
Posts: 27
Joined: Thu Oct 30, 2014 8:54 am

WPF Viewer Control

Post by Max SAG »

Hi everyone,

For the record, I'm using Windows 8.1 and Visual Studio 2012 in a WPF application targeting the .NET framework 4.5.

I know that WPF developments aren't your main priority, but I'm currently evaluating the last PDF-XChange Viewer SDK to use your viewer in a WPF application, because your reader is by far the more responsive I have been able to try (on large PDF files).
I have already created a WPF user control (using a WindowsFormsHost) to use binding on it. It works fine.

Now I'm facing the well known "airspace problem" (http://msdn.microsoft.com/en-us/library/ms744952.aspx) when I try to put WPF controls on the top of the viewer.
Knowing that a WPF control will not be available in the short term, I was wondering if I could use some walkaround using a WPF Image control to show a rasterized image generated by your SDK, and refresh the image according to the user moves.
I'm aware that it would reduce the responsivity but I don't see any other way to show WPF controls on top of it.

Which SDK and methods should I use to take a snapeshot (into a stream) of a specific part of a PDF document (like the Snapshot button in the PDF-XChange Viewer)?
The documentation is so huge, I don't know if it's even possible.
This post (https://forum.pdf-xchange.com/ ... t=snapshot) says it's not possible, this one (https://forum.pdf-xchange.com/ ... t=snapshot) is not very helpful.

Maybe this one (https://forum.pdf-xchange.com/ ... 36&t=22388) contains the solution but the attachted sample allows to snapshot the WHOLE page, not just a part of it.

Thanks for your answers,

Max
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17910
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: WPF Viewer Control

Post by Tracker Supp-Stefan »

Hello Max,

If all you need is the rendered PDF page(s), or parts of, then maybe the Simple DLL SDK will do for you:
https://www.pdf-xchange.com/product ... le-dll-sdk
It will render a given PDF page (or part of it) to a DC and you can then handle this as needed.

Regards,
Stefan
Max SAG
User
Posts: 27
Joined: Thu Oct 30, 2014 8:54 am

Re: WPF Viewer Control

Post by Max SAG »

Thanks for the quick answer.

What do you mean by "DC"?
I have already downloaded the SDK. Can you be more precise about the class or the method to use?
Isn't it the function used in this post (https://forum.pdf-xchange.com/ ... 36&t=22388) : PXCV_DrawPageToIStream, with other RenderParam?
I cannot find it in the C# Examples. Maybe I'm missing something.

Regards,

Max
User avatar
John - Tracker Supp
Site Admin
Posts: 5219
Joined: Tue Jun 29, 2004 10:34 am
Location: United Kingdom
Contact:

Re: WPF Viewer Control

Post by John - Tracker Supp »

Hi,

DC = Device Context see here for more info;

http://msdn.microsoft.com/en-us/library/azz5wt61.aspx

And I believe you will find the Simple DLL SDK adequate for your needs if they do not extend substantially beyond what you have outlined - see the C# examples detailed here;

X:\Program Files\Tracker Software\PDF-XChange Viewer SDK\Examples\C#Examples

You may need to modify the path to fit your local install a little depending on how you modified the installation options.
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
Max SAG
User
Posts: 27
Joined: Thu Oct 30, 2014 8:54 am

Re: WPF Viewer Control

Post by Max SAG »

Hi,

Thanks you again for your answers, I did not get back to you but I managed to create a quite responsive multithreaded WPF viewer with the simple viewer SDK.

For those interested, I used the DrawPageToDIBSection method (documentation here https://help.pdf-xchange.com/DEV/de ... dibsection and here https://help.pdf-xchange.com/DEV/de ... parameters).

This sample (https://forum.pdf-xchange.com/ ... 36&t=22388) can be a good start (it uses DrawPageToDC instead of DrawPageToDIBSection).

Regards,

Max
User avatar
John - Tracker Supp
Site Admin
Posts: 5219
Joined: Tue Jun 29, 2004 10:34 am
Location: United Kingdom
Contact:

Re: WPF Viewer Control

Post by John - Tracker Supp »

Pleased you got there Max :-)
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
Post Reply