Recently, I had done a K2 installation containing the K2 BlackPearl & K2 SmartForms components. After the installation, i had faced several issue on the PDF generation that is provide by K2 OOB settings.
The K2 version that was installed is on 4.6.11.
The server structure is at such:
- One K2 Application server
- One K2 Web server
- One K2 Database Server
K2 Application Server
Application server are install with K2 BlackPearl, K2 SmartForms and K2 SmartForms Control Pack server components.
K2 Web Server
Web server are install with K2 Workspace, K2 Designer, K2 SmartForms Runtime and K2 SmartForms Control Pack Designer & Runtime.
K2 Database Server
Database server contains only K2 database.
K2 SmartForms Setup
As there are few requirements, thus I had created a secondary SmartForms Runtime site. This site is use for PDF Generation purpose. You may refer to here for more info.
The primary SmartForms Runtime site is authenticate using Form Login and the secondary SmartForms Runtime site is authenticate using AD Login.
After the installation was done, I had executed the PDF generation via workflow and K2 SmartForms. Following were the issues I had encountered:
- Blank PDF Generated
- Distorted PDF Generated
These issues happens quite randomly but was not surfaced upon the subsequent PDF generation for a short period of time.
Then I managed to replicate the issue by running an IISRESET command in the web server. Upon every IISRESET, I managed to generate a blank PDF but subsequent PDF generation would work fine.
It seems that there is a session timeout or caching somewhere that seems to prevent the PDF generation from working right.
Since I am using AD Authentication via the secondary SmartForm Site, I manage to figure out by tuning the IIS application authentication settings to suit the PDF needs.
1. Open IIS, locate your secondary SmartForm Runtime Site and click on Authentication
2. Set the settings as follows:
With the above settings, PDF generation is able to work perfectly!
But do take note, this solution will work only if you have a secondary SmartForms Runtime site that is specifically use for PDF generation.
This solution is only tested with 4.6.11 version, it might not work for the rest of other K2 version.