このコードは Coldfusion 11 で実行しています。
<cfset fileName = "test.pdf">
<cfcontent type="application/pdf" reset="true">
<cfheader name="Content-Disposition" value="attachment; filename=#fileName#">
<cfdocument localurl="yes" format="pdf" pagetype="letter" margintop=".5" marginbottom=".5" marginright="0" marginleft="0" orientation="portrait" unit="in" backgroundvisible="yes" overwrite="yes" fontembed="no">
<cfdocumentsection>
<div style="width:100%; background-color: #cccccc; margin: 0 0 0 0;padding: 0 0 0 0;">
<h1>Hello World!</h1>
</div>
</cfdocumentsection>
</cfdocument>
問題は、div のマージンとパディングを 0 に設定したにもかかわらず、左右にまだスペースがあることです。
このスペースをプログラムで削除して、背景がページの幅全体に広がるようにする方法はありますか?
更新(2017年8月7日)
James Moberg からのコメント/提案に従って、コードを更新しました。しかし、問題はまだ続きます。ここに更新されたコードがあります
<cfset fileName = "test.pdf">
<cfcontent type="application/pdf" reset="true">
<cfheader name="Content-Disposition" value="attachment; filename=#fileName#">
<cfdocument localurl="yes" format="pdf" pagetype="letter" margintop=".5" marginbottom=".5" marginright="0" marginleft="0" orientation="portrait" unit="in" backgroundvisible="yes" overwrite="yes" fontembed="no">
<?xml version="1.0" encoding="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>
<title>Test</title>
<meta http-equiv=Content-Type content="text/html; charset=windows-1252" />
<meta name=Generator content="Microsoft Word 12 (filtered)" />
</head>
<body style="margin: 0;padding: 0;">
<cfdocumentsection>
<div style="width:100%; background-color: #cccccc; margin: 0;padding: 0;">
<h1>Hello World!</h1>
</div>
</cfdocumentsection>
</body>
</html>
</cfdocument>