Programmatic Customization – the BookPrint Delegate
As mentioned earlier, when generating a PDF the cover header by default includes a PTC logo provided via XSLT parameter imageUrl.
The value of the parameter is customizable using BookPrintDelegate.java. If a user logs in with a Service Group Context, an image for the Service Group can be provided instead of the default image. The image needs to be in a format supported by PDF, such as PNG, and be of suitable resolution for hard copy.
For the custom image to be inserted the delegate must provide a custom location and a custom image. The default implementation for the delegate is provided by DefaultBookPrintDelegate.java.
This class provides a default implementation of the getLogoPart API which does not expect any parameter and returns the logo path in a String format. The default implementation calls three private methods:
• getCustomLogoUrl: This returns the path for the custom logo. The default implementation returns null, but sample code is present inside the method for reference. In order to configure the custom logo you should create a custom folder below ${enigma.work.home}/Applications/PrintServer/Config/ and to contain the custom image
// Sample code to return custom logo download.png in folder custom
private String getCustomLogoUrl() {
String baseUrl = StringResolver.resolve("${enigma.work.home}/Applications/PrintServer/Config/");
if (baseUrl != null) {
return baseUrl + "custom/download.png";
}
• getLogoAssociatedWithSG: This returns the path for a logo associated to Service Group if a custom logo is not available.
• getDefaultLogoUrl: This returns the default logo path if both custom logo and logo associated with SG is not available.