Skip to main content
tonym64063353
Inspiring
January 31, 2024
Question

cfhtmltopdf connection refused?

  • January 31, 2024
  • 1 reply
  • 3749 views
We migrated our Coldfusion 2023 Windows Server to a new server over the weekend, and "cfhtmltopdf" has stopped working.  It can generate a PDF fine and display it, but when actually trying to save it to the server, we get this:

<cfhtmltopdf
destination="c:\filename.pdf"
  source="http://#CGI.Server_Name#/filename.html" overwrite="true">
</cfhtmltopdf>
 
Jan 31, 2024 13:16:12 PM Error [ajp-nio-127.0.0.1-8022-exec-24] - Connect to 127.0.0.1:8995 [/127.0.0.1] failed: Connection refused: connect http://127.0.0.1:8995/PDFgServlet/
Jan 31, 2024 13:16:12 PM Error [ajp-nio-127.0.0.1-8022-exec-24] - Error occurred while generating PDF.
 
Not sure if this helps, but http://127.0.0.1:8995/PDFgServlet/ brings up:
 
HTTP ERROR 400 Bad Request
URI: /PDFgServlet/
STATUS: 400
MESSAGE: Bad Request
SERVLET: PDFgServlet
Powered by Jetty:// 9.4.51.v20230217
 
The service for Coldfusion2023add-onservice is running, and port 8995 is open.  
 
Any ideas/suggestions?
    This topic has been closed for replies.

    1 reply

    BKBK
    Community Expert
    Community Expert
    April 3, 2024

    The HTTP 400 error suggests that ColdFusion can actually connect with the PDF service. This is confirmed because ColdFusion can generate and display PDFs.

     

    You are perhaps getting the error because cfhtmltopdf is unable to read a file or to overwrite an existing PDF. The source file may not exist .  Is the source paerhaps http://#CGI.Server_Name#:#CGI.Server_Port#/filename.html ? The destination PDF file may be open or be locked by another process. Check that.