添付された HTML の変換に UTF-8 エンコーディングを使用するように、XMLWorkerHelper.ParseToElementList メソッドを変更しました。
<p><span style="font-size: 10pt; font-family: "tahoma", "sans-serif"">Med pripravo vozil za ladjo M/V SEA PATRIS, dne 19.02.2017 je prišlo do delovne nezgode in poškodbe dveh vozil Seat Ateca. Voznik ( RETRANS d.o.o.) je z vozilom Seat Ateca VIN: VSSZZZ5FZH6536022  zapeljal vzvratno in trčil v stoječe vozilo Seat Ateca VIN: VSSZZZ5FZH6545134.</span> </p>
<div><span style="font-size: 10pt; font-family: "tahoma", "sans-serif""> </span></div>
<div><span style="font-size: 10pt; font-family: "tahoma", "sans-serif"">Priloge: fotografije, seznam poškodb         </span></div>
<div><span style="font-size: 10pt; font-family: "tahoma", "sans-serif""> </span></div>
<table class="MsoNormalTable" border="1" cellspacing="0" cellpadding="0" style="border-top: black 1pt solid; border-right: black 1pt solid; background: white; border-bottom: black 1pt solid; border-left: black 1pt solid"><tbody><tr><td style="border-top: gray 1pt solid; border-right: gray 1pt solid; background: #ededed; border-bottom: gray 1pt solid; padding-bottom: 0.75pt; padding-top: 0.75pt; padding-left: 1.5pt; border-left: gray 1pt solid; padding-right: 1.5pt"><div><b><span style="font-size: 8.5pt; font-family: "verdana", "sans-serif"; color: black">#</span></b></div></td>
<td style="border-top: gray 1pt solid; border-right: gray 1pt solid; background: #ededed; border-bottom: gray 1pt solid; padding-bottom: 0.75pt; padding-top: 0.75pt; padding-left: 1.5pt; border-left: gray 1pt solid; padding-right: 1.5pt"><div><b><span style="font-size: 8.5pt; font-family: "verdana", "sans-serif"; color: black">PR</span></b></div></td>
<td style="border-top: gray 1pt solid; border-right: gray 1pt solid; background: #ededed; border-bottom: gray 1pt solid; padding-bottom: 0.75pt; padding-top: 0.75pt; padding-left: 1.5pt; border-left: gray 1pt solid; padding-right: 1.5pt"><div><b><span style="font-size: 8.5pt; font-family: "verdana", "sans-serif"; color: black">DATUM PREGLEDA</span></b></div></td>
<td style="border-top: gray 1pt solid; border-right: gray 1pt solid; background: #ededed; border-bottom: gray 1pt solid; padding-bottom: 0.75pt; padding-top: 0.75pt; padding-left: 1.5pt; border-left: gray 1pt solid; padding-right: 1.5pt"><div><b><span style="font-size: 8.5pt; font-family: "verdana", "sans-serif"; color: black">VIN</span></b></div></td>
<td style="border-top: gray 1pt solid; border-right: gray 1pt solid; background: #ededed; border-bottom: gray 1pt solid; padding-bottom: 0.75pt; padding-top: 0.75pt; padding-left: 1.5pt; border-left: gray 1pt solid; padding-right: 1.5pt"><div><b><span style="font-size: 8.5pt; font-family: "verdana", "sans-serif"; color: black">DEL</span></b></div></td>
<td style="border-top: gray 1pt solid; border-right: gray 1pt solid; background: #ededed; border-bottom: gray 1pt solid; padding-bottom: 0.75pt; padding-top: 0.75pt; padding-left: 1.5pt; border-left: gray 1pt solid; padding-right: 1.5pt"><div><b><span style="font-size: 8.5pt; font-family: "verdana", "sans-serif"; color: black">OPIS DELA</span></b></div></td>
<td style="border-top: gray 1pt solid; border-right: gray 1pt solid; background: #ededed; border-bottom: gray 1pt solid; padding-bottom: 0.75pt; padding-top: 0.75pt; padding-left: 1.5pt; border-left: gray 1pt solid; padding-right: 1.5pt"><div><b><span style="font-size: 8.5pt; font-family: "verdana", "sans-serif"; color: black">POŠK</span></b></div></td>
<td style="border-top: gray 1pt solid; border-right: gray 1pt solid; background: #ededed; border-bottom: gray 1pt solid; padding-bottom: 0.75pt; padding-top: 0.75pt; padding-left: 1.5pt; border-left: gray 1pt solid; padding-right: 1.5pt"><div><b><span style="font-size: 8.5pt; font-family: "verdana", "sans-serif"; color: black">OPIS POŠKODBE</span></b></div></td>
<td style="border-top: gray 1pt solid; border-right: gray 1pt solid; background: #ededed; border-bottom: gray 1pt solid; padding-bottom: 0.75pt; padding-top: 0.75pt; padding-left: 1.5pt; border-left: gray 1pt solid; padding-right: 1.5pt"><div><b><span style="font-size: 8.5pt; font-family: "verdana", "sans-serif"; color: black">DIMENZIJE / OPOMBE</span></b></div></td></tr>
<tr><td style="border-top: gray 1pt solid; border-right: gray 1pt solid; background: #ededed; border-bottom: gray 1pt solid; padding-bottom: 0.75pt; padding-top: 0.75pt; padding-left: 1.5pt; border-left: gray 1pt solid; padding-right: 1.5pt"><div><span style="font-size: 8.5pt; font-family: "verdana", "sans-serif"; color: black">1</span></div></td>
<td style="border-top: #cccccc 1pt solid; border-right: #cccccc 1pt solid; border-bottom: #cccccc 1pt solid; padding-bottom: 0cm; padding-top: 0cm; padding-left: 1.5pt; border-left: #cccccc 1pt solid; padding-right: 1.5pt; background-color: transparent"><div><span style="font-size: 8.5pt; font-family: "verdana", "sans-serif"; color: #303030">ZP</span></div></td>
<td style="border-top: #cccccc 1pt solid; border-right: #cccccc 1pt solid; border-bottom: #cccccc 1pt solid; padding-bottom: 0cm; padding-top: 0cm; padding-left: 1.5pt; border-left: #cccccc 1pt solid; padding-right: 1.5pt; background-color: transparent"><div><span style="font-size: 8.5pt; font-family: "verdana", "sans-serif"; color: #303030">2017-02-19 11:56:52.0</span></div></td>
<td style="border-top: #cccccc 1pt solid; border-right: #cccccc 1pt solid; border-bottom: #cccccc 1pt solid; padding-bottom: 0cm; padding-top: 0cm; padding-left: 1.5pt; border-left: #cccccc 1pt solid; padding-right: 1.5pt; background-color: transparent"><div><span style="font-size: 8.5pt; font-family: "verdana", "sans-serif"; color: #303030">VSSZZZ5FZH6536022</span></div></td>
<td style="border-top: #cccccc 1pt solid; border-right: #cccccc 1pt solid; border-bottom: #cccccc 1pt solid; padding-bottom: 0cm; padding-top: 0cm; padding-left: 1.5pt; border-left: #cccccc 1pt solid; padding-right: 1.5pt; background-color: transparent"><div><span style="font-size: 8.5pt; font-family: "verdana", "sans-serif"; color: #303030">43</span></div></td>
<td style="border-top: #cccccc 1pt solid; border-right: #cccccc 1pt solid; border-bottom: #cccccc 1pt solid; padding-bottom: 0cm; padding-top: 0cm; padding-left: 1.5pt; border-left: #cccccc 1pt solid; padding-right: 1.5pt; background-color: transparent"><div><span style="font-size: 8.5pt; font-family: "verdana", "sans-serif"; color: #303030">zadnji odbijač</span></div></td>
<td style="border-top: #cccccc 1pt solid; border-right: #cccccc 1pt solid; border-bottom: #cccccc 1pt solid; padding-bottom: 0cm; padding-top: 0cm; padding-left: 1.5pt; border-left: #cccccc 1pt solid; padding-right: 1.5pt; background-color: transparent"><div><span style="font-size: 8.5pt; font-family: "verdana", "sans-serif"; color: #303030">12</span></div></td>
<td style="border-top: #cccccc 1pt solid; border-right: #cccccc 1pt solid; border-bottom: #cccccc 1pt solid; padding-bottom: 0cm; padding-top: 0cm; padding-left: 1.5pt; border-left: #cccccc 1pt solid; padding-right: 1.5pt; background-color: transparent"><div><span style="font-size: 8.5pt; font-family: "verdana", "sans-serif"; color: #303030">PODRSANO</span></div></td>
<td style="border-top: #cccccc 1pt solid; border-right: #cccccc 1pt solid; border-bottom: #cccccc 1pt solid; padding-bottom: 0cm; padding-top: 0cm; padding-left: 1.5pt; border-left: #cccccc 1pt solid; padding-right: 1.5pt; background-color: transparent"><div><span style="font-size: 8.5pt; font-family: "verdana", "sans-serif"; color: #303030">100X10 20X2 10X2 50X2</span></div></td></tr>
<tr><td style="border-top: gray 1pt solid; border-right: gray 1pt solid; background: #ededed; border-bottom: gray 1pt solid; padding-bottom: 0.75pt; padding-top: 0.75pt; padding-left: 1.5pt; border-left: gray 1pt solid; padding-right: 1.5pt"><div><span style="font-size: 8.5pt; font-family: "verdana", "sans-serif"; color: black">2</span></div></td>
<td style="border-top: #cccccc 1pt solid; border-right: #cccccc 1pt solid; border-bottom: #cccccc 1pt solid; padding-bottom: 0cm; padding-top: 0cm; padding-left: 1.5pt; border-left: #cccccc 1pt solid; padding-right: 1.5pt; background-color: transparent"><div><span style="font-size: 8.5pt; font-family: "verdana", "sans-serif"; color: #303030">ZP</span></div></td>
<td style="border-top: #cccccc 1pt solid; border-right: #cccccc 1pt solid; border-bottom: #cccccc 1pt solid; padding-bottom: 0cm; padding-top: 0cm; padding-left: 1.5pt; border-left: #cccccc 1pt solid; padding-right: 1.5pt; background-color: transparent"><div><span style="font-size: 8.5pt; font-family: "verdana", "sans-serif"; color: #303030">2017-02-19 11:57:38.0</span></div></td>
<td style="border-top: #cccccc 1pt solid; border-right: #cccccc 1pt solid; border-bottom: #cccccc 1pt solid; padding-bottom: 0cm; padding-top: 0cm; padding-left: 1.5pt; border-left: #cccccc 1pt solid; padding-right: 1.5pt; background-color: transparent"><div><span style="font-size: 8.5pt; font-family: "verdana", "sans-serif"; color: #303030">VSSZZZ5FZH6545134</span></div></td>
<td style="border-top: #cccccc 1pt solid; border-right: #cccccc 1pt solid; border-bottom: #cccccc 1pt solid; padding-bottom: 0cm; padding-top: 0cm; padding-left: 1.5pt; border-left: #cccccc 1pt solid; padding-right: 1.5pt; background-color: transparent"><div><span style="font-size: 8.5pt; font-family: "verdana", "sans-serif"; color: #303030">43</span></div></td>
<td style="border-top: #cccccc 1pt solid; border-right: #cccccc 1pt solid; border-bottom: #cccccc 1pt solid; padding-bottom: 0cm; padding-top: 0cm; padding-left: 1.5pt; border-left: #cccccc 1pt solid; padding-right: 1.5pt; background-color: transparent"><div><span style="font-size: 8.5pt; font-family: "verdana", "sans-serif"; color: #303030">zadnji odbijač</span></div></td>
<td style="border-top: #cccccc 1pt solid; border-right: #cccccc 1pt solid; border-bottom: #cccccc 1pt solid; padding-bottom: 0cm; padding-top: 0cm; padding-left: 1.5pt; border-left: #cccccc 1pt solid; padding-right: 1.5pt; background-color: transparent"><div><span style="font-size: 8.5pt; font-family: "verdana", "sans-serif"; color: #303030">12</span></div></td>
<td style="border-top: #cccccc 1pt solid; border-right: #cccccc 1pt solid; border-bottom: #cccccc 1pt solid; padding-bottom: 0cm; padding-top: 0cm; padding-left: 1.5pt; border-left: #cccccc 1pt solid; padding-right: 1.5pt; background-color: transparent"><div><span style="font-size: 8.5pt; font-family: "verdana", "sans-serif"; color: #303030">PODRSANO</span></div></td>
<td style="border-top: #cccccc 1pt solid; border-right: #cccccc 1pt solid; border-bottom: #cccccc 1pt solid; padding-bottom: 0cm; padding-top: 0cm; padding-left: 1.5pt; border-left: #cccccc 1pt solid; padding-right: 1.5pt; background-color: transparent"><div><span style="font-size: 8.5pt; font-family: "verdana", "sans-serif"; color: #303030">800X50</span></div></td></tr></tbody></table>
<p> </p>
エンコーディングは UTF-8 に設定されています。
//ParseToElementList overided method (UTF-8)
public static ElementList ParseToElementList(String html, String css)
{
// CSS
ICSSResolver cssResolver = new StyleAttrCSSResolver();
if (css != null)
{
ICssFile cssFile = XMLWorkerHelper.GetCSS(new MemoryStream(Encoding.UTF8.GetBytes(css)));
cssResolver.AddCss(cssFile);
}
// HTML
CssAppliers cssAppliers = new CssAppliersImpl(FontFactory.FontImp);
HtmlPipelineContext htmlContext = new HtmlPipelineContext(cssAppliers);
htmlContext.SetTagFactory(Tags.GetHtmlTagProcessorFactory());
htmlContext.AutoBookmark(false);
// Pipelines
ElementList elements = new ElementList();
ElementHandlerPipeline end = new ElementHandlerPipeline(elements, null);
HtmlPipeline htmlPipeline = new HtmlPipeline(htmlContext, end);
CssResolverPipeline cssPipeline = new CssResolverPipeline(cssResolver, htmlPipeline);
// XML Worker
XMLWorker worker = new XMLWorker(cssPipeline, true);
XMLParser p = new XMLParser(worker);
p.Parse(new MemoryStream(Encoding.UTF8.GetBytes(html)));
return elements;
}
解析された HTML を PdfCell に入力する
List<IElement> elementsIzv = ParseToElementList(nonConformity[Helper_ND_Display.porociloIzvedba].ToString(), null);
foreach (IElement e in elementsIzv)
{
porociloData.AddElement(e);
}
resitevTable.AddCell(porociloData);
文字 č(Č) (č) を除いてすべて正常に動作します (欠落)。何か足りないのですか、それとも ParseToElementList メソッドにバグがありますか? GetInstance メソッドによる HTML の変換
XMLWorkerHelper.GetInstance().ParseXHtml(writer, document, reader);
必要に応じてすべての文字を変換しています。