Write a file from CFC

I have a CFC which creates a PDF document which I wish to save to a file. How do I achieve this?

You can use cfpdf tag with destination and overwrite.

omarpta: Tried it and it worked well. Thank you very much! One thing though…I’m trying to include an image using:

<img src="img/DAIRY.jpg" 
            	 alt="sometext" 
                 align="left"
                 width="120"
                 height="120"/>

but it just leaves a blank space. How do I give it an absolute, rather than a relative, address?

Ok, fixed it! Needed to use:

img src="file://localhost/Images/DAIRY.jpg" 

keep in mind that file:// is relative to the user browsing the page, not to the server.
the file will need to exist on the users computer

So what should I use in order to be user-independent?

If the Images folder is at the root of your site just use: <img src="/Images/DAIRY.jpg">

More information:
https://www.w3schools.com/html/html_filepaths.asp

Thanks for staying with me on this. I’m executing the script in a folder called “root”. Below that is a folder called “assets” and below that “img” which contains DAIRY.JPG. So, my tag looks like:

img src=“assets/img/DAIRY.jpg”

and it doesn’t find the image.

EDIT: I should have used img src="/assets/img/DAIRY.jpg - that works!