I have an application that must receive scanned documents at various resolutions, and I want to standardize (at 150dpi) the images. There is one image per page.
I have tried the following:
Code: Select all
If InputPDF.LoadFromFile(pdfPath, False) = GdPicture.GdPictureStatus.OK Then
For i As Integer = 1 To InputPDF.GetPageCount()
'j2kPath = Mid(pdfPath, 1, Len(pdfPath) - 4) & "pg" & i & ".j2k"
InputPDF.SelectPage(i)
rastPage = InputPDF.RenderPageToGdPictureImage(150, False)
Dim image_res_name As String = InputPDF.AddImageFromGdPictureImage(rastPage, False, False)
myPage.ReleaseGdPictureImage(rastPage)
executedGdPCmd = InputPDF.ClearPageContent()
InputPDF.SetOrigin(PdfOrigin.PdfOriginTopLeft)
InputPDF.SetMeasurementUnit(PdfMeasurementUnit.PdfMeasurementUnitInch)
InputPDF.DrawImage(image_res_name, 0, 0, 8.5, 11)
' myPage.SaveAsJ2K(rastPage, j2kPath, 32)
Next i
InputPDF.SaveToFile(OutputFilePath)
Else
'report out reason for problem.
Dim errCode As Integer = InputPDF.GetStat()
...
End If
InputPDF.CloseDocument()
I am able to write to disk the individual pages as j2ks, so the rasterization seems to work.
Thanks for your help,
Leo