PDF to JPG Loses Color
Posted: Tue Feb 10, 2015 12:13 am
Please advise - We have been using gdPicturePro5 for a long time and have never had any issues until now as stated below. This was written in VFP but if there is a solution to this issue in a later .net version we can go that route too.
In converting certain PDF files to JPG, the JPG seems to be created a lot "brighter" than the original in the PDF. It seems to be trashed right at the DisplayFromPdfFile() method as seen in the sample application viewer, but see no parameters in opening the PDF correctly without losing colors.
Code is at the bottom of this post.
Please view the two JPG's side by side and you will see the bad image is brighter than the good image.
The original PDF is here in case you want to test yourself.
Original PDF: http://www.instantimpact.com/jpgproofs/ ... iginal.pdf
Good JPG exported manually
Bad JPG exported by gdPicture
In converting certain PDF files to JPG, the JPG seems to be created a lot "brighter" than the original in the PDF. It seems to be trashed right at the DisplayFromPdfFile() method as seen in the sample application viewer, but see no parameters in opening the PDF correctly without losing colors.
Code is at the bottom of this post.
Please view the two JPG's side by side and you will see the bad image is brighter than the good image.
The original PDF is here in case you want to test yourself.
Original PDF: http://www.instantimpact.com/jpgproofs/ ... iginal.pdf
Good JPG exported manually
Bad JPG exported by gdPicture
Code: Select all
oPDF = CREATEOBJECT("gdpicturepro5.gdviewer")
oPDF.SetLicenseNumber("11111111111111111111111")
oPDF.LockControl = .T.
oPDF.PdfDpiRendering = 300
oPDF.DisplayFromPdfFile("C:\PDFs\artwork.pdf")
oImage = CREATEOBJECT("gdpicturepro5.imaging")
oImage.SetLicenseNumber("11111111111111111111111")
oImage.SetNativeImage(oImage.CreateClonedImage(oPDF.GetNativeImage))
oImage.SetVerticalResolution(300)
oImage.SetHorizontalResolution(300)
oImage.SaveAsJPEG("C:\JPGs\artwork.jpg", 100)