标签: selectpdf

将 CSS 文件添加到 SelectPdf 转换器

如何向 SelectPdf 转换器添加/引入 CSS 文件?

我使用SelectPdf库将 HTML 字符串转换为 PDF 文件。

我的 CSS 文件位于cssFilePath

public byte[] Create(string htmlString)
{
   string cssFilePath = Path.Combine(Directory.GetCurrentDirectory(), "assets", "PruefReportDataTableFormat.css");

        string pdf_page_size = "A4";
        PdfPageSize pageSize = (PdfPageSize)Enum.Parse(typeof(PdfPageSize), pdf_page_size, true);

        string pdf_orientation = "Portrait";
        PdfPageOrientation pdfOrientation = (PdfPageOrientation)Enum.Parse(typeof(PdfPageOrientation), pdf_orientation, true);

        int webPageWidth = 1024;
        int webPageHeight = 0;

        HtmlToPdf converter = new HtmlToPdf();

        converter.Options.PdfPageSize = pageSize;
        converter.Options.PdfPageOrientation = pdfOrientation;
        converter.Options.WebPageWidth = webPageWidth;
        converter.Options.WebPageHeight = webPageHeight;

        PdfDocument doc = converter.ConvertHtmlString(htmlString);
        byte[] result = doc.Save(); …
Run Code Online (Sandbox Code Playgroud)

c# converters html-to-pdf selectpdf

6
推荐指数
1
解决办法
3917
查看次数

无法获取转换结果标头。数据传输错误。数据传输错误109

我正在使用“用于.NET的SelectPdf Html到Pdf转换器–社区版”生成pdf文件。在Live服务器上一切正常。当我尝试生成pdf文件时,突然出现错误。

如果我重新启动服务器,它可以正常工作一段时间,但是一段时间后,错误再次开始出现。

我正在使用该库的最新版本。以下是错误的完整详细信息

无法获取转换结果标头。数据传输错误。数据传输错误109

错误详情

System.Exception
无法获取转换结果标头。数据传输错误。数据传输错误109

System.Exception:无法获取转换结果标头。数据传输错误。数据传输错误109

在SelectPdf.HtmlToPdf。(字符串
A_0,字符串A_1,字符串A_2,字符串A_3,布尔值A_4)
在SelectPdf.HtmlToPdf 。?(字符串A_0,字符串A_1,字符串A_2,?[]&A_3,?&A_4).HtmlToPdf.ConvertHtmlString(String htmlString,String baseUrl)
在BusinessLogic.SalaryManager.ConvertToPDF(SalarySlipExtra salalSlip,字符串标题,字符串模板,String baseUrl)
在BusinessLogic.SalaryManager.PrintSlips(列出1个id,布尔值isPrint)1 Ids, String baseUrl)
at SchoolMS.Web.Controllers.api.Manage.ApproveSalaryController.Post(List

c# asp.net selectpdf

6
推荐指数
1
解决办法
550
查看次数

SelectPdf Html 转 PDF 图像未出现

我正在使用 SelectPDF 将 HTML 转换为 PDF

html 中有一个图像部分:

<div>
    <img src="images\picture.png" alt="Logo">
</div>
Run Code Online (Sandbox Code Playgroud)

在 html 中查看页面没有问题,但是转换 html 时图片不会出现。

selectpdf

2
推荐指数
1
解决办法
3791
查看次数

尝试使用 selectpdf 获取 javascript 错误

在 C# 中使用 selectPDF 将 URL 转换为 PDF。很明显有一些 javascript 错误。有没有办法在转换发生时获取错误,以便我可以看到发生了什么?

selectpdf

0
推荐指数
1
解决办法
228
查看次数

标签 统计

selectpdf ×4

c# ×2

asp.net ×1

converters ×1

html-to-pdf ×1