"The PDF could not be saved" error when executing a SaveAsPDF control on a view or a form
kbt176041
PRODUCTIssue
When trying to execute a SaveAsPDF control on a view or a form the following error will be presented:
The PDF could not be saved.
Type: SourceCode.SmartObjects.Client.SmartObjectException
Message: Could not find a SmartObject named: PDFFile. Primary Credentials Not Authenticated. Session Not Authenticated.
Method Name: ExecuteSaveAsPDFMethod Module Scope
Name: SourceCode.Forms.Controls.Web.dll Declaring Type
Full Name: SourceCode.Forms.Controls.Web.SaveAsPDFRequest
Stack Trace:
at SourceCode.Forms.Controls.Web.SaveAsPDFRequest.ExecuteSaveAsPDFMethod(SaveAsPDFRequest request)
at SourceCode.Forms.Controls.Web.SaveAsPDFHandler.ProcessRequest(HttpContext context)
Symptoms
This will prevent generation of any PDF on the environment.
The main reason why this error is raised is due to an invalid username and password as per K2 product design utilizing SQLUM Authentication.
The PDFConverter Service instance does not get updated when the K2 SQLUM Service account password is changed.
Resolution
STEP 1
Important! K2 Database access will be needed to get the required information
- Validate that the password of the connectionstring for the PDFConverter Service instance in the K2 Database is correct.
--K2 Five and up
USE [K2]
SELECT *FROM [SmartBroker].[ServiceInstance] where Name = 'PDFConverterService'
- Validate the SettingKeysXML and confirm if the smoConnectionString is correct.
<settings>
<key name="smoConnectionString" isrequired="true">Integrated=True;IsPrimaryLogin=True;Authenticate=True;EncryptedPassword=False;Host=localhost;Port=5555</key>
<key name="useWebkit" isrequired="true">true</key>
<key name="serializeResources" isrequired="true">false</key>
<key name="Type Mappings" isrequired="false"><object type="SourceCode.SmartObjects.Services.ServiceSDK.Objects.TypeMappings"><typemappings/></object></key>
</settings>
STEP 2
After the confirmation of the username and password you will need to update the PDF connection string in the PDFConverter service instance.
To do this you will need to alter the ConnectionString as per the example below:
Example of the Connection string:
Integrated=True;IsPrimaryLogin=True;Authenticate=True;EncryptedPassword=True;Host=localhost;Port=5555
Note that the connection string is masked but you can update this as the connection string will be encrypted after this has been updated.
Example of the updated PDFConverter Service Instance:
STEP 3
- After this is completed, please perform a refresh of the PDFConverter service instance to ensure that PDFs will generated going forward.