Src with POST in HTML to PDF issue

Hi,

I have a problem when trying to create pdf from html using Aspose.Pdf. Issue I’m having is that I’m getting “Illegal characters in path.” exception when trying to create pdf from html. Solution I have is simple web service that only gets html and returns pdf, I have taken sample html and cut it that contains just single Img tag with src with POST request in it. I’ve narrowed it down to that if “?” character is removed from link no exception is being thrown, as if POST wasn’t supported here.

Is it possible to use such links in html for Aspose.Pdf, do you have any suggestions what can be done to make it work?

Here is minimized version of code that still gets this exception (at pdf.GetBuffer();):
[Test]
public void testIllegalChars()
{
string html = “<img border=“0” src=”/Castle/IgiTags.aspx/GetIgiImage?serviceID=4078" alt="" />";

new License().SetLicense(“Aspose.Pdf.lic”);

var pdf = new Pdf();

var section = pdf.Sections.Add();
var text = new Aspose.Pdf.Text(section, html)
{
IsHtmlTagSupported = true
};

section.Paragraphs.Add(text);
byte[] sth = pdf.GetBuffer();
}

I’m additionally attaching stack trace:
at System.Security.Permissions.FileIOPermission.HasIllegalCharacters(String[] str)
at System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionAccess access, AccessControlActions control, String[] pathListOrig, Boolean checkForDuplicates, Boolean needFullPath, Boolean copyPathList)
at System.Security.Permissions.FileIOPermission…ctor(FileIOPermissionAccess access, String[] pathList, Boolean checkForDuplicates, Boolean needFullPath)
at System.IO.Path.GetFullPath(String path)
at .„.€( , Image )
at .„.( )
at ‡..(‚ )
at ‡.‡.(‚ )
at ‡..(‚ )
at .„.(€ )
at ƒ..€(String )
at .„.€(Pdf , Section , Cell , Text , HeaderFooter , , )
at .„.€(Pdf , Section , Table , Cell , Text , HeaderFooter , , )
at .‡.€(Pdf , Section , HeaderFooter , Table , Row , Cell , Text , , , Boolean )
at .e.€(Pdf , Section , )
at ..€(Pdf )
at .†.€(a , Pdf )
at Aspose.Pdf.Pdf.GetBuffer()
at TestsForPdfs.Class1.testIllegalChars() in C:\perforce\depot\RnD\OfficeService\TestsForPdfs\Class1.cs:line 36

Regards,
Leszek

Hello Leszek,

Thanks for your interest in our products.

We are working over this query and will get back to you soon. We apologize for the delay and inconvenience.

Hello Leszek,

Thanks for using our products.

I have tested the scenario using following code snippet (extracted from the code shared in your original post) and as per my observations, I am unable to notice any problem with v5.3.0. However when I have tried using the same image path string that you have shared, I am able to get "Illegal characters in path". It seems to be an issue with the path information.

[C#]

// Instantiate an object PDF class
Aspose.Pdf.Pdf pdf = new Aspose.Pdf.Pdf();
// add the section to PDF document sections collection
Aspose.Pdf.Section section = pdf.Sections.Add();

//string html = "\"\"";
string html = "\"\"";

//Create text paragraphs containing HTML text
Aspose.Pdf.Text text2 = new Aspose.Pdf.Text(section, html);
// enable the property to display HTML contents within their own formatting
text2.IsHtmlTagSupported = true;
//Add the text paragraphs containing HTML text to the section
section.Paragraphs.Add(text2);
//save the resultant PDF
pdf.Save(@"d:/pdftest/ImagePathIssue_Test.pdf");

We apologize for your inconvenience.