In my last tip, I posted the code for Extracting the Text Content from a PDF File.
Well, I promised to post the code for
Generating Graphical Thumbnail from PDF File in that post very soon.
However, some
viral infection made me inefficient enough to delay this post :-).
Here is the code snippet to generate the graphical thumbnail from the pdf file.
You can extend this thing for generating the thumbnails of all the pages, last page etc.
Currently this code generates the thumbnail of
first page only.
Also you can play around with the thumbnail size part, I have not added the sizing section which takes care of the size and the
aspect ratio.
Will post the snippet for
Getting the Size According to Aspect Ratio in next post.
Regards
Shobhit
A sample call for this function is like below:
Dim strThumbFile As String
Dim strPDFPath As String, strTargetPath As String, strTargetFileName As String
strPDFPath = "YourDrive:\YourPath\SomePDFFile.pdf"
strTargetPath = "YourDrive:\YourPath"
strTargetFileName = "YourFileName.jpg"
If fn02_GenerateThumbFromPDF(strPDFPath, strTargetPath, strTargetFileName, System.Drawing.Imaging.ImageFormat.Jpeg, strThumbFile) = True Then
MsgBox(strThumbFile)
Else
MsgBox("Error in generating thumbnail.")
End If