is there a simple solution to make generated PDFs look more like they did in Coldfusion? it would especially help to generally reduce the font size
Which version of Lucee? The PDF engine changed in 5.3. To change the font size you only need to change the CSS
22.214.171.124 so it should work - seems like my css file is not found. When I omit cfdocument, I get a HTML page that finds the css and is formatted correctly. When I wrap everything in cfdocument, the formatting is gone. Does this code look ok? could it be some caching problem?
<cfdocument format="PDF"> <html> <head> <cfoutput> <LINK href="https://#cgi.http_host#/css/mycssfile.css" type=text/css rel=stylesheet> </cfoutput> </head> <body> some content here </body> </html> </cfdocument>
Keep it simple and avoid the http request, i.e read the CSS file in and output it inline
Ok I now put all css directly into a style tag in the head of the created page. No difference
So changing the CSS font size doesn’t affect the PDF output?
It works now after trying this and that. Not entirely sure what the culprit was, but probably some invalid css on my part. Thank you for your patience!!
Using a CSS file still doesn’t work - I have to specify everything inline. Is that a known bug?
did you see any requests hitting your webserver when you run CFDOCUMENT?
I just saved this as pdf.cfm under my C:\lucee\tomcat\webapps\ROOT
<cfdocument format="PDF"> <cfoutput> <html> <head> <LINK href="http://#cgi.http_host#/assets/css/lib/bootstrap.min.css" type=text/css rel=stylesheet> </head> <body> outputting the url as text so i can confirm it's correct http://#cgi.http_host#/assets/css/lib/bootstrap.min.css </body> </html> </cfoutput> </cfdocument>
and accessed http://localhost:8888/pdf.cfm and I can see the css being applied, and the css file request shows up in my C:\lucee\tomcat\logs\localhost_access_log.2019-07-01.txt log file
127.0.0.1 - - [01/Jul/2019:12:05:02 +0200] "GET /assets/css/lib/bootstrap.min.css HTTP/1.1" 200 43855 0:0:0:0:0:0:0:1 - - [01/Jul/2019:12:05:02 +0200] "GET /pdf.cfm HTTP/1.1" 200 1033
I’m running the 126.96.36.199-RC
hmm when I don’t use variables but write the http_host in there literally, it works. Oh well … I’ll do that then
it would be nice to have a CFDOCUMENT throwonerror=true option to throw an error when an external (i.e requested over http) resource returns a 404
flying saucer does allow overriding the built objects which do this
the custom uri’s also looks interesting, that could be used to pass in server side content via a lucee:// scheme without having to fall back on http requests