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ářů
interesting news
Thanks, I've been looking for this for a long time
(Kzkktomib, 24. 2. 2023 14:20)Cool + for the post
https://telegra.ph/Koleso-v-dragon-mani-02-20#Колесо в драгон мани
(BrianWrosy, 22. 2. 2023 20:41)
https://telegra.ph/Skachat-skript-dragon-mani-02-20#Скачать скрипт драгон мани
No deposit bonuses + 150FS - FREE
(Grygek, 22. 2. 2023 8:23)
No deposit bonuses 150 FREE SPINS
https://joycasino-4nx9.ru
New Slots
https://vulkancasino-5cba.ru
innosilicon
(Jerryken, 21. 2. 2023 13:32)
Innosilicon A10 Pro+ 500MH/S 6G Ethash Miner: A Game-Changing Solution for Cryptocurrency Miners
Cryptocurrency mining has been gaining popularity over the years due to its potential to earn massive profits. However, to maximize the profits, miners need to use the best equipment available in the market. This is where Innosilicon comes into play. Innosilicon is a leading manufacturer of cryptocurrency mining equipment, and its latest product, the Innosilicon A10 Pro+ 500MH/S 6G Ethash Miner, is a game-changer for miners.
The Innosilicon A10 Pro+ 500MH/S 6G Ethash Miner is a high-performance mining rig that is designed to mine Ethereum and other cryptocurrencies using the EtHash algorithm. It boasts a maximum hashrate of 500Mh/s±5% for a power consumption of 750W, making it one of the most efficient miners in the market.
The A10 Pro+ 500MH/S 6G Ethash Miner features a state-of-the-art 6GB GDDR6 memory that ensures high-speed data processing and efficient performance. This is crucial for cryptocurrency mining, as it requires a significant amount of data processing power to mine cryptocurrencies successfully.
What sets the Innosilicon A10 Pro+ 500MH/S 6G Ethash Miner apart from its competitors is its power efficiency. The miner's power consumption of 750W is significantly lower than its competitors, making it an ideal solution for miners who are conscious of their energy consumption.
In addition, the A10 Pro+ 500MH/S 6G Ethash Miner is incredibly easy to set up and use. It comes with a user-friendly interface that makes it easy for even novice miners to start mining cryptocurrencies right away. The miner is also compatible with various mining pools, allowing miners to choose the pool that best suits their needs.
sabong free credits
(Jerryken, 21. 2. 2023 5:39)
When the Spanish colonizers arrived in the Philippines, they tried to ban the sport, seeing it as barbaric. Despite this, sabong continued to thrive, and it remained an integral part of Philippine culture.
jasminer
(Tyronecoicy, 20. 2. 2023 23:51)
jasminer
Jasminer X4-Z Ethereum Classic Miner: A Power-Efficient Mining Solution
For those looking to mine Ethereum Classic, the Jasminer X4-Z Ethereum Classic Miner might be just the device for the job. Manufactured by Jasminer, the X4-Z is specifically designed to mine the EtHashETC algorithm, boasting a maximum hashrate of 840Mh/s±10% for a power consumption of only 380W±10%.
What sets the Jasminer X4-Z apart from other mining solutions is its power efficiency. With a relatively low power consumption, miners can save on energy costs while still achieving high hashrates. And with the X4-Z in stock in the Jasminer warehouse, worldwide delivery is available for those ready to start mining.
The Jasminer X4-Z is built with quality components and engineering, ensuring reliable performance and a longer lifespan. Its compact design makes it easy to install and set up, and the miner can be controlled remotely using a computer or mobile device. Additionally, the X4-Z features an easy-to-use interface, making it accessible for both experienced and novice miners.
Mining cryptocurrency can be a profitable venture, but it's important to choose the right hardware for the job. The Jasminer X4-Z Ethereum Classic Miner is a power-efficient and reliable option for those looking to mine ETC. With worldwide shipping available, it's easy to get started with the X4-Z and start earning cryptocurrency.
메이저사이트
(Tyronecoicy, 19. 2. 2023 12:18)
최고의 메이저 사이트 추천 업체 중 하나인 메이저나라는 전문적인 검증 과정을 통해 안전한 메이저 사이트를 보증하고 있습니다. 최근 먹튀 사고가 증가하면서 먹튀 방지를 위한 많은 장치들이 나타나고 있습니다. 그러나 메이저나라는 이러한 편법에 속지 않고 안전한 메이저 업체만을 추천하고 있습니다.
메이저나라는 안전한 메이저 놀이터를 추천하기 위해 먹튀 검증을 진행하고 있습니다. 먹튀 검증 과정에서는 업계 전문가들로 구성된 검증팀이 악성 사이트에 대한 회원들의 가입을 최대한 막고 있습니다. 이를 통해 더 많은 회원들이 안전한 업체를 이용할 수 있도록 노력하고 있습니다.
메이저나라에서는 먹튀 검증 방법을 단순히 서버 년도 수준의 검증이 아닌, 실제 업계 커뮤니티와 관련 업자들에게 잠입하여 모든 사이트 정보를 얻고 해당 사설 토토사이트의 운영 방법이나 관리 방법 등을 입수하고 계열 사이트의 경우에는 해당 놀이터를 역추적하여 실질적인 운영 사이트를 찾아내는 방법을 사용합니다.
Easily Manage Your Portfolio with Binary Options
(OlpSmity, 17. 2. 2023 23:35)
Hi!
Get started in the world of binary options trading with confidence! Our user-friendly platform offers a wide range of assets, fast trades and secure transactions. With returns of up to 800% and a minimum deposit of just $200, there's never been a better time to invest. #binaryoptions #trading #profits
WARNING! If you are trying to access the site from the following countries, you need to enable VPN which does not apply to the following countries!
Australia, Canada, USA, Japan, UK, EU (all countries), Israel, Russia, Iran, Iraq, Korea, Central African Republic, Congo, Cote d'Ivoire, Eritrea, Ethiopia, Lebanon, Liberia, Libya, Mali, Mauritius, Myanmar, New Zealand, Saint Vincent and the Grenadines, Somalia, Sudan, Syria, Vanuatu, Yemen, Zimbabwe.
https://cutt.us/no4Rt
Sign up and start earning from the first minute!
https://wawada-com.bitbucket.io/faq/
(BrianWrosy, 17. 2. 2023 9:21)
https://wawada-com.bitbucket.io/live/
Test, just a test
(Jamesqkjx, 16. 2. 2023 1:59)
solo mujeres magazine
best hotels in cancun mexico
cancun resorts mexico
aviator
(Jerryken, 15. 2. 2023 22:15)
Jogue Aviator 1win no cassino Aviator pin up. Faca o download do aplicativo Aviator em seu telefone Android. Jogue Aviator pin up de graca com uma estrategia de ganho. Receba um bonus de boas-vindas atraves do codigo promocional 1win aviator pin up
https://dragon-money-casino.bitbucket.io/
(JamesSow, 15. 2. 2023 16:53)https://dragon-money-casino.bitbucket.io/
Nine303 is the Most advantageous & Trusted Situs4D in 2023
(AntonioJA, 15. 2. 2023 16:30)Nine303 is the Most advantageous & Trusted Situs4D in 2023, https://nine303.com
aviator
(Jerryken, 15. 2. 2023 15:06)
Jogue Aviator 1win no cassino Aviator pin up. Faca o download do aplicativo Aviator em seu telefone Android. Jogue Aviator pin up de graca com uma estrategia de ganho. Receba um bonus de boas-vindas atraves do codigo promocional 1win aviator pin up
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
very interesting, but nothing sensible
(Kzkktomib, 24. 2. 2023 23:49)