css is not working for html to pdf generation in outsystem

css is not working for html to pdf generation in outsystem

  

hello,

I want a generate a pdf from html in outsystem. in which my css part is not working. also fonts looks different.

What i need to do to make my html structrure as it is in pdf with fonts and all things like width of table ,td and all elements.

Hi,


What tool are you using?

Do you know if it's being generated in a different thread and thus no session information?

Do you include the fonts as well and can they be accessed from the server?

Can the css be access from the server where the pdf is being generated?

etc. etc.


i am using Nreco pdf third party dll for generating pdf.

Solution

Hi Bharat,

As far as I know, Nreco only handles css if their urls are absolute. And the css urls in OutSystems are relative and not absolute.

One solution is to parse the html and add the rest of the url (the domain part) to the places that need it.

Another solution is to use Html2PdfConverter:

https://www.outsystems.com/forge/component/209/html2pdfconverter/

Cheers,

José

Solution

hi jose, 

i put absolute url so my font issue is solved, css is also working only facing issue in width. not get exact width for div and td's. thanks for ur solution.if u have any solution for width plz let me know.

Hi Bharat,

Nice that you got it working.

Regarding the width: what kind of unit are you using? px? pt? em?...?

Could you try different ones and let me know the results?

Cheers,

José

hi, one more question.

Can we change the height and width of background of pdf.

i want to make it 800*600px.

{Note: i am using Nreco pdf third party dll for generating pdf.}