PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

Cannot draw an image (jpeg)
https://forum.pdfsharp.net/viewtopic.php?f=2&t=3867
Page 1 of 1

Author:  boba21 [ Wed Nov 14, 2018 2:50 am ]
Post subject:  Cannot draw an image (jpeg)

Hi, Im trying your sample code for draw an image (jpg) to pdf. Below is my code.

Code:
           // Create a new PDF document
            PdfDocument document = new PdfDocument();
            PdfPage page = document.AddPage();
            XGraphics gfx = XGraphics.FromPdfPage(page);

            XImage image = XImage.FromFile("D:\\imageFile.jpg");

            // draw image to pdf
            gfx.DrawImage(image, 0, 0, 250, 140);

            // Save the document...
            string filename = "D:\\test.pdf";
            document.Save(filename);


But it not working, it gave me an error. Can anyone help me?
Here I attach the error.

Author:  Thomas Hoevel [ Wed Nov 14, 2018 9:22 am ]
Post subject:  Re: Cannot draw an image (jpeg)

Hi!

This question is not about our library.
I cannot help you with problems that occur with ports of our library. Take the source code of that port and debug it yourself.
Or use the sample code that comes with the port.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/