GDPicture 8.5.0.20 problem with SetOrigin

Discussions about PDF management.
Post Reply
coolwater
Posts: 15
Joined: Wed Nov 09, 2011 6:45 pm

GDPicture 8.5.0.20 problem with SetOrigin

Post by coolwater » Sat Mar 17, 2012 12:02 am

::bug::

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");
            


User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: GDPicture 8.5.0.20 problem with SetOrigin

Post by Loïc » Mon Mar 19, 2012 1:19 pm

Hello,

This is not a bug. The problem was in previous versions.

This method is a little tricky since DstX and DstY parameters are the coordinates on the bottom-left corner of the image (check reference guide for example).

Let me know if you need further info.

Kind regards,

Loïc

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest