A newbie to isedquickpdf:
Had looked around most of the alternatives which either were inadequate for my needs or had a hefty royalty for redistribution
Found this forum helpful so I thought I'd put a brief sample code back.
LoadPDFFileAsBM returns a VB picture containing the 1st page of a PDF file. Syntax is very similar to the VB LoadPicture function but has an optional quality setting. There probably is a slightly faster way using setdibits rather than writing to filebut below code works reliably and not too slow.
Usage:
PictureBox1= LoadPDFFileAsBM("MyPDFFile.pdf")
Public Function LoadPDFFileAsBM(FN As String, Optional PDFQuality As Integer = 72) As StdPicture Dim QP As iSED.QuickPDF Dim TempFN As String Dim TempFN1 As String TempFN = "pdf2bmp.bmp" TempFN1 = "pdf2bmp1.bmp" Dim succ As Long Dim i As Integer On Error GoTo handler: Set QP = CreateObject("iSED.QuickPDF") If Not IsObject(QP) Then MsgBox "Could not load isedquickpdf.dll" Else With QP If .UnlockKey(PDFKey) <> 1 Then MsgBox "Could not unlock isedquickpdf.dll" Else Screen.MousePointer = vbHourglass If ThisFileExists(TempFN1) Then Kill TempFN1 succ = .LoadFromFile(FN) .Unencrypt succ = .RenderDocumentToFile(PDFQuality, 1, 1, 0, TempFN) For i = 0 To 100 DoEvents If ThisFileExists(TempFN1) Then Exit For Next If ThisFileExists(TempFN1) Then Set LoadPDFFileAsBM = LoadPicture(TempFN1) Kill TempFN1 End If End If End With Set QP = Nothing Screen.MousePointer = vbDefault End If Exit Function handler: Select Case MsgBox("Error " & Err.Number & vbCrLf & _ Err.Description, vbAbortRetryIgnore, "Error LoadPDFFileAsBM") Case vbRetry: Resume Case vbIgnore: Resume Next End Select Set QP = Nothing Screen.MousePointer = vbDefault End Function
Public Function ThisFileExists(ThisFile As String) As Boolean
On Error GoTo handler: ThisFileExists = False GetAttr ThisFile ThisFileExists = True Exit Function handler: End Function
|