Cfdocument creates 0 length file

We inherited a project that uses cfdocument to create a PDF document. However, it always creates a 0 length file. We backed out all of the original code and tried to make a basic file, but that too is creating a 0 length file. Here’s the code:

table { font-family:Arial, Helvetica, sans-serif; font-size: .9em; }


Page #cfdocument.currentpagenumber#

This is a pretty high-priority project so we need to get this rectified ASAP.


Hi Harry. Which version of Lucee? And if 5+, which PDF extension version?

Can you post the basic file generation code?

We just updgraded from to The PDF extension was when we saw the issue, and we just upgraded to and it still remains. The file generation code was in my original post.


I’m not seeing it. Can you post the full cfdocument call? Use the preformatted text button </> so it renders properly as code.

<cfsetting showdebugoutput="yes">
<cfparam name="inItemId" default="16850">

	table { font-family:Arial, Helvetica, sans-serif;
	font-size: .9em;

<cfdocument format="pdf">


<h2>PDF Test</h2>



I can’t replicate the issue with Lucee 5.2.35 via commandbox. Your code produces the PDF as expected containing a heading “PDF test”.

Can you give more details of your environment? OS? Java version? Java servlet container (e.g. Tomcat)? Web server front end (e.g. Apache)?

We’re on RHEL 7.4 using Apache. Here’s the output from the tomcat’s

Server version: Apache Tomcat/8.5.11
Server built: Jan 10 2017 21:02:52 UTC
Server number:
OS Name: Linux
OS Version: 3.10.0-693.2.2.el7.x86_64
Architecture: amd64
JVM Version: 1.8.0_144-b01
JVM Vendor: Oracle Corporation

We have Apache forwarding tomcat/CFM request to the tomcat instance on port 8009.

Let me know if you need anything else.

Code works fine for me. As the file is 0 bytes, could this me a permission issue?

1 Like

I suppose it could be. But I have my browser set to download PDFs right now as a test. Where is the PDF being created on the server? I’m assuming its in the web application’s main folder, which is set to 775 right now and owned by root. Perhaps I need an ACL or something for the apache user?


As a test, I created a subfolder under the applications main area called pdf, and gave it 775 with apache.apache as the owner. I then modified the tag to include a filename: filename=“pdf/printItem.pdf”. When I run it, I get:

Lucee Error (java.lang.NoClassDefFoundError)
Could not initialize class sun.awt.X11.XToolkit

Why would that be?


OK, so I made the web application be owned by apache:apache, and now the PDF is created and displayed. So it was permissions related. Thanks for all of the help!


1 Like

OK, small wrinkle: I made the same permissions changes on the production server, and the PDFs don’t come out there. Any thoughts as to why?


Did you get to the bottom of this? Having the same issue…