Save page as PDF not working

I can’t see what i’ve misssed. I’m running a page which gives me exactly what i want on my screen, and i need to send an exact copy to my associate in the northern hemisphere. She has a mac system, no lucee, and we dont want to add it all. Just send her the same page as I’m looking at each week.

Here’s the effective code - the variable #BT20PDF# is the content of the page - a table - created with CFSAVECONTENT. It displays correctly on my screen. Then the code below is intended to save my screen contents as a PDF that I can email to my associate, knowing that it will show almost exactly the same on her MAC screen.

<cfdocument filename=“BT20PDF.pdf”
fontdirectory=“C:\Windows\Fonts”
format=“pdf”
margin=“1”
orientation=“landscape”
overwrite=“true”
pagetype=“letter”
src="#BT20PDF#"
type=“modern” saveasname=“D:\radioshow\bt20\chartpdf\BT20TestFile.pdf” >
#BT20PDF#
</cfdocument>

However the problem is that while the code looks to me like it ought to work, it doesnt. There’s no PDF appearing in the folder D:\radioshow\bt20\chartpdf\

my Lucee is v5.3.9.141, the PDF Extension is installed, v1.1.0.19

Can anyone see anything I’ve missed?

Cheers
Mike Kear
Windsor, NSW, Australia

@mikek Please refer these links

<cfdocument filename=“D:\radioshow\bt20\chartpdf\BT20TestFile.pdf”
fontdirectory=“C:\Windows\Fonts”
format=“pdf”
margin=“1”
orientation=“landscape”
overwrite=“true”
pagetype=“letter”
src="#BT20PDF#"
type=“modern” saveasname=“BT20TestFile.pdf” >
#BT20PDF#
</cfdocument>

Also, you use the absolute path in the filename attribute. It will help your problem.

Thanks for your quick response.

I have actually read the documentation for CFDOCUMENT and it’s not specific about some things. For example it says:

fontembed string, optional - define if fonts will embedded with the file

How to define it? it gives no indication. Boolean? no. It says “string” . So what is the valid string values that can go in there?

Also documentation of the different naming parameters is very confusing. Where should the full name of the desired output file be? and where should the path for that be? and what is the name of the variable to use as the source data for the PDF? The documentation isnt very specific about that. I made about a dozen attempts at guessing these before posting my request, and I hoped that someone who’d actually used it would be able to enlighten me.

I’m sorry but your example didnt change anything. Still no PDF is in that folder D:\Radioshow\BT20\chartpdf

Cheers
Mike Kear
Windsor, NSW, Australia

OK!!! i have moved forward a bit now. Turns out that Lucee is a lot more picky about data having single quotes or double quotes than ACF. For example it liked src=’#BT20PDF#’ but wouldn’t accept src="#BT20PDF#"

But because I can’t use the fontembed parameter because i havent been able to guess what needs to go in there, I can’t get the PDF styled like my web page version. It’s for radio broadcast, and bolding and italilcs are important to tell the presenter if that text is to be spoken or it’s for their advice only. So also is the colouring important for similar reasons. How can i style my finished PDF? The styling of the web page would do perfectly. If only the PDF could take those settings.

Cheers
Mike Kear
Windsor, NSW, Australia

It works fine for me. Can you please try this below code

<cfdocument filename="D:\BT20PDF.pdf"
format="pdf"
margin="1"
orientation="landscape"
overwrite="true"
pagetype="letter"
type="modern">
<h1>This is my text</h1>
</cfdocument>

That works. Thank you You’ve simplified the tag quite a bit. I’m grateful for that. now to address the styling. I dont think the PDF script will read the style sheets the way the page is structured, so obviously i need to change the way that’s written.
But that’s home turf for me, so I know i can get that done.

Thank you so much for your help.

CHeers
MIke Kear
WIndsor, NSW, Australia

1 Like