我正在尝试使用.cer
文件生成经过数字签名的pdf。但是我收到以下错误:
警告:openssl_pkcs7_sign():获取私钥时出错
C:\Apache24\htdocs\rapid\TCPDF-master\tcpdf.php
行7595 TCPDF 错误:某些数据已经输出,无法发送PDF文件 帮助我使用.cer
文件生成数字签名证书
我尝试仅通过使用.crt
文件而不是.cer
做同样的事情,并且得到了输出。需要知道如何使用.cer
而非.crt
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
$pdf->setPrintHeader(false);
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
if (@file_exists(dirname(__FILE__).'/lang/eng.php')) {
require_once(dirname(__FILE__).'/lang/eng.php');
$pdf->setLanguageArray($l);
}
$certificate = 'file://C:/Apache24/htdocs/rapid/b4udigital.cer';
$info = array(
'Name' => 'DS B4U BROADBAND INDIA PVT LTD',
'Location' => 'Mumbai',
'Reason' => 'Invoice',
'ContactInfo' => 'aaditya.dikshit@b4uworld.com',
);
$certificatesign='B4U BROADBAND INDIA PVT LTD';
$pdf->setSignature($certificate, $certificate,$certificatesign, '', 2, $info);
$pdf->SetFont('helvetica', '', 9);
$pdf->AddPage();
$html = "my content";
$html = utf8_decode($html);
$pdf->writeHTML($html, true, 0, true, 0);
$pdf->Image('../images/tcpdf_signature.png', 180, 60, 15, 15, 'PNG');
$pdf->setSignatureAppearance(180, 60, 15, 15);
$pdf->addEmptySignatureAppearance(180, 80, 15, 15);
$pdf->lastPage();
$pdf->Output('Invoice.pdf', 'I');