2016-11-14 51 views
1

我使用TCPDF形式例如#14有一个问题,我想删除输入标签的背景颜色,如在此截图:删除输入标签的背景色中生成的PDF

enter image description here

+0

没有任何代码,它是impossib乐来帮助你。 – Jakuje

+0

https://github.com/tecnickcom/TCPDF/blob/master/examples/example_014.php这里你可以找到代码 –

+0

你不能用'TextField()'做到这一点。 – Jakuje

回答

0

尝试这一个:

// print some text 
$text = 'This is an example of <strong>JavaScript</strong> usage on PDF documents.<br /><br />For more information check the source code of this example, the source code documentation for the <i>IncludeJS()</i> method and the <i>JavaScript for Acrobat API Reference</i> guide.<br /><br /><a href="http://www.tcpdf.org">www.tcpdf.org</a>'; 
$pdf->writeHTML($text, true, 0, true, 0); 

$js = <<<EOD 
var inputFields = document.getElementsByTagName("input"); 
for (var i = 0, length = inputFields.length; i < length; i++) { 
    var inputField = inputFields[i]; 
    inputField.style.backgroundColor = "#ffffff"; 
} 
EOD; 

// set javascript 
$pdf->IncludeJS($js); 

或者这一个:

// define some HTML content with style 
$html = <<<EOF 
<!-- EXAMPLE OF CSS STYLE --> 
<style> 
    h1 { 
     color: navy; 
     font-family: times; 
     font-size: 24pt; 
     text-decoration: underline; 
    } 
    input { 
     background-color: red; 
     padding: 5px 10px; 
    } 
</style> 

<h1 class="title">Example of <i style="color:#990000">XHTML + CSS</i></h1> 
<input type="text" value="test.." /> 

EOF; 

// output the HTML content 
$pdf->writeHTML($html, true, false, true, false, ''); 
+0

我想删除默认颜色(灰色),只有透明,解决方案颜色在焦点上删除。 –

+0

如何设置默认颜色?通过CSS?你不能只是“删除”一个默认的颜色。您需要指定它应该具有的颜色。浏览器默认颜色,例如将是白色的。 –

+0

我不知道这个颜色是如何设置的。我需要你的帮助来找出这个颜色的定义。你是否理解我在谈论PDF文件而不仅仅是HTML页面? –