Hi - I’m converting html string to pdf stream using aspose.HTML… I’m using Aspose.html version 23.4 and I’m encountering the error “The document is not completely loaded. Please wait for ‘complete’ state……” when the dependency System.Text.Encoding.CodePages is at version 6.0.0 however when it is in version 4.5.0, it works fine… any idea how to fix this? thanks
The error message “The document is not completely loaded. Please wait for ‘complete’ state…” that you are encountering when converting an HTML string to a PDF stream using Aspose.HTML version 23.4 may be related to the version of the dependency System.Text.Encoding.CodePages
. It appears that while version 6.0.0 of this dependency causes the issue, version 4.5.0 works without problems.
To resolve this issue, you can try the following steps:
-
Upgrade to a Newer Version: Consider upgrading to a newer version of Aspose.HTML, such as version 23.7 or later. Users have reported that the issue does not occur in these versions, and it may contain fixes for the problem you are experiencing.
-
Check Project Settings: Ensure that your project settings are correctly configured. Sometimes, specific project settings or version mappings in the App.config can lead to such issues.
-
Test with Sample HTML: If the problem persists after upgrading, it may be helpful to share your sample HTML with the Aspose support team for further investigation. They can test the scenario in their environment and provide more targeted assistance.
-
Review Dependency Versions: If you need to stick with version 6.0.0 of
System.Text.Encoding.CodePages
, you might want to check if there are any known compatibility issues with Aspose.HTML version 23.4 or if there are any specific configurations required.
If you continue to face difficulties, consider reaching out to the Aspose support team with your specific HTML content for more personalized help.
Sources:
[1]: ConvertHtml fails with Aspose.Html 23.5.0
[2]: ConvertHtml fails with Aspose.Html 23.5.0
[3]: ConvertHtml fails with Aspose.Html 23.5.0
You are using quite old version of the API. Please try to use the latest version and let us know if issue still persists. Are you not using .NET Core?
@asad.ali when I tried to use the latest version, I encountered an error “Object reference not set to an instance of an object.”
I’m using the code snippet below to convert and I checked that all parameters have values…
' Initialize an HTML document from the HTML string
Using document As New Aspose.Html.HTMLDocument(htmlPage, ".")
' Initialize PdfDevice with the output stream
Using pdfDevice As New Aspose.Html.Rendering.Pdf.PdfDevice(pdfOptions, pageStream)
' Render the HTML document to PDF
Dim renderer As New Aspose.Html.Rendering.HtmlRenderer()
renderer.Render(pdfDevice, document)
End Using
End Using
All dependencies are also present and installed… I’m not sure what’s causing this…
If possible, please share your sample HTML in .zip format with us. We will test the scenario in our environment and address it accordingly.