Skip to content
This repository has been archived by the owner on Aug 22, 2023. It is now read-only.

PDF load file does not return anything and gives 500 code instead #181

Open
Andressu opened this issue Sep 25, 2020 · 3 comments
Open

PDF load file does not return anything and gives 500 code instead #181

Andressu opened this issue Sep 25, 2020 · 3 comments

Comments

@Andressu
Copy link

$file_name = str_replace('/','\', $material->video_path);

$config = ['instanceConfigurator' => function($mpdf) {
$mpdf->SetWatermarkText('DRAFT');
$mpdf->showWatermarkText = true;
}];

PDF::loadFile(storage_path('app\'.$file_name), $config);

Hi I want to watermark existing pdf File, but I have some issues.

When I had tried to debug the config parameter , it gave me this error

"message": "Allowed memory size of 536870912 bytes exhausted (tried to allocate 264245248 bytes)",
"exception": "Symfony\Component\ErrorHandler\Error\FatalError",
"file": "C:\inetpub\wwwroot\moodle_bridge-master\vendor\niklasravnsborg\laravel-pdf\src\LaravelPdf\PdfWrapper.php",
"line": 28,
"trace": []

But if don't do debug at all, it gives 500 code. It did not return any error. i was confused. What did I do wrong? Please help

@niklasravnsborg
Copy link
Owner

Hey! Can you try to load the pdf without modifying? Also did you try to increase your php memory size?

@itzmj-23
Copy link

itzmj-23 commented Aug 2, 2021

I have same concern.

$pdf = PDF::loadFile(public_path('myfile.pdf'));

When I visit the route of this, the browser keeps loading, until it gives error 500.

I am using:

Laravel 7.x
PHP 7.4
"niklasravnsborg/laravel-pdf": "^4.1"

@niklasravnsborg
Copy link
Owner

Hey @itzmj-23,

what kind of error message or stack trace do you receive with the 500?

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

No branches or pull requests

3 participants