Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
229
Adding an Image to a PDF report (Winform)
posted

Hi,

I am coding a pdf report and I cannot figure out how to add an image to it. Adding text works all fine but this does not compile:

                Infragistics.Documents.Reports.Graphics.Image myPicture = section.AddImage(new Infragistics.Documents.Reports.Graphics.Image("MyImage.jpg"));

Error CS0266 Cannot implicitly convert type 'Infragistics.Documents.Reports.Report.IImage' to 'Infragistics.Documents.Reports.Graphics.Image'. An explicit conversion exists (are you missing a cast?) 

How can I get this to work?

TIA

Erik

  • 23930
    Offline posted

    Hi Erik,

    Thank you for contacting Infragistics Developer Support.

    This error happens, because the AddImage doesn’t return Infragistics.Documents.Reports.Graphics.Image report, but actually an Infragistics.Documents.Reports.Report.IImage object. So naturally the application can’t compile, because you have defined the myPicture object as Infragistics.Documents.Reports.Graphics.Image. Simply change its time to IImage and the application will compile.

    I have attached a small sample which demonstrates how to add an image to a PDF file.

    Let me know if you have any additional questions.

    PDF_AddImage.zip