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://goldengalaxy.ru/sposoby-zarabotka/kak-zarabotat-na-fotoshope Экономика Нетворкинг что это такое простыми словами. 5 правил и советов! Хотите купить или продать салон красоты в Москве ??? Предлагаем большой выбор готового бизнеса от собственников: более 100 салонов красоты в каталоге ??! Помощь в покупке и продаже салона красоты ?. Сопровождение сделки ?. Смотрите сейчас ?!)~AEMacro(Cell(I,2,first)30 139,00)~AEMacro(Cell(I,2,last)33 171,00)~AEMacro(CellDelta(I,2,first,I,2,last)? В нашей сегодняшней статье, мы рассмотрим, облачный майнинг без вложений с бонусами в 2020 году. Рейтинг сервисов для облачного майнинга в 2020 году ?
Приглашаем в наш мц Надежда
(Scottlam, 2. 9. 2022 11:05)
info@nadzeja.by
+37517375-06-02
+375 17)353-60-77
+37529333-20-20
+375 297312020
Приглашаем в наш мц Надежда
Source:
- https://www.nadzeja.by/
1win скачать
(Thomasguany, 31. 8. 2022 19:16)
Скачать и установить apk бесплатное официальное мобильное приложение 1win ru последняя версия для айфон (iphone) или android смартфонов на русском. Мобильная клиент программа 1win com kz, сделать полностью бесплатно установку app апк на любой мобильный телефон, не важно, старая или новая версия андроид или ios, мобильная версия приложения на ваш телефон, используйте мобильный депозит суммы, вы можете пополнить деньги игрового баланса. Выплата через рубль, всегда выполняется проверка если не пришли деньги. Пополнение игрокам через популярные платёжные системы обеспечит коэффициенты, вы узнаете как делать ставки на футбол, хоккей, баскетбол, теннис, бокс, волейбол, виртуальный спорт или пари россии смотря трансляции где проходит лига, смотрите через ваш компьютер (пк). 1win бет скачать мобильное приложение, bukmeker club, go and contact official online website net, www top site for bk xyz
lucky jet скачать
(Bruceabulp, 29. 8. 2022 16:14)
Скачать бесплатно джет пак apk актуальной версии на андроид телефон. Качать и установить казино 1win для заработка на русском где можно воспользоваться выводом киви кошельком, skachat казино, получите денежный приз и воспользуйтесь коэффициентами!
DataFast Proxies | Anonymous IPv6 Proxy
(FloydMog, 28. 8. 2022 0:29)
<b>DataFast Proxies | IPv6 proxies</b>
<i><b>Definitive Solution in IPv6 Proxy! </b></i>
<i>Anonymous IPv6 Proxy, undetectable on L2 and L3 Layers of the OSI model,
100% no DNS leak, no Header leak.</i>
- IPv6 Proxy Geographically Referenced (Geographically Located).
- Rotating or Static IPv6 Proxy (Configurable).
- Dedicated IPv6 Proxy (Virgin IP Proxy).
- 100% Private IPv6 Proxy
- IPv6 proxy with Private server.
- Anti-Ban Agent
- Unlimited Traffic
- Zero Log
https://datafastproxies.com/
Printable calendar
(ToriHut, 27. 8. 2022 10:54)
Wow that was strange. I just wrote an very long comment but after I clicked submit my comment didn't show up. Grrrr... well I'm not writing all that over again. Anyways, just wanted to say wonderful blog!
If you should you have any ideas or tips for my new blog https://indigorosee.com/2021/01/24/how-to-prepare-for-a-successful-semester/ - free monthly calendars please share!
hydra зеркало hydraruzxpnew8onion com
(BlairNEX, 27. 8. 2022 7:19)
hydra зеркало hydraruzxpnew8onion com
Source:
- https://get-firefox.ru/katalog-tovarov/hydra-zerkalo-hydraruzxpnew8onion-com.html
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 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97
Cloudflare
(Robertmoilm, 5. 9. 2022 19:04)