I am trying to re-build an old .NET Visual Basic application I have inherited that uses WebSupergoo.ABCpdf10 (ABCpdf, Version=10.1.2.5). I am getting an exception "Illegal characters in path", ultimately thrown by the method System.IO.Path.CheckInvalidPathChars
. However, this is called by the external code, so I have little control over it. The stack trace is as follows:
[ArgumentException: Illegal characters in path.] System.IO.Path.CheckInvalidPathChars(String path, Boolean checkAdditional) +12831187 System.IO.Path.Combine(String path1, String path2) +34 WebSupergoo.ABCpdf10.Internal.Gecko.GeckoRpc.GetABCGeckoPath(String currLoc, String installDir) +378 WebSupergoo.ABCpdf10.Internal.Gecko.WorkerPool.AddRef(HtmlManagedOptions managedOptions) +332 WebSupergoo.ABCpdf10.Internal.Gecko.AddUrlProgress.Start(Boolean readAsync) +91 WebSupergoo.ABCpdf10.Internal.Gecko.DocAddGecko.AddUrl(String url) +1260 WebSupergoo.ABCpdf10.Internal.Gecko.DocAddGecko.AddHtml(String html) +290 WebSupergoo.ABCpdf10.Doc.AddUrlHtml(String urlOrHtml, Boolean isHtml, Boolean paged, Int32 width, Boolean disableCache) +251 WebSupergoo.ABCpdf10.Doc.AddImageHtml(String html, Boolean paged, Int32 width, Boolean disableCache) +49 GI.Platform.Core.Business.PdfDocument.AddHtml(String html, Int32 browserWidth, PageOrientation pageOrientation, Boolean paged) in C:\Users\MartinVaughan\Documents\Development\GI Platform\original-platform\GI.Platform.Core\Business\PDFDocument.vb:168 GI.Platform.UI.Legacy.UserControls.Admin.ReportGeneration.btnGPIBasicReportPdf_Click(Object sender, EventArgs e) in C:\Users\MartinVaughan\Documents\Development\GI Platform\original-platform\GI.Platform.UI\UserControls\Admin\ManageRegistration\ReportGeneration.ascx.vb:234 System.Web.UI.WebControls.LinkButton.OnClick(EventArgs e) +121 System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +108 System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +12 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +15 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +9859004 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1696
The method GI.Platform.Core.Business.PdfDocument.AddHtml
is ours and passes an HTML-formatted string. Thereafter, the methods are external (part of the WebSupergoo package). Our method calls AddImageHtml
, which appears to call AddUrlHtml
.
I have stripped all URLs out of the HTML string (as I thought this might be the problem). I have also stripped out any characters I thought might be dubious. The HTML string is now (indentation added here for readability):
<html><head></head><body><table cellpadding='5' cellspacing='0' border='0' width='100%'><tr><td rowspan='3' width='350'></td><td class='titleCell'>GPI™ Datasheet</td></tr><tr><td class='nameCell'>User Name</td></tr><tr><td class='dateCell'>Generated on 13/09/2022</td></tr></table><br /><table cellpadding='0' cellspacing='0' border='0' width='90%' class='data' align='center'><tr class='header'><th class='centerAlign'>Dimension/Sub-Dimension</th><th class='centerAlign'>Type</th><th class='centerAlign'>Rank</th></tr><tr class='dimension'><th class='leftAlign'><b>Incremental - Radical</b></th><th class='leftAlign'><b>Incremental</b></th><th class='centerAlign'><b>3</b></th></tr><tr><td class='leftAlign'>Evolutionary - Revolutionary</td><td class='leftAlign'>Evolutionary</td><td class='centerAlign'>2</td></tr><tr><td class='leftAlign'>Practical - Conceptual</td><td class='leftAlign'>Practical</td><td class='centerAlign'>3</td></tr><tr><td class='leftAlign'>Rational - Intuitive</td><td class='leftAlign'>Rational</td><td class='centerAlign'>4</td></tr><tr class='dimension'><th class='leftAlign'><b>Focused - Flexible</b></th><th class='leftAlign'><b>Focused</b></th><th class='centerAlign'><b>4</b></th></tr><tr><td class='leftAlign'>Outcome - Spontaneous</td><td class='leftAlign'>Outcome</td><td class='centerAlign'>4</td></tr><tr><td class='leftAlign'>Conscientious - Cursory</td><td class='leftAlign'>Conscientious</td><td class='centerAlign'>5</td></tr><tr><td class='leftAlign'>Perfectionist - Pragmatic</td><td class='leftAlign'>Perfectionist</td><td class='centerAlign'>2</td></tr><tr class='dimension'><th class='leftAlign'><b>Extraversion - Introversion</b></th><th class='leftAlign'><b>Introversion</b></th><th class='centerAlign'><b>3</b></th></tr><tr><td class='leftAlign'>Outgoing - Reserved</td><td class='leftAlign'>Reserved</td><td class='centerAlign'>5</td></tr><tr><td class='leftAlign'>Asserting - Accepting</td><td class='leftAlign'>Accepting</td><td class='centerAlign'>1</td></tr><tr><td class='leftAlign'>Fun Loving - Serious-Minded</td><td class='leftAlign'>Serious-Minded</td><td class='centerAlign'>5</td></tr><tr><td class='leftAlign'>Socially Assured - Socially Uncertain</td><td class='leftAlign'>Socially Uncertain</td><td class='centerAlign'>2</td></tr><tr class='dimension'><th class='leftAlign'><b>Collectivist - Individualist</b></th><th class='leftAlign'><b>Individualist</b></th><th class='centerAlign'><b>4</b></th></tr><tr><td class='leftAlign'>Affiliative - Unaffiliative</td><td class='leftAlign'>Unaffiliative</td><td class='centerAlign'>5</td></tr><tr><td class='leftAlign'>Trusting - Questioning</td><td class='leftAlign'>Questioning</td><td class='centerAlign'>3</td></tr><tr><td class='leftAlign'>Conforming - Dissenting</td><td class='leftAlign'>Dissenting</td><td class='centerAlign'>5</td></tr><tr><td class='leftAlign'>Modest - Assuming</td><td class='leftAlign'>Assuming</td><td class='centerAlign'>3</td></tr><tr class='dimension'><th class='leftAlign'><b>At Ease - Ill-at Ease</b></th><th class='leftAlign'><b>Ill-at Ease</b></th><th class='centerAlign'><b>2</b></th></tr><tr><td class='leftAlign'>Relaxed - Tense</td><td class='leftAlign'>Tense</td><td class='centerAlign'>1</td></tr><tr><td class='leftAlign'>Placid - Discontented</td><td class='leftAlign'>Discontented</td><td class='centerAlign'>5</td></tr><tr><td class='leftAlign'>Optimistic - Pessimistic</td><td class='leftAlign'>Pessimistic</td><td class='centerAlign'>3</td></tr><tr><td class='leftAlign'>Confident - Self-Conscious</td><td class='leftAlign'>Confident</td><td class='centerAlign'>1</td></tr><tr class='dimension'><th class='leftAlign'><b>Disciplined - Impulsive</b></th><th class='leftAlign'><b>Disciplined</b></th><th class='centerAlign'><b>3</b></th></tr><tr class='dimension'><th class='leftAlign'><b>Driving - Measured</b></th><th class='leftAlign'><b>Measured</b></th><th class='centerAlign'><b>1</b></th></tr><tr><td class='leftAlign'>Persuasive - Consensual</td><td class='leftAlign'>Consensual</td><td class='centerAlign'>1</td></tr><tr><td class='leftAlign'>Ambitious - Contented</td><td class='leftAlign'>Ambitious</td><td class='centerAlign'>2</td></tr><tr><td class='leftAlign'>Energetic - Paced</td><td class='leftAlign'>Paced</td><td class='centerAlign'>3</td></tr></table><br /><table cellpadding='0' cellspacing='0' border='0' align='center'><tr><td class='copyrightCell'>© 2022 Glowinkowski International Limited</td></tr></table></body></html>
(Note: I have removed the link to the CSS file and an image with a URL, as I thought these might be creating the problem).
Still getting the exception!
Could anyone throw any light on this?
Edit
Looking at the WebSupergoo documentation at https://www.websupergoo.com/helppdfnet/default.htm?page=source%2f5-abcpdf%2fdoc%2f1-methods%2faddimagehtml.htm they note that:
Using the MSHTML, ABCGecko and ABCWebKit engines, ABCpdf saves this HTML into a temporary file and renders the file using a 'file://' protocol specifier. So this is a convenience function - it doesn't offer any performance enhancements. Sometimes the IIS users do not have full access to the temp directory. This is determined by the system setup you have on your machine. If this is the case you will get errors returned. So if you are working from ASP you may find that you need to enable access to the temp directory for the ASPNET user, the IUSR_MACHINENAME user or the IWAM_MACHINENAME user.
This may be the root cause of the problem, in which case, my question would translate to how do I enable access in my Visual Studio build?.