问题
I'm generating a very basic PDF with header and footer like this:
<cfdocument format="PDF" pagetype="A4" unit="cm" scale="100">
<cfset template_stlye = fileRead(expandPath('love.css'))>
<cfdocumentitem type="header" evalatprint="true">
<cfif cfdocument.currentpagenumber eq 1>
<style type="text/css" media="screen">
<cfoutput>
#template_stlye#
</cfoutput>
</style>
<div class="pdf_header">
<div class="header_text">
I'm a lovely header
</div>
</div>
</cfif>
</cfdocumentitem>
<cfdocumentitem type="footer" evalatprint="true">
<cfif cfdocument.currentpagenumber eq 1>
<style type="text/css" media="screen">
<cfoutput>
#template_stlye#
</cfoutput>
</style>
<div class="pdf_footer">
<div class="footer_text">
I'm a lovely footer
</div>
</div>
</cfif>
</cfdocumentitem>
<style type="text/css" media="screen">
<cfoutput>
#template_stlye#
</cfoutput>
</style>
<div class="pdf_content">
<h1>Foo bar</h1>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus dictum egestas lorem sed ultricies. Aliquam in orci eu massa semper tempor ac at nisi. Proin vestibulum dictum rhoncus. Mauris blandit congue auctor. Vestibulum sed fermentum nibh. Donec non nibh risus. Mauris vestibulum magna libero. Pellentesque vel lectus congue, eleifend sapien id, porttitor tortor. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vivamus eget imperdiet eros, in congue massa. Curabitur eget massa aliquam, rhoncus ipsum vitae, rhoncus felis. Integer a aliquet sapien. Donec lacinia sem sed turpis pellentesque ultrices.
</p>
<p>
Aenean eget magna sodales eros ullamcorper consectetur. Maecenas varius est ac rhoncus gravida. Donec posuere rhoncus massa nec suscipit. Nullam vestibulum nunc quis nisi pharetra dignissim. Maecenas lobortis placerat sapien porta cursus. Pellentesque aliquet a massa id sodales. Curabitur massa felis, pellentesque volutpat molestie vel, mollis sit amet purus. Donec faucibus felis ut neque tristique vulputate. Phasellus facilisis lectus ac vestibulum vulputate. Vivamus quis convallis nibh. Pellentesque commodo dolor et velit volutpat ultricies. Vestibulum pharetra at nulla a pulvinar. Donec non rhoncus justo. Sed tempus, tellus sed consequat dictum, est lectus ultrices ante, a sagittis urna eros non lorem. Fusce quis sagittis diam, quis sollicitudin leo. Nulla ut dolor iaculis, fermentum turpis eu, fringilla tellus.
</p>
</div>
</cfdocument>
The CSS file:
.pdf_content {
font-size: 11pt;
font-family: Arial, Tahoma;
}
.header_text, .footer_text {
font-size: 10pt;
font-family: Arial, Tahoma;
line-height: 9pt;
text-align: center;
}
.pdf_header, .pdf_footer {
position: absolute;
top: 0.5cm;
width: 18cm;
}
And I end up with the regular content in a wrong scale:
While it's supposed to look like this:
Any idea, why this is happening?
I'm working with:
- Windows 10, Version 1511, Build 10586.164
- Coldfusion 10.0.20.283922, Tomcat 7.0.68.0
回答1:
After some debugging efforts and further comparison with a co-workers setup we found out that the included Java version is so old that it doesn't even know Windows 10.
Settings before:
After pointing ColdFusion the the most recent JDK it worked.
Settings after:
PS: "fun fact" when changing back to the included Java version the scaling issue wasn't reproducible anymore. wtf
来源:https://stackoverflow.com/questions/38498310/coldfusion10-cfdocument-font-scaling-issue