![]() Thread.SetApartmentState(ApartmentState.STA) ![]() 'Load HTML from html string using LoadFromHTML methodĭoc.LoadFromHTML(htmlString, True, True, False, setting, htmlLayoutFormat) Setting.Margins = New (20)ĭim htmlLayoutFormat As PdfHtmlLayoutFormat = New PdfHtmlLayoutFormat() ![]() 'Save page size and margins through the object ![]() Namespace ConvertHtmlStringToPdfWithoutPluginĭim doc As PdfDocument = New PdfDocument()ĭim setting As PdfPageSettings = New PdfPageSettings() Load HTML from a URL path using LoadFromHTML method PdfHtmlLayoutFormat htmlLayoutFormat = new PdfHtmlLayoutFormat() Save page size and margins through the object PdfPageSettings setting = new PdfPageSettings() Save the document to a PDF file using PdfDocument.SaveToFile() method.Load HTML from the URL path using PdfDocument.LoadFromHTML() method.Create a PdfHtmlLayoutFormat object, and set the IsWaiting property of it to true.Create a PdfPageSettings object, and set the page size and margins through it.The following are the steps to convert a URL to PDF using Spire.PDF without plugin. HtmlConverter.Convert(htmlString, fileName, True, 100000, New Size(1080, 1000), New PdfMargins(0), .SourceCode) Namespace ConvertHtmlStringToPdfWithPluginĭim htmlString As String = File.ReadAllText("C:\Users\Administrator\Desktop\Document\Html\Sample.html")ĭim fileName As String = "HtmlStringToPdf.pdf" If you have an external CSS style sheet, please convert it to inline or internal CSS style. Note: Only inline CSS style and internal CSS style can be rendered correctly on PDF. Call HtmlConverter.Convert(string htmlString, string fileName, bool enableJavaScript, int timeout, SizeF pageSize, PdfMargins margins, htmlType) method to convert HTML string to a PDF document.Specify the plugin path, and assign it as the value of the HtmlConverter.PluginPath property.Specify the path of the generated PDF file.The following are the steps to convert an HTML string to PDF using Spire.PDF with QT plugin. HtmlConverter.Convert(url, fileName, True, 100000, New Size(1080, 1000), New PdfMargins(0))Ĭonvert an HTML String to PDF with QT Plugin Free Spire.Presentation for Android via Javaĭim pluginPath As String = "F:\\Libraries\\Plugin\\plugins-windows-圆4\\plugins".
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |