This is the HTML in which we are inserting data into the elements and it fails here. I have tested it and so it seems to fail when it reaches the end of page in the PDF. I thought it should create pages automatically if the content is long.
So fillHTML is bit is nothing but replacing these placeholders with variables which we have labelled in HTML and then the fillHTML calls this code below which also does the same thing based on a list model which contains simple data (numbers, text):
Seems like I am doing the same thing. I have not run your code but literally all is the same. I expect it to break page automatically. I have tried to write to new pages by myself but trying to avoid this.
Have you tried and tested it with 22.11 version? Please share a sample console application that can be used to reproduce the issue so that we can test the scenario in our environment and address it accordingly. Also, please share your complete environment details.
When printing my own 2 pages (front and back html) it works. When injecting your test page in between it does not work it comes up with the same exception message.
.NET 6.0
Razor ASPX project.
Save output Aspose is to the directory and that does work. Except when the exception happens.
Would you please share a sample console application that shows the scenario in which issue is occurring at your end and reproduces the exception? We will use it to reproduce the error and address it accordingly.
Attached is what we are doing to create a HTML to PDF.
To clarify. The first and back page do properly print out (convert to PDF). Nothing wrong with replacing the placeholders in HTML either. In the previous 2014 version of Aspose it was working fine.
Let us know what you can find.
Both the HTML files are loaded using index values please just assume everything prior to the call is correct (creation of the object and calling GeneratePDF).
We tried to run the program that you shared but we could not execute it as it has undefined variables. Could you kindly provide a complete sample console application with sample values and document that we can run without any error and reproduce the exact issue in our environment. We apologize for the inconvenience being faced.
Create an instance of that class.
Remove the instance variable that requires Document list stuff.
Set the FillHTML values which require replacing to something hardcoded.
That’s it.
The error is occurring due to closed stream of the image at your side. You are saving document that has an image stream in it as background and that stream should be closed after the document is saved. Please change the part of your code snippet as below to prevent the error: