Need a workaround for cfdocument scale

Since upgrading to Lucee my cfdocument scales the page up about 30%. This makes the pdf document too big to print and instead of 1 page it is now 2 pages. Because the pdf needs to mimic a government document this won’t work. Also, the end users are not particularily computer saavy and telling them how to print an html document isn’t a good answer either. Here is a blank version of the page before it is populated with the student information:

Is there a workaround for cfdocument scale="" ? And yes, I did add this.pdf.type = “classic”; to my application .cfc but got this error:

Message: class cannot be cast to class ( and are in module java.base of loader ‘bootstrap’)

Don’t forget to tell us about your stack!

OS: ??? Windows 2012
Java Version: 11.0.7 (AdoptOpenJDK) 64bit
Tomcat Version: Apache Tomcat/9.0.35
Lucee Version: Lucee

Maybe there are others with more experience with pdf than I have. Maybe @Jamo can help a little, because I know from this Stackoverflow post that he has created a customtag with a pdf commandline tool in the past. Sure there is a way to get this working.

1 Like

Tweaking the CSS has worked for me in the past to solve this kind of issue. I found two things to be really effective when dealing with CFDOCUMENT:

  • Use inline CSS instead of references to external stylesheet files.
  • Define the width of your document / paper size both like this:
<style type="text/css">
html, body { width:210mm; padding:0; margin:0; }
<div style="position:relative; top:0mm; left:0mm; width:210mm;">

Hope this helps.


if your not using the “classic” version, and instead using the new version which is flying saucer which supports css 2.1 and some higher you can try this style addtion.

			@page {
				size:11in 8.5in;
				margin: .4in .5in .75in .5in;
				@bottom-left {
					font-family: Arial, Helvetica, sans-serif;
					content: "Some Title Here"
				@bottom-right {
					font-family: Arial, Helvetica, sans-serif;
					content: "Page " counter(page) " of " counter(pages);
1 Like

Thanks to everyone who contributed. The solution ended up combining the suggestions. I had to move all of the code within the cfdocument declaration, in the old days we just enclosed the body portion. Specifying the pagewidth and pageheight in the cfdocument tag worked as long as all the rest of the css was inlined. Then I found that the tables were being messed up because I hadn’t specified a font or font size - pushing the text boxes beyond the original (old) design.

Well, if things didn’t break occasionally this would be too easy and everyone would do it :slight_smile: Thanks for all your help!