Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Thu Oct 03, 2019 12:41 am

I have an HTML file that has 2 image tags referencing SVG image files,
when i view the HTML file in the browser it works perfectly fine and i can tell for sure that the links to images aren't broken.
but the PDF created from the html file shows broken image icon and that is it.

please look at the PDF and HTML files attached.

[email protected]
 
Posts: 7
Joined: Thu Jul 25, 2019 5:00 pm

Thu Oct 03, 2019 12:43 am

Just to clarify i temporarily changed the HTML file extension to txt, but i have been working with html file and i also tried conversion from HTML string. same result.

PdfDocument pdfDocument = new PdfDocument();
PdfPageSettings pdfSet = new PdfPageSettings();
pdfSet.Size = PdfPageSize.Letter;
PdfHtmlLayoutFormat htmlLayoutFormat = new PdfHtmlLayoutFormat();
htmlLayoutFormat.IsWaiting = false;


Thread thread = new Thread(()=> {
pdfDocument.LoadFromHTML(filePath, true, true,true,pdfSet, htmlLayoutFormat);
});
thread.SetApartmentState(ApartmentState.STA);
thread.Start();
thread.Join();

MemoryStream stream = new MemoryStream();

pdfDocument.SaveToStream(stream, FileFormat.PDF);

byte[] fileBytes = stream.ToArray();

stream.Write(fileBytes, 0, fileBytes.Length);
stream.Position = 0;

[email protected]
 
Posts: 7
Joined: Thu Jul 25, 2019 5:00 pm

Thu Oct 03, 2019 3:19 am

Hi,

Thanks for your inquiry.
After viewing your HTML file via browser on my side, there are no images showed. In the HTML code, the images are set by path(<img src = "85051_RepairNotice_09-26-2019-Page1.svg">), and the attachment didn't include the images files. Could you please check again?

Sincerely,
Betsy
E-iceblue support team 
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Thu Oct 03, 2019 3:37 pm

i can not share the photos as they are not public documents, but you can place any svg image and point the <img> tags to your svg image, i am sure you will get the same error.

[email protected]
 
Posts: 7
Joined: Thu Jul 25, 2019 5:00 pm

Fri Oct 04, 2019 3:56 am

Hi,

Thanks for your response.
Please use plugin method to convert the html with SVG to PDF. After an initial test on my side, the SVG could be showed correctly in PDF.
https://www.e-iceblue.com/Tutorials/Spi ... lugin.html

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Fri Oct 04, 2019 4:09 pm

Thank you very much, that worked like a charm.

[email protected]
 
Posts: 7
Joined: Thu Jul 25, 2019 5:00 pm

Fri Oct 04, 2019 6:00 pm

It works fine in my local machine, but when i deploy it to server, the plugin folder goes under bin folder on the server and bin folder has spire.pdf.dll files too, but it is throwing the following error.
System.InvalidOperationException
The conversion provider cann't be found. Please make sure: 1. the folder "plugins" under the same folder of Spire.Pdf.dll 2. exists "plugins\HTMLConverter.dll" and other "plugins\*.dll"

System.InvalidOperationException: The conversion provider cann't be found.
Please make sure:
1. the folder "plugins" under the same folder of Spire.Pdf.dll
2. exists "plugins\HTMLConverter.dll" and other "plugins\*.dll"
at Spire.Pdf.HtmlConverter.Qt.HtmlConverter.init(String url, Boolean enableJavaScript, Int32 timeout, SizeF pageSize, PdfMargins margins)
at Spire.Pdf.HtmlConverter.Qt.HtmlConverter.Convert(String url, Stream stream, Boolean enableJavaScript, Int32 timeout, SizeF pageSize, PdfMargins margins)

can you please tell me if there is anywhere else i need to put the plugins folder?

[email protected]
 
Posts: 7
Joined: Thu Jul 25, 2019 5:00 pm

Mon Oct 07, 2019 2:01 am

Hi,

Thanks for your feedback and sorry for the late reply as weekend.
Please try to specify the path of the plugin folder directly like follows.
Code: Select all
Spire.Pdf.HtmlConverter.Qt.HtmlConverter.PluginPath = @"E:\test\bin\plugins";
If the issue still happens on your server after trying, please provide the type the your application (E.g. ASP.NET Web app) as well as your Server information (E.g. Deploying on IIS) to help us look into your issue further.

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1385
Joined: Tue Sep 27, 2016 1:06 am

Mon Oct 07, 2019 3:21 pm

Thank you.

[email protected]
 
Posts: 7
Joined: Thu Jul 25, 2019 5:00 pm

Tue Oct 08, 2019 2:23 am

Hi,

Thanks for your feedback.
If there is any question, please do not hesitate to contact us.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Return to Spire.PDF

cron