Question re formatting of paragraph text PDF

Hi all,

I am converting a CF server to Lucee. When I create a PDF document in Lucee it looks significantly different to the same one in CF - mainly due to spacing. I found some posts in the forum that talk about bundling fonts but wasn’t successfully able to do this. I was, however, successful in changing fonts by wrapping text with:


The problem that I’m having now is that there is still a lot of vertical spacing between lines - whether it’s text within a table, or text within a paragraph. There seems to be a lot of padding that I cannot strip out.

Does anyone have any ideas on what inline CSS I can add in? Line-height seems to be ignored.


OS: Windows Server 2019
**Lucee Version

@martinbailey Can you give a sample test to reproduce your problem?

My suggestion is instead of trying to use css for PDF layout use TEXT and or basic html tags.

Hi Terry,

I am kind of doing that, but with limited success. I’ll post some sample test code tomorrow, with some PDF examples from CF and Lucee, so that you can see the difference.

Basically, if I have a HTML table with cell content there is a lot more padding with the Lucee-generated PDF than the ColdFusion PDF, and I was thinking to use CSS to somehow minimise this. However, nothing I’ve tried so far has worked.

I’ll get back tomorrow with some examples.

Thanks. (52.1 KB)

I’ve created a zip file that contains three files:

  1. a CFML page that creates (and saves locally) the PDF, with a link to then open it
  2. An example of the ColdFusion generated PDF
  3. An example of the same page generated on Lucee.

Hopefully this clearly demonstrates the issue. Some of the CSS is remnants from my (failed) tests, so can probably be removed anyway…


@martinbailey Yeah having a problem with PDF’s in PDF latest version with ACF. In lucee Classic PDF engine creates a PDF that looks like ACF. Can you try with a classic pdf engine in lucee? In applicaation.cfc set this.pdf.type = "classic"; or add attribute in cfdocument type="classic". Here are the docs related to this Flying Saucer PDF Engine - CFDOCUMENT :: Lucee Documentation

1 Like

test_pdf_classic.pdf (2.3 KB)

Yes, if I add type=“classic” to the cfdocument command then this removes all of the spacing. The only (very minor) downside is that this breaks the file on a ColdFusion server. (I have CF installed locally, so it means that whenever I’m testing layout I’ll have to keep adding/deleting that command from the CFDOCUMENT tag for testing purposes).

Thanks very much for your help.

Use this.pdf.type="classic" in Application.cfc so you can avoid add/delete that while you run ACF.

OK. I’ll do that. (This is a very basic website, and I hadn’t even created an application.cfc file for it, but it makes sense to do that now, rather than messing around with individual files).

Thanks again!