We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Failed to parse URL

Some version between 11.3 and 17.11 the parsing for Html data has changed.

For example in 11.3 if I have:
<div class="page-header-img"><img src="\\uncLocation\file\child\child\image.png" class="bigbgimg" />
The resource callback would indicate that url as composed as \\\\uncLocation\file\child\child\image.png and the image would load in the resulting PDF document.

In 17.11 using the same image location
<div class="page-header-img"><img src="\\uncLocation\file\child\child\image.png" class="bigbgimg" />, Aspose throws an exception “failed to parse URL”, if I update that url to remove the leading double \\, <img src="uncLocation\file\child\child\image.png" class="bigbgimg" />, I can get to the resource callback but now the current directory is appended onto the image url at the begging as something like.

C:\Documents\Apps\TestApps\Aspose\PDFTestApps\uncLocation\file\child\child\image.png

Which is not the location the image is at.

Was this an intended change?

@mayswitch

Thank you for contacting support.

We would like to share with you that Aspose.PDF for .NET 18.3 is the latest available version at the moment. So, please share your observations based on latest version. Kindly attach a narrowed down sample application reproducing this issue along with source and generated file so that we may try to reproduce and investigate it in our environment.

Hi Farhan,

The issue is still present in 18.3, however I have discovered something new. It appears that if your url contains a - or _ it will fail to parse. If I remove those characters it will parse with the leading\\

AsposeHTMLtoPDF.zip (214.5 KB)

@mayswitch

Thank you for sharing requested data.

We have worked with the data shared by you and have been able to reproduce the issue: Failed to parse URL. A ticket with ID PDFNET-44493 has been logged in our issue management system for further investigation and resolution. The issue ID has been linked with this thread so that you will receive notification as soon as the issue is resolved.

However, we did not notice any issue when the URL of img included a dash or underscore, in local file system.

We are sorry for the inconvenience.

Hi,

I have the same problem when using Aspose.PDF 18.4; the following C# code generates the “Failed to parse URL” exception:

new Aspose.Pdf.Document(@"c:\temp\fiche.html", new Aspose.Pdf.HtmlLoadOptions("https://sub-domain.domain.com")).Save(@"c:\temp\output.pdf");

It works fine if I just use “https://subdomain.domain.com” (without the dash) as the base path. The domain doesn’t even have to exist.

@vduret

Thank you for contacting support.

We have been able to reproduce the issue in our environment. A ticket with ID PDFNET-45290 has been logged in our issue management system for further investigation and resolution. The ticket ID has been linked with this thread so that you will receive notification as soon as the ticket is resolved.

We are sorry for the inconvenience.

Hi Team,

Is this problem resolved in the latest version? I am using a trial license of Aspose PDF For Java and encountering the same issue.
Please could you confirm. Thanks.

Best,
Debanjan

@debanjanrouth

Thank you for contacting support.

We are afraid previously logged tickets have not been resolved yet. However, would you please share some details and narrowed down code snippet which is causing this issue so that we may ensure taking care of your concerns as well.