C# NReco PDF生成器禁用选择
我想禁用选择,就像图像一样,即使包含文本 我知道PDF包含层,但我找不到删除文本层的位置 谢谢C# NReco PDF生成器禁用选择,c#,nreco,C#,Nreco,我想禁用选择,就像图像一样,即使包含文本 我知道PDF包含层,但我找不到删除文本层的位置 谢谢 var htmlToPdf = new NReco.PdfGenerator.HtmlToPdfConverter(); htmlToPdf.Size = NReco.PdfGenerator.PageSize.Letter; htmlToPdf.Margins = new NReco.PdfGenerator.PageMargins()
var htmlToPdf = new NReco.PdfGenerator.HtmlToPdfConverter();
htmlToPdf.Size = NReco.PdfGenerator.PageSize.Letter;
htmlToPdf.Margins = new NReco.PdfGenerator.PageMargins()
{
Bottom = 0,
Top = 0,
Left = 0,
Right = 0
};
string ID = "Test";
Response.ContentType = "application/pdf";
Response.AppendHeader("content-disposition", string.Format("inline;FileName=\"{0}.pdf\"", ID));
htmlToPdf.GeneratePdfFromFile("Page.aspx", null, Response.OutputStream);
Response.End();
PdfGenerator在内部使用wkhtmltopdf,它将文本内容呈现为文本块,默认情况下它们是可选的;此行为无法更改。如果要保证无法选择文本,则应将其呈现为图像(=可以先将HTML呈现为图像,然后生成包含此图像的PDF) 另一种选择是使用iTextSharp对生成的PDF进行加密,有关详细信息,请参见答案 -仅使用PdfWriter.ALLOW_打印选项(iTextSharp的LGPL版本4.1.6可用于此目的)