photohandler

photohandler

Forum member · Aug 11, 2008
I'm trying to add an image to a pdf. The image will be delivered by a photohandler. The way I tried to do this is: String path = "D:\\Website\\Handlers\\PhotoHandler.ashx? Document document = new Document(); Page page = new Page(); FileName = "D:\\Website\\Handlers\\PhotoHandler.ashx?FileName=Default\\Organisation\\Large.jpg"; Image image = new Image(path, 0, 0); page.Elements.Add(image); document.Pages.Add(page); document.Draw("D:\\image.pdf"); However I get the error message: "Illegal characters in path." Could you please help me out? btw: complements for the software: DynamicPDF. It's easy to use and very fast.

Re: photohandler

Support · Aug 11, 2008
Hello, In order to add images you will have to give the physical path. However you can add the images from byte array or a stream of the image without any problem by using the ImageData class. You will have to get the stream or byte array of the image and then you can use the ImageData class to create an image. You can refer to the Images on our help documentation. You can also refer to the following code which adds the image to the PDF from a URL. Document document = new Document(); Page page = new Page(); string url = @"http://url/image.gif"; WebClient wc = new WebClient(); byte[] ReadByteBuffer = wc.DownloadData(url); Image image = new Image(ImageData.GetImage(ReadByteBuffer), 0, 0); page.Elements.Add(image); document.Pages.Add(page); document.DrawToWeb(); Thanks, ceTe Software Support Team.