这是我目前使用 ColdFusion 将 JPG 转换为 PDF 的尝试。我使用 cfdocument 因为它看起来很容易使用:
<cfdocument format="PDF" name="jpgtopdf" mimetype="image/jpeg" srcfile="#myfile#" pageheight="11" pagewidth="8.5">
</cfdocument>
不幸的是,这将分辨率降低到 72 DPI,破坏了 JPG 中的细节。我想保留原始的 JPG 分辨率。将JPG转换为PDF的最佳方法是什么?
--
编辑:当我把它<img>
放进去时,<cfdocument>
它只会产生一个空白文件。我相信会发生这种情况,因为出于安全考虑,#myfile#
它位于 webroot 之外。幸运的是,这让我得到了这个答案:stackoverflow.com/questions/4813587/dynamic-pdf-cfdocument-cfcontent-image-email-attachment,它确实允许以更高分辨率完成转换。这是我的新代码,似乎可以产生 300 DPI:
<cfdocument format="PDF" name="jpgtopdf" pageheight="11" pagewidth="8.5">
<cfimage action="writetobrowser" source="#myfile#">
</cfdocument>