ColdFusion CFDOCUMENT creates red X

I have a problem calling a server to a server with ColdFusion.

Suppose I have two servers, each of which has a file:

My source code is as follows:

<cfdocument format="pdf" pagewidth="11" pageheight="8.5"> This is a simple PDF that was created to show issues with content generation on the server. This PDF uses an http:// reference to the badge server to show an image of a badged team member. <BR /> <BR /> <img src="https://www.badge.com/badge.jpg" /> </cfdocument> 

If I remove the CFDOCUMENT tags, the page will render fine and the JPG image will display exactly as it should. However, when I present the page as a PDF, the document does not contain a JPG file, and a large, ugly red X appears, where the image should be reversed.

My web administrator suggested that although the user can authenticate on the icon and on the content, the icon server may not authenticate on the content or vice versa. How can I instruct coldfusion to accept user permissions from the current user and pull out the image?

I studied the use of CFIMAGE and saved the image file in the RAM of the content, and then wrote the image into a variable before PDF rendering. This seems to cause an error.

Thank you in advance for your feedback.

+1
source share
3 answers

Is the image always different? otherwise, you can save the image on your server locally and use the localURL attribute

http://www.ravenglass.com/blog/index.cfm/2010/6/9/Including-Images-in-a-PDF-created-in-CFDOCUMENT

Another possibility might be that SSL is not a "trusted" CF. You can try to get this image URL using CFHTTP and you will know if this happens. see Coldfusion: CFHTTP with SSL-encrypted page (https: //) - received an error message

+1
source

CFHTTP does not need to capture an image at a URL and save it locally. Try the following:

 <cfscript> myImg = imageRead("http://i.mycommentspace.com/23/2371.jpg") ; imageWrite(myImg,"c:\myimage.jpg",0.8); </cfscript> 

BTW images in CFDOCUMENT tend to work best when you use local paths, so as soon as you capture an image, try, for example, <img src="c:/myimage.jpg" />

+1
source

localUrl="yes" (or =true ) fails for https, for which CF-generating PDF files is painful.

 <img src="file:\\\#replace(getCurrentTemplatePath(),"my.cfm")#images\my.png"> 

You will need to move up and down the directories to get into the \ images folder.

0
source

Source: https://habr.com/ru/post/1495471/


All Articles