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ářů
Welcome to the world of adult Dating loveawake.ru
fun casino bonus code
(MixClots, 4. 4. 2022 11:19)
https://forum.proxmox.com/members/limaofep.141182/#about
play ojo casino
Nicest Roblox Place
(Dexonguili, 3. 4. 2022 3:58)
Hello, here you can find roblox glitches and more.
https://century21royaltors.com/survive-the-night-script/
black lotus casino no deposit bonus codes 2022
(belleDriex, 29. 3. 2022 23:23)
https://bukkit.org/members/limaoheads.91398935/
all british casino
no minimum deposit casino
Best Roblox Zone
(Dexonguili, 29. 3. 2022 3:31)
Hello, here you can on roblox bugs and more.
https://parkhillpresbyterian.org/counter-strike-roblox-offensive-hacks-aimbot-esp/
The fate of the old man
(JanetikEnund, 28. 3. 2022 22:30)
Each generation sees itself as completely different from the previous one, but in the end is about the same.
If I look at my own life, I believe that I have made mistakes many times.
The same will happen to you when you get older. Live and make mistakes. This is life.
Do not flatter yourself that you are capable of being perfect - this is not real.
Strengthen your spirit, your qualities, so that when a test happens, you find the strength to accept it like a real man.
Do not let yourself be fooled by common facts and loud phrases.
Travel countries, explore the world, meet people, do something that excites you, fall in love, be bold, but do it with passion.
The most important thing is to live life with taste.
There is probably more than one life waiting for us. But to get them, you need to spend this life to the end. Take everything you can from life.
Fear colorless fate.
Nicest Roblox Charge
(Dexonguili, 28. 3. 2022 3:10)
Hello, here you can find roblox cheats and more.
https://lospiritodiassisi.org/script-for-adopt-me/.html
Share of personality
(RachellPag, 28. 3. 2022 0:50)
Teaching the old to the young is not only a waste of time, but also impudence https://skvoter.smartphon.design .
Each generation sees itself as completely different from the previous one, although in the end it turns out to be almost the same.
If I look at my own life, I see that I have often been wrong.
The same will happen to you when you get older. Enjoy life and make mistakes. This is life.
Do not argue that you are capable of being perfect - it is not real.
Temper yourself, your will, so that when the test comes, you will find the strength in yourself to meet him as a true man.
Do not allow yourself to be deceived by obvious facts and noisy phrases.
Travel, explore the world, meet people, do something that interests you, fall in love, be daring, but do it with inspiration.
The most important thing is to live life with taste.
Maybe we have more than one life ahead of us. But to get them, you need to use this life to the fullest. Take as much from life as you can.
Fear colorless fate.
A-one Roblox Put away
(Dexonguili, 27. 3. 2022 1:54)
Hello, here you can espy roblox cheats and more.
https://chicagoweddings.org/working-roblox-exploit-november-2022/
Nicest Roblox Associate
(Dexonguili, 25. 3. 2022 1:30)
Hello, here you can tumble to roblox hacks and more.
https://evergreenmedicalcentre.com/roblox-teleport-exploit-2022/.html
https://evergreenmedicalcentre.com/is-impact-roblox-exploit-safe/.html
https://evergreenmedicalcentre.com/roblox-hacks-with-full-tutorial-on-how-to-donload/.html
Superlative Roblox Neighbourhood
(Dexonguili, 24. 3. 2022 1:06)
Hello, here you can on roblox cheats and more.
https://mrbcny.org/roblox-how-to-make-a-level-7-exploit/.html
https://mrbcny.org/roblox-hacks-no-servay/.html
https://mrbcny.org/jjsploit-password-stolen/.html
Nicest Roblox Plunk down
(Dexonguili, 23. 3. 2022 21:24)
Hello, here you can on roblox cheats and more.
https://joedev.net/run-synapse-x-comman/.html
https://joedev.net/entry-point-script/.html
https://joedev.net/roblox-how-to-install-wearedevs-hacks/.html
https://joedev.net/toyo-proxo-r888/.html
https://joedev.net/is-roblox-hacks-2022-safe/.html
Nicest Roblox Put away
(Dexonguili, 22. 3. 2022 10:17)
Hello, here you can find roblox cheats and more.
https://advancedjournals.org/roblox-exploit-api-no-virus/.html
https://advancedjournals.org/how-do-u-turn-of-the-hacks-on-roblox/.html
https://advancedjournals.org/how-to-fix-skisploit-crash/.html
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
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
Are you 18? Come in and don't be shy!
(loveawake.ru, 8. 4. 2022 17:57)