I am trying to convert multiple single page tiffs to one multi page pdf file. The tiffs are scanned and I have to maintain the dpi of the tiff images while converting them to pdf. Is there a way of doing so? Which compression is used for images while converting to pdf? Following is the code-
Code: Select all
Dim dr As New System.IO.DirectoryInfo(System.IO.Path.GetTempPath & "Scanner_sample")
Dim fl As System.IO.FileInfo() = dr.GetFiles()
Dim imgcnt As Integer
Dim pdfid As Integer = oGdPictureImaging.PdfNewPdf(System.IO.Path.GetTempPath & "Scanner_sample\Multipg_pdf.pdf", "charu", "charu", "charu", "charu", "charu")
For Each fl1 As System.IO.FileInfo In fl
oGdPictureImaging.TiffOpenMultiPageForWrite(True)
Dim m_img As Integer = oGdPictureImaging.CreateGdPictureImageFromFile(fl1.FullName)
If m_img <> 0 Then
imgcnt = oGdPictureImaging.PdfAddImageFromGdPictureImage(pdfid, m_img)
end if
oGdPictureImaging.ReleaseGdPictureImage(m_img)
next
For i As Integer = 1 To imgcnt
oGdPictureImaging.PdfNewPage(pdfid, oGdPictureImaging.PdfGetImageWidth(pdfid, i), oGdPictureImaging.PdfGetImageHeight(pdfid, i))
Call oGdPictureImaging.PdfDrawImage(pdfid, i, 0, 0, oGdPictureImaging.PdfGetImageWidth(pdfid, i), oGdPictureImaging.PdfGetImageHeight(pdfid, i))
Next
oGdPictureImaging.PdfEndPdf(pdfid)
Thanks
Charu