如果图像 src 属性引用图像文件夹,则它会在 pdf 文件中呈现。如果 src 属性引用内部 url,则不会呈现图像。另一个图像存储在数据库中,这就是我需要指定 url 的原因。
是否需要在图片的 src 属性中指定完整路径?
还是pdf引擎能够像浏览器一样提取图像?
我有以下 html 发送给转换器:
相关片段……
<div class="span12">
<img src="AccessPoint.aspx?action=Report.EditRecord.Start&html=TestUpload.html&script=Show&no_transaction=true&fileid=69">
<img src="images/imgWordDoc.gif">
</div>
我使用以下代码生成pdf:
// byte[] pdfBytes = pdfConverter.GetPdfBytesFromHtmlString(html.ToString());
// send the PDF document as a response to the browser for download
//response.AddHeader("Content-Type", "binary/octet-stream");
string strFileName = "PrintToPDF.pdf";
if (template_defaults["PDF_REPORT_NAME"] != null)
strFileName = template_defaults["PDF_REPORT_NAME"].ToString() + ".pdf";
response.AddHeader("Content-Disposition",
"attachment; filename=" + strFileName + ";size=" + pdfBytes.Length.ToString());
response.ContentType = "application/pdf";
response.Flush();
response.BinaryWrite(pdfBytes);
m_error_log.WriteLine("pdf html = " + html.ToString(), iErrorLog.TITLE2);
response.Flush();