我已經嘗試了多個插件和c#類來嘗試将我的asp.net項目上的HTML和CSS轉換為pdf,即使使用的代碼看起來很好,并且按鈕點選适用于其他功能,我似乎無法得到任何HTML到PDF功能工作。有沒有其他人遇到過這種情況,或知道是否有什麼我錯過了解決它?ASP.NET将HTML轉換為PDF
這是我在C#中嘗試了hiqpdf的最新代碼:
protected void Print_Button_Click(object sender, EventArgs e)
{
HtmlToPdf htmlToPdfConverter = new HtmlToPdf();
// set PDF page size, orientation and margins
htmlToPdfConverter.Document.PageSize = PdfPageSize.A4;
htmlToPdfConverter.Document.PageOrientation = PdfPageOrientation.Portrait;
htmlToPdfConverter.Document.Margins = new PdfMargins(0);
// convert HTML to PDF
htmlToPdfConverter.ConvertUrlToFile("http://localhost:51091/Printout","mcn.pdf");
}
+0
這是什麼意思,它不工作?錯誤?請更具體一些。 –
+0
Hi @SamiKuhmonen,運作代碼時沒有任何反應 –