ColdFusion - CFDOCUMENT заголовок в URL
Я создаю PDF-документ, используя ColdFusion cfdocument
тег. Работает нормально, однако вместо отображения имени документа в заголовке браузера - он показывает файл.cfc, который я вызываю для создания PDF.
Вот как я это называю.
<cfdocument format="pdf" marginbottom=".5" margintop=".25" marginright=".5" marginleft=".5" saveAsName="#filename#.pdf">
<cfdocumentitem type="footer">
<p style="font-size:11px; text-align:right; font-style:italic;">Page #cfdocument.currentpagenumber# of #cfdocument.totalpagecount#</p>
</cfdocumentitem>
<html>
<head><title>#filename#.pdf</title></head>
<body><img src="file:///#application.tempFolder#\#thisFilename#" /></body>
</html>
</cfdocument>
Какого черта я пропускаю? Почему он по-прежнему показывает файл filename.cfc, который я вызываю в заголовке браузера, вместо имени файла, который я даю PDF-файлу???
1 ответ
Решение
Догадаться. Пришлось создать документ с использованием CFDOCUMENT, затем добавить к нему атрибут "Заголовок" с помощью тега CFPDF. Затем выведите его в браузер.
<!--- Create the PDF --->
<cfdocument format="pdf" marginbottom=".5" margintop=".25" marginright=".5" marginleft=".5" filename="#application.tempFolder#\#thisSaveAsFilename#" overwrite="yes">
<cfdocumentitem type="footer">
<p style="font-size:11px; text-align:right; font-style:italic;">Page #cfdocument.currentpagenumber# of #cfdocument.totalpagecount#</p>
</cfdocumentitem>
<html>
<head><title>#thisSaveAsFilename#</title></head>
<body><img src="file:///#application.tempFolder#\#thisFilename#" /></body>
</html>
</cfdocument>
<!--- Use CFPDF to add attributes to it --->
<cfset thisInfo = StructNew()>
<cfset thisInfo.Title = "pdf title goes here...">
<cfpdf action="setinfo" info="#thisInfo#" source="#application.tempFolder#\#thisSaveAsFilename#" />
<!--- Send it to the browser --->
<cfcontent file="#application.tempFolder#\#thisSaveAsFilename#" type="application/pdf" />A