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

Fatal error: Class 'Ilovepdf' not found in... #18

Closed
dhirajsah opened this issue May 20, 2018 · 6 comments
Closed

Fatal error: Class 'Ilovepdf' not found in... #18

dhirajsah opened this issue May 20, 2018 · 6 comments

Comments

@dhirajsah
Copy link

I am new in this i did exactly as ilovepdf document but i am getting error
below is my code:

<?php
require_once("ilovepdf/init.php");

`//` Authenticate
$ilovepdf = new Ilovepdf('project_public_id', 'project_secret_key');

// Choose your processing tool and create a new task
$myTaskCompress = $ilovepdf->newTask('compress');

// Add files to task for upload
$file1 = $myTaskCompress->addFile('file1.pdf');
$file2 = $myTaskCompress->addFile('file2.pdf');

// Execute the task
$myTaskCompress->execute();

// Download the packaged files
$myTaskCompress->download();

?>
@maztch
Copy link
Collaborator

maztch commented May 30, 2018

Please make sure the require can acces the file from the script path. Maybe add a full path from current file path on require?

require_once(__DIR__ . "ilovepdf/init.php");

@maztch maztch closed this as completed May 30, 2018
@dhirajsah
Copy link
Author

Did the same still not working.

@beard7
Copy link

beard7 commented Dec 4, 2018

@dhirajsah Try using the full namespace:
$ilovepdf = new Ilovepdf\Ilovepdf('project_public_id', 'project_secret_key');

You may also need a backslash in front of the first \Ilovepdf

@uomopalese
Copy link

I'm getting this error:
Fatal error: Uncaught Ilovepdf\Exceptions\AuthException: Unauthorized in /Users/me/Sites/pdf-a/vendor/ilovepdf/ilovepdf-php/src/Ilovepdf.php on line 185
can you help please?
my code (from samples folder):

require_once('vendor/autoload.php');
require_once('vendor/ilovepdf/ilovepdf-php/init.php');

use Ilovepdf\PdfaTask;

$myTask = new PdfaTask('project_public_id','project_secret_key');

$file = $myTask->addFile('myfile.pdf');

$file->setConformance('pdfa-1a');

$myTask->setAllowDowngrade(false);

$myTask->setOutputFilename('pdfa');

$myTask->execute();

$myTask->download('/Users/me/Sites/download');

@marcogrossisas
Copy link
Contributor

@uomopalese hello, this should be a new issue.

But, do you have registered and swap the
$myTask = new PdfaTask('project_public_id','project_secret_key');

project_public_id and project_secret_key by the keys provided in your control panel?

@uomopalese
Copy link

Sorry, I thought this was a self-contained library to convert pdf to pdf/a using PHP, did not understand this was related to a website. Actually I don't have an account to ILovePDF. My fault.

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

5 participants