Question

I know that in the "Insertable Objects" tab on the Components window, that there is "Adobe Acrobat Document," but that isn't really what I'm looking for. I'm not sure what the "Adobe Acrobat 7.0 Browser Control Type Library 1.0" (created an error when I tried to use it) is in the "Controls" tab.

Here is the functionality that I need:

  • read how many pages are in a PDF file
  • import each page as a background into a picturebox

I saw this here on SO regarding converting PDF's to TIFF's, so I'm not sure if this would be the best way to go? https://stackoverflow.com/questions/2...rt-pdf-to-tiff ; I downloaded ImageMagick and am not sure how to use it, but I'll be looking into it (not sure whether I have to use "Shell" on ImageMagick's convert.exe or if there is a better way [like using a DLL])

I also saw this: http://www.quickpdflibrary.com/faq/c...age-to-pdf.php

This one looked promising, but it appears to be for .NET: http://social.msdn.microsoft.com/For...-c1d98a90a2a2/

I'll be working on this, but anything to point me in the right direction is appreciated and detailed information is greatly appreciated -- maybe even rewarded with a bounty. ;)

Was it helpful?

Solution

If a commercial library is an option for you, you could try with Amyuni PDF Creator ActiveX. You could embed it in your application as a viewer, or you could use the method ExportToJPeg_Method and load the resulting images in your picturebox instead.

Sample code:

On Error GoTo report_error
With PDFCreactiveX1
.Open "test.pdf", ""
'export the PDF file to JPEG format with the resolution=300 and
'compression level=9.
.ExportToJPeg "exportJpeg.jpg", 300, 9
End With

You could also use ImageMagic for PDF to image conversion by using shell execution:

Shell "convert v.pdf v%d.png"

Be aware that ImageMagic "PDF to image" conversion requires ghostscript, which is a GPL project, which means that you are not supposed to use it for free in a commercial closed-source application.

Usual disclaimer applies for the first suggestion

OTHER TIPS

Hmm, there is another option, that is if you don't mind writing a com wrapper for a .net module. It doesn't appear to be all that complicated, but may not be worth the time to you. Anyways it is called ItextSharp, and sadly, no one has posted the com wrappers for download, but the MSDN has how-to guides on writing them. I hope this helps.

Sources: -Personal Experience involving PDF files and VB6.

If anyone needs to preview it, you can use this code snippet:

ShellExecute Me.hWnd, vbNullString, "c:\MyPDFFile.pdf", vbNullString, vbNullString, vbNormalFocus
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top