Sat Oct 26, 2019 9:39 am
i am also having the same problem but didn't understand how to resolve below is my code please suggest
Dim doc As New PdfDocument()
Dim pgSt As New PdfPageSettings()
pgSt.Size = PdfPageSize.A4
pgSt.SetMargins(0.5, 0.5, 0.5, 0.5)
Dim htmlLayoutFormat As New PdfHtmlLayoutFormat()
htmlLayoutFormat.IsWaiting = False
Dim htmlpath As String = "D:\Print-code\test3.html"
Dim source As String = File.ReadAllText(htmlpath)
doc.LoadFromHTML(source, True, pgSt, htmlLayoutFormat)
doc.PrintSettings.PrintController = New StandardPrintController()
doc.PrintSettings.PrinterName = printer
'doc.PrintSettings.Copies = 2
'Print all pages with default printer
doc.Print()
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
error message
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.msht
ml, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one
of its dependencies. The system cannot find the file specified.
File name: 'Microsoft.mshtml, Version=7.0.3300.0, Culture=neutral, PublicKeyToke
n=b03f5f7f11d50a3a'
at Spire.Pdf.HtmlConverter.HtmlConverter.?(String A_0, ImageType A_1, Int32 A
_2)
at Spire.Pdf.HtmlConverter.HtmlConverter.Convert(String url, ImageType type,
Int32 width, Int32 height, AspectRatio aspectRatio)
at Spire.Pdf.PdfSection.?(String A_0, Boolean A_1, Boolean A_2, Boolean A_3,
PdfHtmlLayoutFormat A_4)
at Spire.Pdf.PdfDocument.LoadFromHTML(String htmlSourceCode, Boolean autoDete
ctPageBreak, PdfPageSettings setting, PdfHtmlLayoutFormat layoutFormat, Boolean
isLoadComplete)
at Spire.Pdf.PdfDocument.LoadFromHTML(String htmlSourceCode, Boolean autoDete
ctPageBreak, PdfPageSettings setting, PdfHtmlLayoutFormat layoutFormat)
at SP.Module1.Main() in D:\Nikhil\Project\PrintDocument\SP\Module1.vb:line 96
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\M
icrosoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure lo
gging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fus
ion!EnableLog].