![](/img/trans.png)
[英]How to use the ABCPdf.NET to extract texts from all pages of a PDF file?
[英]Generate PDF from aspx page using abcpdf.net
我有一个网页网址,我想将其转换为PDF。我在网页中使用了abcpdf.net,它在本地主机上工作正常,但在服务器中不起作用。我已经安装了abcpdf.net 6.1版本并添加了abcpdf.dll在我的bin文件夹中。我的服务器是Windows Server 2008 R2。 如果有版本问题,请给我一个建议。
这是我的代码:
string projectid = partnerid;
string versionid = DDLVersion.SelectedItem.Text.ToString().Trim();
string serverurl = "http://serverurl/Design/Pro/Previewtopdf.aspx?PID=" + projectid + "&versionID=" + versionid + "";
Doc theDoc = new Doc();
theDoc.Rect.Inset(10, 30);
theDoc.Page = theDoc.AddPage();
int theID;
theID = theDoc.AddImageUrl(serverurl);
while (true)
{
theDoc.FrameRect(); // add a black border
if (!theDoc.Chainable(theID))
break;
theDoc.Page = theDoc.AddPage();
theID = theDoc.AddImageToChain(theID);
}
for (int i = 1; i <= theDoc.PageCount; i++)
{
theDoc.PageNumber = i;
theDoc.Flatten();
}
theDoc.Save(Server.MapPath("report.pdf"));
theDoc.Clear();
Response.Redirect("report.pdf");
看来您的问题出在:
theDoc.Save(Server.MapPath("report.pdf"));
Response.Redirect("report.pdf");
确保将report.pdf保存在当前请求的目录中。 检查report.pdf是否在正确的服务器目录中idd。 我问它是否保存在其他地方。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.