我使用HTML2PDF从textarea输入的文本和用户上传的图像生成PDF。我正在使用样式块来设置CSS,效果很好,生成的PDF看起来完全像我想要的。HTML2PDF - 生成的PDF不正确CMYK黑色(0,0,0,100%)
但是,PDF应该直接打印,不需要任何额外的转换。这里来我的问题:
当我检查PDF文本和PDF的黑色边框不CMYK 0%0%0%100%而是像CMYK 22%46%,一些奇怪的东西17%94%这意味着它不应该被打印,因为每封信都会被打印4次(至少这是我所知道的,我不知道任何关于打印的信息,我只知道它必须是0 0 0 100%〜)
编辑:为了避免混淆:这将是在白色背景黑色的边框多为黑色文本,认为公告,从平面杂志广告。添加到分类中的图像不需要是100%黑色。
某些代码我使用
<?php echo "
<style>
.contentwrapper {
position: relative;
}
.contentpdf {
border: 1mm;
border-style: solid;
border-color: #000000;
padding: 1mm;
position: absolute;
word-wrap: break-word;
word-break: break-all;
text-align: justify;
height: 50mm;
width: 100mm;
line-height: 2.5mm;
color: #000000;
font-family: 'Arial';
}
h1 {
font-size: 3.5mm;
line-height: 5mm;
margin: 0 0;
margin-top: 0mm;
margin-bottom: 0mm;
padding: 0 0;
color: #000000;
font-family: 'Arial';
}
p {
font-size: 2.5mm;
margin: 0 0;
margin-bottom: 0.5mm;
margin-top: 0.5mm;
padding: 0 0;
color: #000000;
font-family: 'Arial';
}
b, strong {
word-break: break-all;
word-wrap: break-word;
}
</style>
<page format='" . $width . "x" . $height ."' orientation='" . $orientation ."' backcolor='#FFFFFF'>
<div class='contentwrapper'>
<div class='contentpdf'>
" . $html ."
</div>
</div>
</page>";
$content = ob_get_clean();
$html2pdf = new HTML2PDF('L', 'A4', 'de', false, 'UTF-8', array(0,0,0,0));
$html2pdf->setDefaultFont('Arial');
$html2pdf->WriteHTML($content);
$file = "output.pdf";
$html2pdf->Output($file, "F"); ?>
基本上,我没有丝毫的线索,为什么PDF是那些怪异的价值,而不是CMYK 0 0 0 100%
任何帮助非常感谢。
就我所知,您不打印100%黑色,因为它看起来不如100%白色。你打印了吗?如果你想尝试另一个基于Electron(Chrome)的库,你可以试试https://github.com/msokk/electron-render-service,它也能很好地工作。 – three
@three我无法访问实际的打印机。一些背景:用于此的pdf大多为黑色文本和偶尔的图像,基本上在杂志中分类/广告。我可能不得不从你的链接尝试渲染服务,但我不想使用任何不同的东西 – ekrow
好的,你可以联系他们,看看打印是否真的需要100%。我真的怀疑。 – three