After using the PdfReaderRenderPageToGdPictureImage method , and using TiffSaveAsMultiPageFile(MultiPageID, ImagefileName, TiffCompression.TiffCompressionAUTO)
the tiff pages are always LZW compressed, instead of what I was hoping for, CCITT4
Does the output from PdfReaderRenderPageToGdPictureImage always do this, and is there a workaround
Thanks,
Scott
Code: Select all
Public Function PDFtoTIFF(ByVal FileName As String) As String
Dim MultiPageID As Integer = 0
Try
'this is just a call to a method to create a unique file name
Dim ImagefileName As String = CreateNewFileName("tif")
'PDF to converted
Dim InputPDFID As Integer = GDP.PdfReaderLoadFromFile(FileName)
Dim pageCount As Integer = GDP.PdfReaderGetPageCount(InputPDFID)
Dim cStat As GdPictureStatus = GdPictureStatus.OK
For nImageCount As Integer = 1 To pageCount
If GDP.PdfReaderSelectPage(InputPDFID, nImageCount) = True Then
Dim ImageID As Integer = GDP.PdfReaderRenderPageToGdPictureImage(InputPDFID, 300, True)
If ImageID <> 0 Then
If nImageCount = 1 Then
MultiPageID = ImageID
Debug.Print(GDP.IsBitonal(ImageID).ToString)
Debug.Print(GDP.GetBitDepth(ImageID).ToString)
cStat = GDP.TiffSaveAsMultiPageFile(MultiPageID, ImagefileName, TiffCompression.TiffCompressionAUTO)
Application.DoEvents()
Else
Debug.Print(GDP.IsBitonal(ImageID).ToString)
Debug.Print(GDP.GetBitDepth(ImageID).ToString)
cStat = GDP.TiffAddToMultiPageFile(MultiPageID, ImageID)
Application.DoEvents()
GDP.ReleaseGdPictureImage(ImageID)
End If
End If
If cStat <> GdPictureStatus.OK Then
Throw New ApplicationException("Conversion failed")
End If
Else
Throw New ApplicationException("Conversion failed")
End If
Next nImageCount
Catch ex As Exception
'just a method to alert user
'Info(Constants.msgUnableToConvert)
Return ""
End Try
GDP.TiffCloseMultiPageFile(MultiPageID)
GDP.ReleaseGdPictureImage(MultiPageID)
Return ImagefileName
End Function