gpt4 book ai didi

coldfusion - Railo PDF 生成问题

转载 作者:行者123 更新时间:2023-12-01 02:01:55 25 4
gpt4 key购买 nike

我对 Railo 比较陌生。尝试在“Railo”上设置应用程序时,我遇到了 PDF 生成问题。请注意,我在 Adob​​e CFML Server 上运行该应用程序没有任何问题。

问题:在我的应用程序的某处,我有一个按钮可以从数据库中获取数据并提供可下载的 PDF 文件。在 Railo 服务器上,返回的 PDF 内容带有“有趣的字符”。输出语言是希腊语。希腊语有许多重音字符。这就是问题所在(重音字符以“有趣”的格式返回,例如 Ÿ 代表 ή 或 Š 代表 O 或 OÉ' 代表 Λ)。我认为问题与 Railo 的字体集有关。在 openBD 服务器上也有同样的表现!我已经尝试在 cfm 文件中添加 cfprocessingdirective pageEncoding="utf-8" 但没有结果。我曾尝试在 fonts.jar(位于\WEB-INF\lib 文件夹下)中添加字体,但也没有结果(并在 PDF css 中调用字体)。

我不想再使用 Adob​​e CFML Server。

这个问题有什么解决方案吗?

非常感谢,

汤姆

希腊

cfc 只是提供来自数据库的数据

我使用的代码:

<cfprocessingdirective pageEncoding="utf-8">
<cfif not IsDefined("URL.id")>
<cfelseif not IsDefined("URL.model")>
<cfelseif not IsDefined("URL.title")>
<cfelseif not IsDefined("URL.id_tree")>
</cfif>
<cfheader name="Content-Disposition" value="attachment; filename=#URL.id_tree#.pdf">
<cfcontent type="application/unknown; charset=utf-8">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!---<link rel="stylesheet" type="text/css" href="resources/fonts/MinionProRegular/MinionProRegular.css" charset="utf-8" />--->
<title>Print</title>

</head>

<body>

<!---<cfif not IsDefined("URL.id")>
<cfelseif not IsDefined("URL.model")>
</cfif>--->

<!--- Get print details --->
<cfinvoke
component="Print"
method="myPrint"
returnvariable="getContent"
id="#URL.id#"
model="#URL.model#">

<!---<cfdump var="#getMember#">--->

<!--- Output the PDF --->
<cfdocument
format="pdf"
pagetype="a4"
<!---pageheight="5"
pagewidth="6.5"--->
margintop="0.6"
marginbottom="0.8"
marginright="1.3"
marginleft="1"
scale="90"
unit="in"
fontembed="true"
backgroundvisible="true">

<cfoutput query="getContent" >
<style type="text/css">
.logo {
background-image:url(../../images/app-specific/ithemis_logo_NEW.png);
background-repeat: no-repeat;
display: inline-block;
float: left;
clear: right;
}
.name {
font-family: Georgia, "Times New Roman", Times, serif;
font-size: 12px;
color: ##5a5a5a;
<!---float: left;
clear: right;--->
<!---margin-top: 5px;--->
}
.body {
font-family: "Times New Roman", Times, serif;

<!---font-family: Bodoni;--->
<!---font-family: Didot;--->
<!---font-family: Greek;--->
<!---font-family: Geosanslight;--->
<!---font-family: Minionpro_regular;--->
<!---font-family: Philosopher;--->
<!---font-family: Russian;--->

font-size: 11px;
color: ##323232;
line-height: 17px;
<!---float: left;
clear: right;--->
}
.line {
font-size:1px;
border-bottom-width: 1px;
border-bottom-style: solid;
border-bottom-color: ##202020;
padding-bottom: 5px;
}
.point {
font-family: Georgia, "Times New Roman", Times, serif;
font-size: 11px;
padding: 5px 5px 5px 5px;
color: ##373737;
background-color: ##eeeeee;
/*width: 100% !important;*/
display: block !important;
text-align: justify;
}
</style>

<!---<cfprocessingdirective pageencoding="utf-8">--->
<cfdocumentitem type="header">
<img src="../../images/app-specific/ithemis_logo_print_pdf.png" alt="iThemis logo" width="80" height="30" style="float:left;" border="0"/>
</cfdocumentitem>
<!---Use a footer with current page of totalpages format. --->
<cfdocumentitem type="footer">
<cfoutput><span style="font-family:Georgia, 'Times New Roman', Times, serif;font-size:10px;color: ##5a5a5a;float:right;">Σελίδα #cfdocument.currentpagenumber# από #cfdocument.totalpagecount#</span></cfoutput>
</cfdocumentitem>


<table border="0">

<tr>
<td><span class="name">#Title#</span></td>
</tr>

<tr>
<td><span class="body">#Body#</span></td>
</tr>

</table>

</cfoutput>
</cfdocument>

</body>
</html>

最佳答案

Railo 在某些方面有所不同。生成 PDF 的 CFC/CFM 文件也以 unicode 格式保存,这一点非常重要。

我建议在您的编辑器中转到"file">“新建”,并确保编辑器允许您在创建文件之前定义 BOM 和编码。

然后将代码复制/粘贴到新文件中并用它覆盖文件。

如果您这样做,它应该会起作用。

这听起来很奇怪……但试一试。它多次修复了我在 Railo 上的 UTF-8 应用程序。

Dreamweaver,虽然我不再使用它 - 允许在创建文件时定义这些设置。您还可以在所有 future 文档的首选项中设置它们。 dreamweaver preferences pane

在 SublimeText 2 上,您可以保存带有编码和 BOM 的文件。 sublimetext save as encoded

在 ColdFusion Builder 中,不确定 BOM 设置的确切位置,但这是确保默认编码设置为 UTF-8 的首选项难题。 coldfusion builder preferences pane

我希望这对您和其他遇到类似问题的人有所帮助。请记住:如果您使用的是 UTF-8/Railo,则必须确保交互的每个方面也都以 UTF-8 保存。包括 cfc/cfm 文件本身。

祝你好运!

关于coldfusion - Railo PDF 生成问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11599597/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com