我能得到的最接近的是使用这段代码
<cfset Background = ImageNew("",1725,2625)>
<cfimage source="#APPLICATION.config.serverpath#/ad1.tif" name="ad1">
<cfset height1 = ImageGetHeight(ad1)>
<cfset width1 = ImageGetWidth(ad1)>
<cfset resImage1 = ImageCopy(ad1,0,0, width1, height1)>
<cfset ImagePaste(Background,resImage1,150,150)>
<cfdocument format="pdf" pagetype="custom" pagewidth="5.75" pageheight="8.75" fontembed="no" name="temp" margintop="0" marginbottom="0" marginleft="0" marginright="0">
<div style="position:absolute; top:0; left:0; right:0; bottom:0; z-index:0;width:100%;height:100%;">
<cfimage action="writeToBrowser" source="#Background#" style="width:1740px; height: 2650px;">
</cfdocument>
这让我非常接近我的 TIF 图像的精确副本,但由于某种原因,图像在宽度上减少了 5 个像素,我不知道为什么。
更多细节:ad1.tif 图像为 1425x1125,生成的最终 pdf 文档为 1725x2625。如您所见,我在 cfdocument 上使用 5.75 x 8.75 英寸。这转换为 300DPI 的 PDF 文档。当我在 Photoshop 中加载 PDF 文档时,它确实声明该文档为 300DPI。
您可能会注意到 ImageNew 使用 1725x2625 而 cfimage 使用 1740x2625。如果我将 cfimage 尺寸与 imagenew 相匹配(这很有意义),那么您最终会在顶部、右侧和底部都有这个白色边框。图像在宽度上仍然偏离了大约 5 个像素。所以我不得不把它弄大一点来摆脱那个白色的边框。如果我能弄清楚为什么该图像偏离了 5 个像素。