I have an aspx page with a calendar control on it. When I try to print this page to PDF none of my images or calendar gridlines are showing up. However when I go directly to the page everything is fine. Also I had this working on our dev server but once it was moved to a new server all the images and the gridlines stopped appearing. I have tried a few suggestions on here such as using full file paths for images with no success. Has anyone run into a similar issue? I put my code for creating the PDF below though I don't think that's the issue since I had it working on a different server before.

string url = HttpContext.Current.Request.Url.AbsoluteUri;
int lastDash = url.LastIndexOf('/');
url = url.Remove(lastDash + 1);
url += "print.aspx";
theDoc.AddImageUrl(url, true, width , true);
theDoc.Flatten();

theDoc.Clear();
有帮助吗?

解决方案

I added the line of code below and the images and lines are now appearing. Though this answered my question the printed pages is very screwed now and needs to be fixed.

Doc theDoc = new Doc();
theDoc.HtmlOptions.Engine = EngineType.Gecko;
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top