Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working in Laravel 5.4 #18

Closed
PSuresh3one opened this issue Jun 6, 2017 · 1 comment
Closed

Not working in Laravel 5.4 #18

PSuresh3one opened this issue Jun 6, 2017 · 1 comment

Comments

@PSuresh3one
Copy link

I'm using fpdf and fpdi in my laravel project, I want to skip pages from my original pdf and output modified pdf, but is showing the following error
fpdi-error

Here is my code:

require_once('fpdf.php');
require_once "fpdi.php";
$pdf = new FPDI(); //FPDI extends TCPDF
$pageCount = $pdf->setSourceFile('Seeking-Civility.pdf');

// Array of pages to skip -- modify this to fit your needs
$skipPages = [21,22,23,24,25,26,27,28,29];

// Add all pages of source to new document
for( $pageNo=1; $pageNo<=$pageCount; $pageNo++ )
{
// Skip undesired pages
if( in_array($pageNo,$skipPages) )
continue;

//  Add page to the document
$templateID = $pdf->importPage($pageNo);
$pdf->getTemplateSize($templateID);
$pdf->addPage();
$pdf->useTemplate($templateID);

}

$pdf->Output();

@JanSlabon
Copy link
Member

I guess you're in a namespaced controller class. So simply use new \FPDI().
Additionally I would suggest to load the classes via composer.
As this is not a bug or issue in FPDI I will close this issue directly. Feel free to use Stackoverflow for further questions/problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants