If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

How to apply CSS style in PDF

Started by Yasser, 12 Jan 2017 03:48:22 AM

Previous topic - Next topic

Yasser

Hello,

I want to apply some css style in some elements in a report, I've created an HTML item and but my css code inside and created html items before and after the elements which I want to change to specify the css class, Now it is working correctly while running the report as HTML, But when I run it as PDF the styles not applied. This there any workaround to solve this?

Thanks,

MFGF

Quote from: Yasser on 12 Jan 2017 03:48:22 AM
Hello,

I want to apply some css style in some elements in a report, I've created an HTML item and but my css code inside and created html items before and after the elements which I want to change to specify the css class, Now it is working correctly while running the report as HTML, But when I run it as PDF the styles not applied. This there any workaround to solve this?

Thanks,

Hi,

Instead of doing this, go to the Page Explorer and select the Classes area. You can define your own custom class and apply this to anything in the report, using the object's Classes property. It will apply for any rendering types that support formatting (eg HTML, PDF, Excel etc).

Cheers!

MF.
Meep!

Yasser

Hello,

Many thanks for your response MF,

I've tried this but is is not 100% as I want, there are some properties I don't know how to apply in cognos like (box-shadow: 0 2px 4px 0 rgba(0,0,0,0.16),0 2px 10px 0 rgba(0,0,0,0.12)) and the border-radius as well.

Is there any way to write the class style as css ?


CognosPaul

The PDF agent Cognos uses does not support CSS3, and many of the modern properties, like box-shadow and border-radius simply will not work. You CAN hack the classes to force those values to be included (open the xml, modify the classes directly), but they'll just be ignored in the PDF. Some things like box shadow can be replicated through clever positioning, but that's dangerous and difficult to support. In some cases I've found it easier to just create images for the background and use that (1 for the top, 1 for the bottom, and a repeating image for the height).

Yasser

Quote from: CognosPaul on 12 Jan 2017 03:03:42 PM
The PDF agent Cognos uses does not support CSS3, and many of the modern properties, like box-shadow and border-radius simply will not work. You CAN hack the classes to force those values to be included (open the xml, modify the classes directly), but they'll just be ignored in the PDF. Some things like box shadow can be replicated through clever positioning, but that's dangerous and difficult to support. In some cases I've found it easier to just create images for the background and use that (1 for the top, 1 for the bottom, and a repeating image for the height).

Great, I will apply the image background Idea.
Thanks Paul,