I have an error when i pass a pdf file to loadbitmap function: unknown format.
Do you know the solution to convert pdf to png?
Here is the code:
Code: Select all
Dim inputDocument As PdfDocument = PdfReader.Open(strPdfFile, PdfDocumentOpenMode.ReadOnly)
Dim numberPages As Integer = inputDocument.PageCount
' utilisation de la bibliothèque GFLAx pour convertir le rapport PDF en plusieurs images PNG
Dim gflax__1 As New GflAx.GflAxClass()
gflax__1.EpsDpi = dpi
If numberPages = 1 Then
gflax__1.LoadBitmap(strPdfFile)
gflax__1.SaveFormat = GflAx.AX_SaveFormats.AX_PNG
gflax__1.SaveBitmap(strPdfFile)
Else
For i As Integer = 1 To numberPages
gflax__1.Page = i
gflax__1.LoadBitmap(strPdfFile)
gflax__1.SaveFormat = GflAx.AX_SaveFormats.AX_PNG
gflax__1.SaveBitmap(((Path.GetDirectoryName(strPdfFile) & "\") _
+ Path.GetFileNameWithoutExtension(strPdfFile) & "_Page") _
+ i.ToString() & ".pdf")
Next
End If
inputDocument.Close()
Anoho