Q: I want .htm files to be converted using ToPDF, and .html files using HTML2PDF. I noticed that ToPDF will also try to use HTML2PDF module if it is available, but I dont want this to happen.
What you can do is use the HTML2PDF.SetModulePath to control this.
By default ToPDF will look for HTML2PDF module when passed in html and htm files. Also by default, HTML2PDF will look for the html2pdf.[dll|so|dylib] file in a few different locations, including the current working directory.
However, as soon as there is a call to HTML2PDF.SetModulePath, then HTML2PDF will only look in that one path.
So for .htm files, call SetModulePath to some arbitrary location that does NOT have html2pdf.dll in it. Then put it back to the correct location when done converting the .htm file. When calling ToPDF, it will detect that there is no html2pdf.dll module available, and continue with alternative methods.
Note, the SetModulePath is a static method, so this only works if you serialize your usage of HMTL2PDF.