In my project I am saving scanned documents to either pdf or image format. Now After scanning I am creating a barcode of the file. Then I want to print to print the scanned docs together with the barcode. Now I am using fpdi for generating the pdf file that I will put the scanned document into together with the barcode. I want to set the scanned documents as background of the pdf and then just add the barcode above the scanned document.
I am using:
Code Igniter Fpdf Tcpdf
I used the code below:
$pdf = new Fpdi();
$pdf->SetTitle($filename);
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
$pdf->SetDefaultMonospacedFont('helvetica');
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
$pdf->AddPage();
$str = preg_replace('#^https?://#', '', base_url());
$img_file1 =$str.'assets/uploads/'.$filename;
$img = '../../../../SystemName/assets/uploads/8787123.jpg';
$pdf->fullPathToFile = $img_file1;
$pdf->setSourceFile($img_file1);
$pdf->importPage(1, '/MediaBox');
$pdf->Output($title,'I');
But this is what I am getting:
An uncaught Exception was encountered
Type: InvalidArgumentException
Message: Cannot open IPADDRESS/SystemName/assets/uploads/7766_1.pdf !
Filename: C:\xampp\htdocs\SystemName\application\helpers\tcpdf\fpdfi\pdf_parser.php
Line Number: 183
Backtrace:
File: C:\xampp\htdocs\SystemName\application\helpers\tcpdf\fpdfi\fpdi_pdf_parser.php
Line: 64
Function: __construct
File: C:\xampp\htdocs\SystemName\application\helpers\tcpdf\fpdfi\fpdi.php
Line: 123
Function: __construct
File: C:\xampp\htdocs\SystemName\application\helpers\tcpdf\fpdfi\fpdi.php
Line: 101
Function: _getPdfParser
File: C:\xampp\htdocs\SystemName\application\views\reports\barcode.php
Line: 79
Function: setSourceFile
File: C:\xampp\htdocs\SystemName\application\controllers\Document.php
Line: 701
Function: view
File: C:\xampp\htdocs\SystemName\index.php
Line: 315
Function: require_once
Update:
I need to scan a document they can be in pdf format or image (pdf more preferred) then I need to attach a barcode on that scanned document for printing. So my solution is after scanning I click a print button use fpdf to make another pdf that will include the bar code and the scanned document