I am trying to load few comments and attachments from Jira into an html and then convert the html to PDF using Spire PDF in C# .net. ( Spire PDF Version - 8.6.0 )
I create a html - add comments into it and then embed the attachments ( like png / docx etc ) into the html.
Once I have the html ( which is a string ) I use this code to generate PDF document,
PdfDocument docPdfGen = new PdfDocument();
PdfPageSettings setting = new PdfPageSettings();
setting.Size = new SizeF(1000, 1000);
setting.Margins = new Spire.Pdf.Graphics.PdfMargins(20);
PdfHtmlLayoutFormat htmlLayoutFormat = new PdfHtmlLayoutFormat();
htmlLayoutFormat.IsWaiting = true;
Thread thread = new Thread(() =>
{ docPdfGen.LoadFromHTML(html, true, setting, htmlLayoutFormat); });
thread.SetApartmentState(ApartmentState.STA);
thread.Start();
thread.Join();
docPdfGen.SaveToFile("TestFinal.pdf");
docPdfGen.Close();
If I use this code, my final pdf does not embed attachments ( in this case png and docx files ) , however my html embeds those attachments and I can click those and open those from HTML.
When I use this - to enable hyperlinks - { docPdfGen.LoadFromHTML(html, false,true, true, setting, htmlLayoutFormat); }); It gives me this error - value does not fall within the expected range ( when LoadHTML call is called)
I need my attachments embeded in final PDF documents and need to open those from the pdf document . how do I achieve that?