After upgrading to GdPicture 8.5.0.20, the code below now saves a blank PDF file instead of a JPEG image in a PDF file. I removed the pdf.SetOrigin(PdfOrigin.PdfOriginTopLeft), and the image now shows up. Not perfect, but at least it's not a blank screen.
I didn't see any change log entries that says something about a change of behavior for the PdfOrigin. The code below expects that the code will start placing the JPEG image from the top left corner, and ends on the bottom right corner. How do I do this with the new code? And, is this a permanent behavior for GdPicture 8.5.0.20 and above.
Thanks!
Code: Select all
var pdf = new GdPicturePDF();
pdf.NewPDF();
pdf.SetMeasurementUnit(PdfMeasurementUnit.PdfMeasurementUnitInch);
pdf.SetOrigin(PdfOrigin.PdfOriginTopLeft);
pdf.NewPage(8.25f, 10.68f);
using (var gdImage = new GdPictureImaging())
{
var imageId = gdImage.CreateGdPictureImageFromFile(@"C:\source.jpg");
var imageResName = pdf.AddImageFromGdPictureImage(imageId, false, false);
pdf.DrawImage(imageResName, 0, 0, 8.25f, 10.68f);
}
pdf.SaveToFile(@"C:\Users\mmadlangbayan\Desktop\target.pdf");