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:
Here is the complete code snippet that we tried in our environment and did not notice any issues. Generated output is also attached for your kind reference:
I did not catch on to that but still seem dumbfounded because I thought we were accessing different streams. Did not see why one would have an issue with the other one.
This exact code was working in the previous version (Aspose) which was from 2014/2015. Of course a few things have changed as to the way the DOM works and so that was adjusted.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.