简体   繁体   English

XMLWorker没有看到img(itextsharp)

[英]XMLWorker doesn't see img (itextsharp)

I parse HTML to PDF using XMLWorker. 我使用XMLWorker将HTML解析为PDF。 And I've got problem with images. 而且我对图像有疑问。 When in the path of tag between words are located spaces or Cyrillic symbols are in the path, that images from HTML don't adding to PDF. 当单词之间的标记路径中存在空格或西里尔符号位于路径中时,HTML图像不会添加到PDF。 For solving problem with spaces I used path.Replase(" ", "%20") and path.Replase(" ", "+") , but it doesn't helping. 为了解决空格问题,我使用了path.Replase(" ", "%20")path.Replase(" ", "+") ,但这path.Replase(" ", "+")

Should I convert path of img to base64 and after use ImageProvider (AbstractImageProvider) like here ? 我应该将img的路径转换为base64并在使用ImageProvider(AbstractImageProvider)之后像这里吗?

If path is without spaces or Cyrillic symbols, that XMLWorker parse HMTL is right. 如果path没有空格或西里尔符号,则XMLWorker解析HMTL是正确的。

<img src="D:\c#\PdfItextSharp\HTML_to_PDF_book\HTML_to_PDF_book\bin\Debug\Data\Resources\Documentation\IASO\Modules\LearningFrame\Images\32x32-tree_add_subitem.png" class="icon">

But if there are in path that symbols, that images don't add to pdf 但是,如果在路径中存在符号,则该图像不会添加到pdf中

<img src="D:\c#\PdfItextSharp\HTML to PDF book\HTML to PDF book\bin\Debug\Data\Resources\Documentation\IASO\Modules\LearningFrame\Images\32x32-tree_add_subitem.png" class="icon">

or 要么

\\HI-PC\AllUsers\Выгрузка\DebugHtmlToPdf\User manual - Instructor\bin\Data\Data\Screenshots\0e39c7d5-4489-4d8b-ae84-ee85a2e225ee.jpg

How I can so 我怎么能这样

Thank you. 谢谢。

For solving it problem I used next code. 为了解决这个问题,我使用了下一个代码。 Thanks mkl for his helping. 感谢mkl的帮助。

var uri = new System.Uri(tmpPath);
var convertedURI = uri.AbsoluteUri;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM