Guest User

Untitled

a guest
Oct 23rd, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. $pdf = new FPDI();
  2.  
  3. $pdf_path = $_SERVER["DOCUMENT_ROOT"] . "\files\" . md5(uniqid("")) . ".pdf";
  4. $path_assinado = $_SERVER["DOCUMENT_ROOT"] . "\files\" . md5(uniqid("")) . ".pdf";
  5.  
  6. file_put_contents($pdf_path, $pdfDocument);
  7.  
  8. $pageCount = $pdf->setSourceFile($pdf_path);
  9. for ($i = 1; $i <= $pageCount; $i++) {
  10. $pdf->AddPage();
  11. $page = $pdf->importPage($i);
  12. $pdf->useTemplate($page, 0, 0);
  13. }
  14.  
  15. $info = [
  16. 'Name' => $certificado->getCompanyName(),
  17. 'Date' => date("Y.m.d H:i:s"),
  18. 'Reason' => 'Assinatura',
  19. 'ContactInfo' => 'contact',
  20. ];
  21. $pdf->setSignature($certificado->__toString(), $certificado->privateKey, $senha, '', 1, $info);
  22.  
  23.  
  24. $pdf->Output($path_assinado, "F");
  25.  
  26. return file_get_contents($path_assinado);
Add Comment
Please, Sign In to add comment