PDF thumbnails from VBA
I was asked to develop a form where user can see a pdf thumbnail of a pdf file. It was pretty far from what I have been developing so I decided to use "uncle" google to find a solution. There are some solutions but nothing what was expecting. You can use paid version of Adobe or free Adobe Acrobat ActiveX (Acropdf1) or some others free tools that can work along a pdf file. I tested only the free version of Acrobat ActiveX component and it was really nightmare. Then I found a C# project using the GhostScript tool for creating a pdf thumbnail. Unfortunatelly VBA cannot work with this project directly. Read more to find solution.
As I mentioned you can use the Acropdf1 activeX which is automatically installed with the Adobe Reader application.
How to add the Acropdf1 activeX on a VBA form
At the first time the activeX seemed to be a good solution but then I found two "bugs". The first one is more important than the second one. The activeX takes focus and never give it back and if you press the "TAB" key, then the whole application will crash. It's very known bug but Adobe cannot fix it for some reason. And the second bug rather behavior - of the activeX control is uncomfortable - it always takes focus and never give it back and also you don't have option to find out if a pdf document is fully loaded or not. My client was complaining about that for many times so I decided to find another solution.
I found code from Matthew Ephraim. where he uses a free tool Ghostscrip and .NETFramework 3.5 and C#. Form Visual Studio you can use his tool without any problems just include it into your project. Unfortunately we cannot use his dll directly from VBA. That was the reason why I took his code and made a little adjustment to expose methods from his project to the COM object.
Now - after registration the dll to your system - you can reference the dll as usually and use it !!! And it works great.
Who is interested how to create a C# dll that can work with VBA I attached the zip file with entire C# solution. Look at the Attachment section.
And who just want to use it as soon as possible, download the installer and install it. I also prepare a sample and you can find everything in the Attachment section.
The installer just check if your system contains the .NETFramework 4 and if not, it will suggest to download it and then register the dlls into your system.
Your code can look like this one
and then you can take the output file as an ordinary image file and load it - for example - to an image control.
Option Explicit
'********************************************************************************
'TestPDFThumbnailGeneration
'
' Purpose: It uses reference to GhostscriptWrapper library.
' From a pdf file creates a jpg file that represents a thumbnail of the pdf.
' You can set page number and DPI quality.
'
' Inputs: -none-
'
' Outputs: -none-
'
' Created: 02/10/2011 Premysl Lazecky
'
' Modified: .
'
'********************************************************************************
Sub TestPDFThumbnailGeneration()
Dim PDF As GhostscriptWrapper
Dim strPath As String
Dim strInputFile As String
strInputFile = "Test.pdf"
strPath = ActiveWorkbook.Path
If Right$(strPath, 1) <> Application.PathSeparator Then
strPath = strPath & Application.PathSeparator
End If
Set PDF = New GhostscriptWrapper
PDF.GeneratePDFThumb inputPath:=strPath & strInputFile, _
outputPath:=strPath & "Output.jpg", _
Page:=1, _
Width:=72, Height:=72
Set PDF = Nothing
End Sub
As the result of this code you will get a jpg file called Output.jpg with thumbnail of defined page in the pdf file - in this case page 1 - with defined resolution.
Attachments
Installer and sample files
C# project
Komentáře
Přehled komentářů
https://taibayvip.vin bayvip
TilsPlosyIcojemiwele
(DanielInacy, 21. 3. 2022 23:46)
https://telegra.ph/Japanese-Milf-Cowgirl-12-10
Best Roblox Neighbourhood
(Dexonguili, 21. 3. 2022 14:33)
Hi, I desire to advise you a cool resource for finding cheats for roblox. Here you can consider cheats, hacks, scripts, bugs, glitches and more.
https://gazeteadana.com/roblox-jjsploit-not-updating/.html
https://gazeteadana.com/shoot-out-script/.html
https://gazeteadana.com/jjsploit-lua-c-grab-knife/.html
https://gazeteadana.com/dogecoin-mining-tycoon-script/.html
https://gazeteadana.com/roblox-robux-hacks-2022-no-human-verification/.html
Anal bleeding during bowel movement
(Shermanrof, 17. 3. 2022 11:19)
Hy hotty Queen
ass first. please
What a sexy couple you are
mmm lovely heels Julie
Es ist einfach geil bei dir
lonerangercollections.com/bhutan/03-03-2022 obrigado pelo Add
WOW. She is Awesome
MMmmm hot hott hotttt superb xxx
Da freuen sich doch beide
Schicke Spalte. Beim pissen firsten
Professional website promotion
(pentelCraws, 15. 3. 2022 19:01)
I share with you professional website promotion services. The best price, the work is done within a few days. More than 1500 backlinks are created. Money back guarantee. A professional works through the kwork exchange https://kwork.com.
Here is the link https://kwork.com/offpageseo/13467403/professional-website-promotion-1500-good-back-links
301 Moved Permanently
(WinstonBax, 26. 2. 2022 13:46)301 Moved Permanently https://www.iva-drp.com/ - Click here>>>
helo and hi all
(IsacBat, 22. 2. 2022 8:33)
Also that we would do without your very good phrase
dfgdlfg2131.32
https://howyoutoknowacxv.online/map.php
Why should you use shea butter?
(Nathansog, 20. 2. 2022 14:51)What is shea butter? https://skinmakeoverstore.com/will-shea-butter-cause-acne It's thick, creamy consistency makes it perfect for using as a lip balm or to help soothe chapped skin. The best way to apply shea butter is by massaging into dry areas of the body such as elbows, knees, feet etc. You should not rub too hard though, because if done incorrectly then you may cause irritation.
best laptop
(Antonioveics, 17. 2. 2022 3:26)
best laptop
https://geni.us/4MfUUk
best laptop 2022
https://geni.us/hfRVaQ
best laptop under 500
https://geni.us/svGJ
best laptop under 1000
https://geni.us/baRSYu5
free CASH APP money legit
(belleDriex, 17. 2. 2022 0:10)
https://jaywalkingguelph.weebly.com/uploads/1/4/0/7/140799976/cash_app_hack_2022_-_free_money.pdf
can people hack your CASH APP
CASH APP free money code legit
2022 march updated!
This Japanese Morning Meal Drink Altered My Life
(Justinwaype, 16. 2. 2022 15:24)https://bit.ly/3en0Aov This Uncommon Breakfast Tonic Offered Me Back My Self-confidence
Discover How The Foods You're Consuming Everyday Are Making Your Fat Cells SICK
(JesseTah, 15. 2. 2022 23:20)
https://bit.ly/3y8bt5A One of your body's major fat-burning hormonal agents LOWERS when you go on a diet?
Research has shown that this important hormone come by as long as 50% after just 7 days of dieting!
The most awful component is, the longer you attempt to diet regimen, the worse it gets, which is why several "serial dieters" frequently battle to keep the weight off (if they lose it in any way ...).
The excellent news is we're mosting likely to share the nutrition methods to INCREASE your body's all-natural fat-burning hormonal agents securely and also normally! https://bit.ly/3y8bt5A
Women's Manufacture Backpack
(JasonDup, 15. 2. 2022 14:21)https://geni.us/Z36xqK3 natural leather backpack for women
amicable to collect you!
(ArthurCRara, 15. 2. 2022 0:02)
Hi,
acute to foregather you! Let me advance myselft
55 year-old Architectural, Building and Surveying Experts Amado Ciaburri from Chatsworth, loves to spend time model trains, and operating in a food pantry. Loves to go to unknown locations like Generalife and AlbayzÃn
https://www.taringa.net/ciarambzkv/which-insurance-policy-firms-present-insurance-policy-for-pets_50mgyi
Online Social Network Jobs That Pay $25 - $50 Per Hour. No Experience Called for. Operate at House.
(DanielFon, 13. 2. 2022 20:59)
https://bit.ly/3ydqiDU Obtain Paid To Make Use Of Facebook, Twitter And Youtube
cheapest Biaxin tablets fast delivery online shopping
(entetlerfit, 8. 2. 2022 23:15)
https://reliability-consultant.com/61844-zovirax-suspension-200mg-5ml-price/
https://ifarme.store/20007-can-you-buy-cialis-online-in-canada/
https://smilesbysutherland.com/66829-buying-viagra-online-singapore/
https://at-the-dot.store/13260-zebeta-2-5-mg-prices.html
vit kabelstickad gant tröja
(vit kabelstickad gant tröja, 8. 2. 2022 18:05)
I've learn a few good stuff here. Certainly worth bookmarking for revisiting. I surprise how so much attempt you put to make one of these magnificent informative web site. vit kabelstickad gant tröja helpbo.sewomabest.com/map29.php
selling Famvir 250 mg online shop
(entetlerfit, 7. 2. 2022 8:43)
https://cornerstone-recruitment.com/65034-buying-viagra-in-ontario.html
https://prepa-concours-social.com/22686-buy-cialis-10mg-without-prescription.html
https://tech133.store/41578-how-much-is-elavil-cost.html
https://vodicevilla.store/09553-order-periactin-8-mg-tablets/
https://telecharger-programme.com/91732-aspirin-low-dose-for-sale/
https://tirolclimbing.com/71897-buy-reglan-5-mg-reviews.html
https://istanbuliftarmekanlari.com/88286-glyburide-cost/
https://eindhovenuitdekunst.nl/19462-sumatriptan-spray-price/
https://babex.nl/43760-imdur-tab-60-mg-30s.html
gröna kaffebönor gå ner i vikt
(gröna kaffebönor gå ner i vikt, 4. 2. 2022 7:15)
Hello, i read your blog occasionally and i own a similar one and i was just wondering if you get a lot of spam comments? If so how do you protect against it, any plugin or anything you can suggest? I get so much lately it's driving me mad so any assistance is very much appreciated. gröna kaffebönor gå ner i vikt stupce.teswomango.com/map26.php
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50
Bayvip
(NolentelCraws, 22. 3. 2022 9:03)