c# - Generate PDF from aspx page using abcpdf.net -
I have a web page URL and I want to convert it to PDF. I have abcpdf.net in my webpage and its work is fine in the local host but is not working on the server. I have installed the abcpdf.net 6.1 version and added abcpdf.dll to my bin folder. My server is Windows Server 2008 R2. If there is a version problem, please give me a suggestion.
Here's my code:
string projectid = partnerid; String versionid = DDLVersion.SelectedItem.Text.ToString (). Trim (); String serverurl = "http: //serverurl/Design/Pro/Previewtopdf.aspx?PID =" + projectid + "& versionID =" + versionid + ""; Doctor theDoc = new doctor (); TheDoc.Rect.Inset (10, 30); TheDoc.Page = theDoc.AddPage (); Int theID; TheID = thedoc.AddImageUrl (serverurl); While (true) {theDoc.FrameRect (); // Add a black border if (! The.Doc.Chainable (theID) break); TheDoc.Page = theDoc.AddPage (); TheID = thedoc.AddImageToChain (theID); } (Int i = 1; i & lt; = thedoc.PageCount; i ++) {theDoc.PageNumber = i; TheDoc.Flatten (); } The.Doc.Save (Server.MapPath ("report.pdf")); TheDoc.Clear (); Response.Redirect ("report.pdf");
It seems that your problem is:
< Code> theDoc.Save (Server.MapPath ("report.pdf")); Response.Redirect ("report.pdf"); Ensure that you are saving report.pdf in the directory of your current request. Check that the report is in PDF server's correct directory. I know that it is saved somewhere else.
Comments
Post a Comment