0

我正在使用以下代码使用 ExpertPDF v7.0 生成 PDF

 pdfConverter.PdfDocumentOptions.PdfPageSize = ExpertPdf.HtmlToPdf.PdfPageSize.Letter
 pdfConverter.PdfDocumentOptions.PdfCompressionLevel = ExpertPdf.HtmlToPdf.PdfCompressionLevel.Normal
 pdfConverter.PdfDocumentOptions.PdfPageOrientation = ExpertPdf.HtmlToPdf.PDFPageOrientation.Portrait

 ' set if header and footer are shown in the PDF - optional - default is false 
 pdfConverter.PdfDocumentOptions.ShowHeader = False
 pdfConverter.PdfDocumentOptions.ShowFooter = False
 ' set to generate a pdf with selectable text or a pdf with embedded image - optional - default is true

 pdfConverter.PdfDocumentOptions.GenerateSelectablePdf = True

 ' set if the HTML content is resized if necessary to fit the PDF page width - optional - default is true
 pdfConverter.PdfDocumentOptions.FitWidth = True
 pdfConverter.PdfDocumentOptions.StretchToFit = True

 'pdfConverter.PdfDocumentOptions.AutoSizePdfPage = True
 ' set the embedded fonts option - optional - default is false
 ' pdfConverter.PdfDocumentOptions.EmbedFonts = True
 ' set the live HTTP links option - optional - default is true
 'pdfConverter.PdfDocumentOptions.LiveUrlsEnabled = True
 pdfConverter.PdfDocumentOptions.LeftMargin = 36
 pdfConverter.PdfDocumentOptions.RightMargin = 36
 pdfConverter.PdfDocumentOptions.TopMargin = 36
 pdfConverter.PdfDocumentOptions.BottomMargin = 36
 pdfConverter.PageWidth = 756
 pdfConverter.AvoidImageBreak = True

然后对 PDF 阅读器的实际调用如下:

 objFile = pdfConverter.GetPdfDocumentObjectFromHtmlString(htmlString, baseURL)

我正在使用此工具生成一批文档,并附有 jpeg 格式的收据。不幸的是,当我收到一批有很多收据的时候,图像就会停止出现。对于少数人,它们只是停止随机出现(图像被经典的红色小 X 图标替换),并且对于大量图像,所有图像都无法加载。

这似乎与文档中的图像数量直接相关(因为大批量的子集和其他小作业都可以正常工作)。我还通过简单地将大量图像添加到我们的费用报告(收据最初上传的地方)来复制这一点。

有没有人遇到过这个问题或有解决方案?

4

1 回答 1

1

尝试将 pdfConverter.ConversionDelay 设置为几秒钟以允许您的页面加载。我正在使用带有此属性的 ExpertPdf v9,它工作正常。

于 2014-01-24T12:01:36.977 回答