Naomiss
Naomiss

Reputation: 165

XMLWorker doesn't see img (itextsharp)

I parse HTML to PDF using XMLWorker. 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. For solving problem with spaces I used path.Replase(" ", "%20") and path.Replase(" ", "+"), but it doesn't helping.

Should I convert path of img to base64 and after use ImageProvider (AbstractImageProvider) like here?

If path is without spaces or Cyrillic symbols, that XMLWorker parse HMTL is right.

<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

<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.

Upvotes: 0

Views: 750

Answers (1)

Naomiss
Naomiss

Reputation: 165

For solving it problem I used next code. Thanks mkl for his helping.

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

Upvotes: 1

Related Questions