- Home
- Forum
- ASP.NET Core - EJ 2
- Creating a pdf page at runtime crashes the application
Creating a pdf page at runtime crashes the application
PdfPage page = document.Pages.Add();
PdfGraphics g = page.Graphics;
these two lines were running successfuilly till this day. But today, after a server restart, with no changes in the code or files, these lines make the application crash with this message, anyone knows about this issue?
"Unexpected end of input - Request.... "
By the way, same code (application) runs on local server and on many of production servers smoothly. This issue is on one virtual server. Is it a cause of any change in server configuration, policy etc?
Hi Tezcan,
It appears that the issue may be due to missing PDF binaries or other environmental factors. We have encountered similar problems in the past, and they were often resolved by ensuring the following:
- The PDF document is properly created and closed in your code.
- If you are using the PdfTrueTypeFont API, please ensure that fonts are created during the document creation process and properly disposed of when the document is closed.
This error typically occurs when there's an issue with incomplete data being received or processed. Since the code was working fine before the server restart, the issue might be related to one of the following:
Possible Causes:
- License Registration Issues: After the server restart, the Syncfusion license might not be initializing properly.
- Memory/Resource Allocation: PDF document creation requires sufficient memory. The server restart might have changed resource allocation.
- File Access Permissions: The server restart might have reset file access permissions needed for PDF operations.
- Incomplete PDF Template: If you're working with an existing PDF template, it might be corrupted or inaccessible after restart.
Suggested Solutions:
- Verify License Registration\ Ensure your Syncfusion license is properly registered at application startup:
|
Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("YOUR_LICENSE_KEY"); |
- Add Exception Handling\ Wrap your PDF creation code in a try-catch block to capture detailed error information:
|
try { PdfDocument document = new PdfDocument(); PdfPage page = document.Pages.Add(); PdfGraphics g = page.Graphics; // rest of your code } catch (Exception ex) { Console.WriteLine(ex.ToString()); // Log the complete exception details }
|
- Check Document Initialization\ Ensure the PdfDocument is properly initialized before adding pages or graphics.
- Verify Memory Settings\ If you're dealing with large PDF files, make sure your application has sufficient memory allocation.
- Update Syncfusion Packages\ Consider updating to the latest version of the Syncfusion PDF library, which may include fixes for similar issues.
If the issue persists, we kindly request you to share:
- A simplified version of your application demonstrating the usage of the Syncfusion PDF library.
- Environment details (OS version, .NET version, Syncfusion library version, etc.).
This will help us replicate the issue on our end and provide you with a prompt and accurate solution.
Regards,
Irfana J.
We solved the problem by installing Windows again. So it is not about syncfusion package or any code error. I think some api layer in te os was corrupted, re-installing os solved my problem.
Thanks for help.
Hi Tezcan,
Thank you for the update.
I'm glad to hear that reinstalling Windows resolved the issue. It does sound like the problem was related to a corrupted OS layer rather than the Syncfusion package or any code-related error.
If there's anything else you need, feel free to reach out. Otherwise, I’ll go ahead and close this forum.
Thanks again for your patience and collaboration!
Regards,
Irfana J.
- 4 Replies
- 2 Participants
- Marked answer
-
TC Tezcan Cirakoglu
- Aug 20, 2025 11:20 AM UTC
- Sep 1, 2025 05:42 AM UTC