I am having a hard time adding a dynamic image using a parameter to my pdf/report.
I'm getting the following error when I initialize the report layout:
System.ArgumentException: Illegal characters in path.
Its not the image, because I can add it as a static image.
Im referencing the parameter in Designer as #Parameters["ImagePath"]#, and adding it to my parameter dictionary.
Any ideas here?
Thanks,
Greg
image as parameter
Re: image as parameter
Support · Jan 10, 2008Actually Greg, you can not pass a Parameter Dictionary value into the file path of the image. That is the reason you are getting the error (specifically the error is being thrown because a file path can not contain the double quote character).
But regardless, you can still achieve the results you want you will just need to go about it differently. The general idea is that you will need to put a PlaceHolder object on your Report (where ever you were previously placing your Image and you can use the same X, Y, Height and Width as the Image had), and then at runtime call the PlaceHolder's LaidOut event and in that event create a BackgroundImage with your dynamic file path. That will fill the entire ContentArea of the PlaceHolder with the image specified.
A similar process is demonstrated in our Help documentation using a Barcode in the "Handling Events" section, http://www.DynamicPDF.com/Support/NET_Help_Library_07_03/Handling%20Events%20in%20Web%20Form.html
In general, keep in mind that the Parameter Dictionary values can only be referenced inside Record elements (Area, Box or Formatted) or inside the building of your Query.
Thanks,
ceTe Software Support Team
Re: image as parameter
Forum member · Jan 10, 2008OK, so after
PlaceHolder placeHolder = (PlaceHolder)pdfReport.GetElementById("placeHolder");
placeHolder.LaidOut += new PlaceHolderEventHandler(placeHolder_LaidOut);
I think I need something like this:
public void placeHolder_LaidOut(object sender, PlaceHolderLaidOutEveutEventArgs e)
{
BackgroundImage image = new BackgroundImage(e.LayoutWriter.RecordSets.Current["placeHolder"].ToStrng());
e.ContentArea.Add(image);
}
Except I seem to be missing one thing... a method or means to pass my image string to the BackGroundImage object. Im sure Im missing something trivial.
Where does that fit in?
Many thanks,
Greg
Re: image as parameter
Forum member · Jan 10, 2008Duh... :)
public void placeHolder_LaidOut(object sender, PlaceHolderLaidOutEveutEventArgs e)
{
BackgroundImage image = new BackgroundImage(_imagePath);
e.ContentArea.Add(image);
}
Still not quite working, but Im getting closer...
Re: image as parameter
Support · Jan 11, 2008Hello Greg,
What exact problem are you having? Are you not seeing the image or are you getting any errors? Please be more specific on what kind of problem are you getting.
Thanks,
ceTe Software Support Team.