Open Robertbaelde opened 5 years ago
@Robertbaelde Hi,
at first glance everything looks fine.
Maybe you could provide some more code and we can try to figure out what the problem is.
What package are you using for generating and displaying PDFs?
What is the output if you dump dd($ticket->getRawPdf())
?
I'm using dompdf for the generation of the pdf's. The getRawPdf just returns the contents of the pdf
return Storage::disk( 'tickets-'.config('app.env'))->get($this->getPath());
@Robertbaelde
Looking at the error code it seems to me that you are calling merge()
method somewhere, after you called the output method string()
. The output method terminates the PDF, so it should be called only once in the end.
The issue ocurrs when merging multiple files in a foreach loop
I have the same issue, i am in a foreach loop also. The code outside the loop works fine, but inside the loop, i get the same error.
It works fine for the 1st element in the loop, but fail from the next one.
It looks like we cannot use PDFMerger several times on the same page ?
Did anyone find the solution/pointer on this. Especially in a backgound worker context this issue is killing me.
Hello, it seems that we can use "$merger = app('\GrofGraf\LaravelPDFMerger\PDFMerger');" instead of the facade, and it seems to work properly.
the problem happen only when we use several times pdfmerger on the same page, because it is used as a singleton.
May be there is a function to call after merge() to initialize it again ?
Hi,
I got the following error in my error log, when merging pdf's.
The code that gives the error, and interacts with the package:
Am i doing something wrong here? Or is there an issue in the package/underlaying library?