Known Issue: CSS styling is not applied on the PDF control.

  • 16 February 2021
  • 0 replies
  • 89 views

Badge +3
 

Known Issue: CSS styling is not applied on the PDF control.

KB001454

PRODUCT
K2 smartforms 1.0.2 to 4.6.10
BASED ON
K2 smartforms 1.0.2
LEGACY/ARCHIVED CONTENT
This article has been archived, and/or refers to legacy products, components or features. The content in this article is offered "as is" and will no longer be updated. Archived content is provided for reference purposes only. This content does not infer that the product, component or feature is supported, or that the product, component or feature will continue to function as described herein.

 

Issue

The CSS styling is removed when the PDF is generated. This is an environmental issue, which can be resolved by making changes in the web browser of the Service Account User of the K2 Host Server.

 

 

Debugging Issues

The following can be used to investigate the source of the issue to ensure that the most appropriate workaround is applied:

Enable debugging by changing the brokerpackage logging to true in the SourceCode.SmartObjects.Runtime.config file which can be found in the following location:

C:Program Files (x86)K2 blackpearlHost Serverin

Important:  With the release of K2 4.6.9 the SourceCode.SmartObjects.Runtime.config has been consolidated into a single configuration file called K2HostServer.exe.Config file, which is located in the K2 blackpearlHost ServerBin folder on the K2 Server. The connection strings previously stored in these files are now retrieved from the K2HostServer.exe.Config file.

This enables you to see the XML that is pushed through. If the details pushed through references any script files in the XML then make sure you can load the HTML on the server as the K2 Service account. This is usually an indication that something needs to be configured on the K2 Service account side.

Decode the HTML using Notepad++’s XmlTools Plugin for example and then save it as an HTML document.

Add a <base url=”{BaseUrlParameter}” /> tag to the <head> of the document. This is done automatically by the PDF converter.

See http://www.w3schools.com/tags/tag_base.asp

<base href="http://www.w3schools.com/images/" target="_blank">

The modified HTML document can then be opened in the browser of the K2 Service Account to check if it loads successfully.

Workaround

SharePoint:

When using the PDF control in SharePoint, the document mode defaults to Internet Explorer 8 resulting in the CSS styling not being applied on the control. The following can be done to resolve this issue:

It is advised to not use the Save as PDF control directly on a Form that will be used in SharePoint as the current browser’s document mode will be used. An alternative is to use the PDF Converter SmartObject in a workflow to create the PDF from a URL. This ensures that the correct document mode will be used.

General:

Follow the steps below to verify if the environment is compatible with the Save as PDF control. It is important to note that these settings should be applied using the web browser of the Service Account User of the K2 Host Server:

  1. Check the proxy settings for the K2 Service Account’s browser (The proxy should usually be disabled or a bypass should be added for the K2 smartforms sites)
  2. In the Internet Options of the web browser, navigate to Security > Trusted sites and add the runtime sites to the list for the K2 Service Account.
  3. If K2 smartforms runs on the same environment as the K2 Host Server you can try to add host file entries (for the friendlyname.com etc. to 127.0.0.1).
  4. If K2 smartforms runs as a SSL site, navigate to Internet Options > Advanced and disable the following settings in the Service Account browser:
    • Check for publisher’s certificate revocation
    • Check for server certificate revocation
      Image
  5. In the Internet Options of the web browser, navigate to Security > Local intranet and ensure the URL is specified in the Local intranet. Alternatively, if this does not resolve it, attempt to add the URL to Trusted sites (for the K2 Host Server account browser)
  6. Add K2 Service Account to Local Administrators group in Control Panel > Local Users and Groups
  7. Turn off Internet Explorer Enhanced Security in Internet Options > Advanced.
    Image

    For Server Operating systems, the Internet Explorer ESC needs to be disabled in the Server Manager console as shown below:

    Image

 

If the settings above have been verified and the styling is still not applied continue with the steps below:

  1. Log on as the K2 Service Account. Navigate to Control panel -> Internet options -> Security -> Local intranet
  2. Add the server name to the list of sites on the intranet
  3. Click on Custom level and change user authentication to automatic logon with username and password
  4. Change access data sources across domain to enable from prompt

If the styling is still not applied after applying the above changes, then open Internet Information Services and ensure that the following module features have been installed on the runtime site:

  1. HTTPRedirectionModule
  2. URLAuthorizationModule

 


0 replies

Be the first to reply!

Reply