【发布时间】:2020-06-19 12:41:25
【问题描述】:
我正在使用Select PDF - Community Edition 来呈现网页的输出(例如文档)。当我查看 PDF 时...网格中的数据是空的。
- 是的,网格数据在正常查看时会呈现
- 附带说明...我正在使用 Kendo Grids
作为一个实验...我将"MinPageLoadTime" 属性设置为 15 秒...确实需要 15 秒才能执行 SAVE...但奇怪的是,在 PDF 的渲染中仍然没有显示任何记录网格。
public byte[] ToPDF(IPdfConverterArgs args)
{
if (args == null)
throw new ArgumentNullException();
if (!(args is SelectPdfUrlConverterArgs))
throw new ArgumentException(string.Format("Args.Type '{0}' is not a valid type.", typeof(SelectPdfUrlConverterArgs).Name));
var arguments = args as SelectPdfUrlConverterArgs;
if (string.IsNullOrWhiteSpace(arguments.Url))
throw new ArgumentNullException();
var pdfPageSize = (PdfPageSize)Enum.Parse(typeof(PdfPageSize), arguments.PdfPageSize, true);
var pdfOrientation = (PdfPageOrientation)Enum.Parse(typeof(PdfPageOrientation), arguments.PdfOrientation, true);
HtmlToPdf converter = new HtmlToPdf();
converter.Options.PdfPageSize = pdfPageSize;
converter.Options.PdfPageOrientation = pdfOrientation;
converter.Options.WebPageWidth = arguments.WebPageWidth;
converter.Options.WebPageHeight = arguments.WebPageHeight;
converter.Options.MinPageLoadTime = arguments.MinPageLoadTime; //<<< In my testing...I temporarily set this to 15 (for seconds)
PdfDocument doc = converter.ConvertUrl(arguments.Url);
var bytes = doc.Save();
return bytes;
}
【问题讨论】: