Creating Thumbnails for use in .NET

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

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

Creating Thumbnails for use in .NET

Post by John - Tracker Supp »

Posted on behalf of : Tobias Herold
++++++++++++++++++++++++++++++++++
Hi,

we have been reccomended to use the Simple Viewer SDK to generate an image of a PDF page fo use as a thumbnail and need some help please :

Please have look to the following code snippet:

Dim res As Integer
Dim pointer As IntPtr = GetDC(Handle)
Dim bmp As System.Drawing.Bitmap
res = PXCV_Lib.PXCV_DrawPageToDIBSection(m_Doc, 0, m_Parameters, Nothing, 250, pointer, 0, 0)
bmp = Bitmap.FromHbitmap(pointer)
Me.PictureBox1.Image = bmp

My aim of this code is to get an bitmap from
a pdf page which I can use in .net native controls then.

Is this the only and simplest way to accomplish it? It looks
a bit weird and complicated to me, though it works.

You wrote something about automatically generated thumbnails
when using your ActiveX Viewer for loading the PDF documents.
So how it is possible to access these thumbs for a further
handling in .net controls (e.g. listview)?
Important: I do not need PDF documents with embedded thumbnails
but thumbs for showing them in a listview or datagridview.

Unfortunately your thumbnailview of the viewer doesn't meet all of our requirements (e.g. drag&drop to .net controls, customize thumbnailcolor, positioning...). For this reason we have to implement the thumbnailview
for ourselves.

Thank you for the good contact and your patience.
Tobias Herold
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
ebbiTeam
User
Posts: 17
Joined: Fri May 27, 2011 7:20 am

Re: Creating Thumbnails for use in .NET

Post by ebbiTeam »

No idea? Especially the topic about creating of thumbnails is very important for our project.
My example code looks like a roundabout way for me and I'm wondering if there's a much better way.
(e.g. get possibly automatically generated thumbs from your view control)
Hope for an answer today.

Best regards

Tobias Herold
Ebbinghaus TEAM GmbH
Corwin - Tracker Sup
User
Posts: 664
Joined: Tue Nov 14, 2006 12:23 pm

Re: Creating Thumbnails for use in .NET

Post by Corwin - Tracker Sup »

Hello Tobias Herold,

There is no way to get existing thumbnails from Viewer ActiveX. PXCV_DrawPageToDIBSection function form Simple Viewer SDK should work for your needs.
ebbiTeam
User
Posts: 17
Joined: Fri May 27, 2011 7:20 am

Re: Creating Thumbnails for use in .NET

Post by ebbiTeam »

Corwin - Tracker Sup wrote:Hello Tobias Herold,

There is no way to get existing thumbnails from Viewer ActiveX. PXCV_DrawPageToDIBSection function form Simple Viewer SDK should work for your needs.
Thus I'm on the right way with my code snippet above?
Corwin - Tracker Sup
User
Posts: 664
Joined: Tue Nov 14, 2006 12:23 pm

Re: Creating Thumbnails for use in .NET

Post by Corwin - Tracker Sup »

It will be better to draw direct on needed DC. Please see attached example.
You do not have the required permissions to view the files attached to this post.
ebbiTeam
User
Posts: 17
Joined: Fri May 27, 2011 7:20 am

Re: Creating Thumbnails for use in .NET

Post by ebbiTeam »

Thank you very much - that helped a lot!
At the beginning of next week I will try to implement it and then I will give you a feedback about it.

Until then have an nice weekend.
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19913
Joined: Mon Jan 12, 2009 8:07 am

Re: Creating Thumbnails for use in .NET

Post by Stefan - PDF-XChange »

Thanks Tobias,

You too have a lovely weekend!
And we would be expecting that feedback!

Cheers,
Stefan