About Aspost.HTML Converter using C#

Hi guys,

I’m using Converter (latest version) to Convert from Template HTML (with Template Data Json), then save file .html into the file server (ex: 192.168.x.x) but i got an error:

Code:
var htmlContract = Converter.ConvertTemplate(templatePath, new TemplateData(jsonPath), new TemplateLoadOptions());
htmlContract.Save(htmlFilePath, Aspose.Html.Saving.HTMLSaveFormat.HTML);

Error:
Failed to parse URL: 192.168.x.x/S-App/Omni/Temp-Process/1ba130bc-085c-40d8-8437-d46c104c990c/contract.html

Pls tell me how can i fix that error?

@hoka0370

Could you please try to save the HTML to some other path and see if error is still there? In case yes, please share your sample template with us so that we can test the scenario in our environment and address it accordingly.

@asad.ali

Thank for your reply!
If I save the HTML to specified Disk (ex: D:, E:…), it will save success. It only error in case save to file server (IP address).
Could you tell me some solution to fix it?

@hoka0370

It seems like the case of restricted access. Can you please make sure that your application has full Trust Level to access the location where you want to save the file? Also, please make sure that there is no such restrictions applied on the server for file writing. In case issue still persists, please share some more details about your complete environment so that we can perform investigation accordingly.

Yeah, i’m sure my application has full trust level to access. I try to new a file pdf (don’t use Convert HTML to PDF, only “Hello Word” PDF) and save to that location, It was success.

I think that error happened when i call this code below:
var htmlContract = Converter.ConvertTemplate(templatePath, new TemplateData(jsonPath), new TemplateLoadOptions());
htmlContract.Save(htmlFilePath, Aspose.Html.Saving.HTMLSaveFormat.HTML);

But this code below success:
Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document(memory);
pdfDocument.Save(htmlFilePath);

So, there is 1 solution I tried and success: I convert HTMLDocument to stream and save it.

@hoka0370

Would you please share your sample HTML template with us so that we can also try to replicate the issue in our environment and address it accordingly.

@asad.ali
Absolutely yes. My template is here.
template.zip (502.8 KB)

@hoka0370

We have logged an investigation ticket as HTMLNET-3567 in our issue tracking system to further analyze this case. We will look into its details and keep you posted with the status of its correction. Please be patient and spare us some time.

We are sorry for the inconvenience.

@hoka0370

The method HTMLDocument.Save(string path, HTML SaveFormat saveFormat) does not support saving to the network resource. You can use it only for saving to the local file system.

If you need to save to a network resource, you can use the method Save(IOutputStorage outputStorage).
You can find an example of how to use this method in the documentation:

Furthermore, we have discovered a problem with CSS serialization and it will be fixed as a task as HTMLNET-3653 has been logged in our issue tracking system for the purpose. We will let you know once we have more updates.

The issues you have found earlier (filed as HTMLNET-3567) have been fixed in this update. This message was posted using Bugs notification tool by pavel.petrushechkin