【发布时间】:2015-08-28 12:06:44
【问题描述】:
我正在使用TuesPechkin(wkhtmltopdf 的 C# 包装器)并让它从 HTML 生成 PDF 文件。
但是,我想设置 --disable-smart-shrinking 选项,它在 wkhtmltopdf documentation 中作为 PageOption 列出
我该怎么做?
public sealed class PdfConverter
{
static readonly PdfConverter instance = new PdfConverter();
private IConverter converter;
static PdfConverter()
{
}
PdfConverter()
{
// Keep the converter somewhere static, or as a singleton instance! Do NOT run this code more than once in the application lifecycle!
this.converter = new ThreadSafeConverter( new RemotingToolset<PdfToolset>( new Win32EmbeddedDeployment( new TempFolderDeployment())));
}
public static PdfConverter Instance
{
get { return instance; }
}
public byte[] ConvertHtmlToPdf(string html)
{
var document = new HtmlToPdfDocument
{
Objects = { new ObjectSettings { HtmlText = html } }
// Where are PageOptions? Thats where --disable-smart-shrinking is
};
return converter.Convert(document);
}
}
【问题讨论】:
标签: c# .net wkhtmltopdf tuespechkin