Click here to Skip to main content
15,894,630 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I'm developing windows application.I have generate the pdf file using pdfsharp.While adding the image from file.It has thrown error like this.

My code is
C#
XImage image = XImage.FromFile(‪‪‪"C:\Users\xyz\Desktop\img1.jpg");
xg.DrawImage(image, 20, 20, 250, 140);
Posted
Updated 6-Jan-15 20:50pm
v3
Comments
Kornfeld Eliyahu Peter 7-Jan-15 2:50am    
What the error is?
Member 12057131 23-Dec-15 2:14am    
i am pavan.im using ASp.in that im calling the AddLogo(gfx, invoice, "pathtoimage", 0, 0) to add a image to pdf using pdfsharp.
method is
protected void AddLogo(XGraphics gfx, string jpegSamplePath, int x, int y, int width, int height)
{
XImage xImage = XImage.FromFile("/Images/Factorh_logo.png");
gfx.DrawImage(xImage, x, y, xImage.PixelWidth, xImage.PixelWidth);
}
but im getting error at invoice like invoice is doesnt exist in the current context...i dont understand what should i do..plz help me frnds..
Thank you in advance,
Pavan.

1 solution

I got a solution.

XImage image = XImage.FromFile(@"C:\Users\xyz\Desktop\img1.jpg");
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900