Base64 字符串编码的图像未加载到输出 PDF (TuesPechkin / Wkhtmltopdf)
Posted
技术标签:
【中文标题】Base64 字符串编码的图像未加载到输出 PDF (TuesPechkin / Wkhtmltopdf)【英文标题】:Base64 string encoded Images not loading on the output PDF (TuesPechkin / Wkhtmltopdf) 【发布时间】:2021-11-30 02:20:58 【问题描述】:公平的警告:这篇文章有点像论文大小的问题......所以让我先感谢任何通过它并试图回答它的人。
上下文:
我一直在尝试我能找到的唯一 2 个免费商业使用的开源 html 到 pdf 转换库。
不幸的是,PDFSharp 输出的 pdf 样式布局完全凌乱,不尊重输入 HTML 的格式,有时也无法正确输出图像。 (如何should've look 与如何looks with PDF#)
另一方面,TuesPechkin(wkhtmltopdf c# 包装库)除了只输出这些odd "image containers"(图像supposedly should be 的空心轮廓)之外,一切正常。
我在调用我的类的构造函数时声明了 IConverter 对象,如下所示:converter = new ThreadSafeConverter( new RemotingToolset<PdfToolset>( new Win64EmbeddedDeployment( new TempFolderDeployment())));
然后我有以下方法,您可以在其中找到我当前用于转换的 GlobalSettings 和 ObjectSettings。
/// <summary>
/// Method for converting an .EML's HTML Body to a PDF
/// </summary>
/// <param name="html">The HTML to be converted</param>
/// <param name="usern">Optional: Username for file naming</param>
/// <param name="idx">Optional: Index for file naming</param>
public void Convert2PDF(string html, string usern = null, int? idx = null)
string userName = usern ?? "test";
var document = new HtmlToPdfDocument
GlobalSettings =
ProduceOutline = true,
DocumentTitle = userName.Split('@')[0] + "__" + idx.Value.ToString(),
PaperSize = PaperKind.A4,
Margins =
Left = 6,
Top = 4,
Right = 6,
Bottom = 8,
Unit = Unit.Millimeters
,
UseCompression = false
,
Objects =
new ObjectSettings HtmlText = html,
WebSettings = new WebSettings
EnableIntelligentShrinking = false,
DefaultEncoding = "UTF-8",
LoadImages = true,
PrintBackground = true,
,
FooterSettings = new FooterSettingsCenterText = "[page]",
;
byte[] bolb = converter.Convert(document);
File.WriteAllBytes(Path.Combine(mailBoxDirPath, ".PDFs", userName.Split('@')[0] + "__" + idx.Value.ToString() + "__with_TuesPechkin__" + ".pdf"), bolb);
/* ↑ TuesPechkin */
/* ↓ PdfSharp */
byte[] blob = null;
using(MemoryStream ms = new MemoryStream())
PdfDocument pdf = PdfGenerator.GeneratePdf(html,PageSize.A4,/*margin from border to content ==*/ 0);
pdf.Save(ms);
blob = ms.ToArray();
userName = usern ?? "test";
File.WriteAllBytes(Path.Combine(mailBoxDirPath, ".PDFs", userName.Split('@')[0] + "__" + idx.Value.ToString() + "__with_PDF#__" + ".pdf"), blob);
这个“HTML”字符串是从我正在使用的另一个库的输出中获得的每次有一张图片时都会切换图片的 CID,下面的代码使用 MailKit/MimeKit 的工具:
...
foreach (MimePart part in temp.BodyParts)
if (!part.IsAttachment && part.ContentId != null)
using (Stream stream = new MemoryStream())
part.Content.WriteTo(stream);
stream.Flush();
stream.Seek(0, SeekOrigin.Begin);
using (StreamReader sr = new StreamReader(stream))
string cid = string.Format("src=\"cid:0", part.ContentId);
string data = string.Format("src=\"data:0/1;2,\n3", part.ContentType.MediaType, part.ContentType.MediaSubtype, part.ContentTransferEncoding, sr.ReadToEnd());
rValue.Replace(cid, data);
...
旁注:“temp”是我的 MimeMessage。
这里将是整个字符串构建过程以供参考。我通常在 HTML 预览器上测试这些输出,它们在格式或图像显示方面没有任何问题,所以我知道问题不是我在尝试转换为 PDF 时的 HTML 输入:
...
MimeMessage temp = emp.Pop3.GetMessage(idx);
StringBuilder rValue = new StringBuilder(null);
Regex bodyTag = new Regex(@"^<body.*>$");
Regex charset = new Regex("charset=(.*)\"");
string body = string.Empty, condHelper = string.Empty;
List<string> tempBody = temp.HtmlBody.Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries).ToList<string>();
int tempidx = 0;
foreach (string line in tempBody) // Looks-up this HTML's charset and sets it to utf-8
if(charset.IsMatch(line))
condHelper = charset.Match(line).Value;
tempidx = tempBody.IndexOf(line);
tempBody[tempidx] = line.Replace(condHelper, "charset=utf-8\"");
break;
foreach(string line in tempBody) //Looks up the index of the body tag so I append that "custom header" with basic info from the email
if (bodyTag.IsMatch(line))
tempidx = tempBody.IndexOf(line);
break;
string line4change = tempBody[tempidx];
line4change += emp.HeaderBuilder(temp.Subject, temp.From.Mailboxes.First(), temp.To.Mailboxes.ToList<MailboxAddress>(), temp.Date.DateTime, temp.Cc.Mailboxes.ToList<MailboxAddress>());
tempBody[tempidx] = line4change;
for (int i = 0; i < tempBody.Count; i++) // starts building the final version of the whole html string
body += tempBody[i] + Environment.NewLine;
rValue.Append(body);
foreach (MimePart part in temp.BodyParts)
if (!part.IsAttachment && part.ContentId != null)
using (Stream stream = new MemoryStream())
part.Content.WriteTo(stream);
stream.Flush();
stream.Seek(0, SeekOrigin.Begin);
using (StreamReader sr = new StreamReader(stream))
string cid = string.Format("src=\"cid:0", part.ContentId);
string data = string.Format("src=\"data:0/1;2,\n3", part.ContentType.MediaType, part.ContentType.MediaSubtype, part.ContentTransferEncoding, sr.ReadToEnd());
rValue.Replace(cid, data);
try
emp.Convert2PDF(rValue.ToString(), emp.User, idx);
catch
...
所以,我的目标是在输出的 PDF 文件上修复这些空心图像容器的奇数输出。
编辑:这是一个在发送到“Convert2PDF”方法之前直接从调试器获取的 HTML 字符串示例:
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css" style="display:none;"> P margin-top:0;margin-bottom:0; </style>
</head>
<body dir="ltr">
<div style="margin-top:24px;"></div>
<span style="font-family: Segoe UI; font-size: 16; font-weight: bold; "> t est</span><br>
<span><hr style="height: 4px; border: none; margin-top: 2px; margin-bottom: 12px; color:#000; background-color:#000;" /></span>
<table style="margin-bottom:32px; " cellspacing="0" cellpadding="4">
<tr>
<td style="margin-left: auto; padding-right: 128px; white-space: nowrap;"><span style="font-family: Segoe UI; font-size: 14; font-weight: bold; "> From:</span></td>
<td style="white-space: nowrap;"><span style="font-family:Segoe UI; font-size: 14;">tester[REDACTED]@outlook.com</span></td>
<td style="width:99%; "></td>
</tr>
<tr style="background-color:#f2f2f2;">
<td style="margin-left: auto; padding-right: 128px; white-space: nowrap;"><span style="font-family:Segoe UI; font-size: 14; font-weight: bold;"> Sent:</span></td>
<td style="white-space: nowrap;"><span style="font-family:Segoe UI; font-size: 14; ">Monday, 11th of October 2021, 08:52:49</span></td>
<td style="width:99%; "></td>
</tr>
<tr>
<td style="margin-left: auto; padding-right: 128px; white-space: nowrap;"><span style="font-family:Segoe UI; font-size: 14; font-weight: bold;"> To:</span></td>
<td style="white-space: nowrap;"><span style="font-family:Segoe UI; font-size: 14;">[REDACTED]</span></td>
<td style="width:99%; "></td>
</tr>
<tr style="background-color:#f2f2f2;">
<td style="margin-left: auto; padding-right: 128px; white-space: nowrap;"><span style="font-family:Segoe UI; font-size: 14; font-weight: bold;"> Subject:</span></td>
<td style="white-space: nowrap;"><span style="font-family:Segoe UI; font-size: 14;">Testing TuesPechkin Library w/Images</span></td>
<td style="width:99%; "></td>
</tr>
</table>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
1st Inline image:</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<img style="width: 187px; height: 221px; max-width: 100%;" size="7198" contenttype="image/png" data-outlook-trace="F:1|T:1" src="data:image/png;Base64,
iVBORw0KGgoAAAANSUhEUgAAALsAAADdCAIAAABsX5R6AAAAAXNSR0IArs4c6QAAAARnQU1BAACx
jwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAABuzSURBVHhe7Z15WBPHH4edDQEUKYfiUbxaLR54
IYhWi1b9WfHASr1QPKpQarVaLZaqQERQPEFr1QpKq8UDq+CBgE8Vigoo0gcRQfABRX0QCo8ID8JD
8pA8/HJsktlNAlnZmCDf9682k91E5s3szOzOZzo0AQATwBiAGWAMwAwwBmAGGAMwA4wBmAHGAMwA
YwBmgDEAM8AYgBksGSMqP+XlOKJlnHxi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5ReW91PrDGE9aWf0T1qOlYwGuEzorV49wtJ5UzLl
DkWzxoi/UlUqb4JNMzcVxdCMEf8NtI3Jl1N322+Ymoei5cYYbpg+G8Y01eWf37r0czsrDa0F4pj3
He8ZdD6PPnUuoy73+IqR2DOMksbFeuTXkfdrBdrP4I3ZkfPwz28cu1BmDZFxj3HfHsuiT7C3YIwE
/tOEHZ6je6p7zh0RHXs4uPtfUl3tol1MvgJ+4ZnvnOnvJo0x4DB9VowhEdaUZKdcPh2xf9f2oEB/
f17Qjt2/HItJSMv/r8WBgKi6MOXM4V1BAYHBe4+cSSmqpVWylohqHqecObSTF8AL2fvrias5FSrd
SQn866uUt4fExozfU6xS+1Iaqwpvxv3+y86gwC1bAnjBoWFH/oxLvl/abEq+NjH5SkS1xbfOR+wL
4flv8Q8MCg2POHOjQP5ElYGG6bNpTFuhIdYTu7GNTGccM5SnldoC7dCYxgeUKUWj/utuGs4v2PBp
J8aIqvP/LZQOrxufxyzGezFE96VxhjPZ0QZoJ8YIC0LHdO5q5+ziPMCS0tc06r8m+V2vVmrbtCNj
VCcAEMd2wenSt+tkt1varzHIqNvEbbcM5tG2NkN76ceUnV892tZMOi2HOGYfjnBdFX7jOXR434J2
YowMYX3Vyxcvq+rVz74AWtGujAFYAIwBmAHGAMwAYwBmgDEAM8AYgBlgDMAMMAZgQlPT/wHgbtxB
+HbHjAAAAABJRU5ErkJggg==
"><br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
2nd Inline image:</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<img style="width: 100px; height: 100px; max-width: 100%;" size="967" contenttype="image/png" data-outlook-trace="F:1|T:1" src="data:image/png;Base64,
iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAIAAAD/gAIDAAAAAXNSR0IArs4c6QAAAARnQU1BAACx
jwv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KHK9
BhKVW4Eodr0CEpVbgVC/NkCIyq1AlLh6gUTlViBKm3qAROVWIMqaeoBE5VYgypteAInKrUCoH/0g
ROVWICqdz4BE5VYgqpzdQKJyKxBVzi4gUbkViGpnF46z6x+zRQbPWHJSYgAAAABJRU5ErkJggg==
"><br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
Stylized text:</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<span style="font-family: Georgia, serif; color: rgb(179, 106, 226);"><b><i><u><strike>S o m e T e x t</strike></u></i></b></span><br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<span style="font-family: Georgia, serif; color: rgb(179, 106, 226);"><b><i><u><strike><br>
</strike></u></i></b></span></div>
</body>
</html>
我一直在使用以下站点来测试这些 HTML 字符串,以确保它们的格式和图像正确显示:https://www.onlinehtmleditor.net/
【问题讨论】:
很抱歉,我不太明白你想在这里得到什么。你希望我用一个示例 HTML 文本编辑我的问题以供参考? 【参考方案1】:我使用 NuGet 包 itext7.pdfhtml
测试了您的 HTML,但图像也没有显示。然而,经过一番调查,我发现src
属性中的值存在问题。
在src
属性值中,您有data:image/png;Base64
。它应该是data:image/png;base64
- 注意base64
的小写b
。
将Base64
更改为base64
后,它似乎工作了。
<img style="width: 187px; height: 221px; max-width: 100%;" size="7198" contenttype="image/png" data-outlook-trace="F:1|T:1" src="data:image/png;base64,
iVBORw0KGgoAAAANSUhEUgAAALsAAADdCAIAAABsX5R6AAAAAXNSR0IArs4c6QAAAARnQU1BAACx
jwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAB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7fJCoqTLMx4vHzBc+eWBniWI9aEhJ9
I+fpf9W1Na/KSx6mJ0SH+y353MX3uuK3wSwmXwptHCd2c6C7/8FjEQdC98QWSP48hhumz7IxLYCM
7VYl4A8oCjI3D1Vze0EG4lpZm2O/3haM0QzR3f2PZ8rORXPGNAmfHHPrRumqq4PTy+ca1poyiMmX
IaqMdseuf0rIuwQGHKb/Do1BnewWHcuj9XZE5ReW91PrDGE9aWf0T1qOlYwGuEzorV49wtJ5UzLl
DkWzxoi/UlUqb4JNMzcVxdCMEf8NtI3Jl1N322+Ymoei5cYYbpg+G8Y01eWf37r0czsrDa0F4pj3
He8ZdD6PPnUuoy73+IqR2DOMksbFeuTXkfdrBdrP4I3ZkfPwz28cu1BmDZFxj3HfHsuiT7C3YIwE
/tOEHZ6je6p7zh0RHXs4uPtfUl3tol1MvgJ+4ZnvnOnvJo0x4DB9VowhEdaUZKdcPh2xf9f2oEB/
f17Qjt2/HItJSMv/r8WBgKi6MOXM4V1BAYHBe4+cSSmqpVWylohqHqecObSTF8AL2fvrias5FSrd
SQn866uUt4fExozfU6xS+1Iaqwpvxv3+y86gwC1bAnjBoWFH/oxLvl/abEq+NjH5SkS1xbfOR+wL
4flv8Q8MCg2POHOjQP5ElYGG6bNpTFuhIdYTu7GNTGccM5SnldoC7dCYxgeUKUWj/utuGs4v2PBp
J8aIqvP/LZQOrxufxyzGezFE96VxhjPZ0QZoJ8YIC0LHdO5q5+ziPMCS0tc06r8m+V2vVmrbtCNj
VCcAEMd2wenSt+tkt1varzHIqNvEbbcM5tG2NkN76ceUnV892tZMOi2HOGYfjnBdFX7jOXR434J2
YowMYX3Vyxcvq+rVz74AWtGujAFYAIwBmAHGAMwAYwBmgDEAM8AYgBlgDMAMMAZgQlPT/wHgbtxB
+HbHjAAAAABJRU5ErkJggg==
">
【讨论】:
以上是关于Base64 字符串编码的图像未加载到输出 PDF (TuesPechkin / Wkhtmltopdf)的主要内容,如果未能解决你的问题,请参考以下文章
将 PDF 文档从远程服务器加载到 base64 编码数据中
在 Javascript 中将 PDF 转换为 Base64 编码的字符串
从 javascript 触发 base64 编码 PDF 的打印预览
像图像或 PDF 文件这样的 MIME 类型不需要 base64 或以其他方式编码吗?