Category : pdf

I currently using barryvdh/laravel-dompdf for printing pdf. But whenever I click on the print button it always downloads the file instead of opening a browser tab. How I can fix this ??? I’ve seen others post but I didn’t get the right solution too. $customer = Customer::findOrFail($id); $pdf = PDF::loadView(‘pdf.info-print’, $customer); return $pdf->stream(‘info.pdf’); Sourc..

Read more

use IlluminateHttpRequest; use PDF; class PDFController extends Controller { /** * Display a listing of the resource. * * @return IlluminateHttpResponse */ public function generatePDF() { $data = [ ‘title’ => ‘hello world’, ‘date’ => date(‘m/d/Y’) ]; $pdf = PDF::loadView(‘myPDF’, $data); return $pdf->download(‘itsolutionstuff.pdf’); } } Sourc..

Read more

I am trying to generate pdf using spatie/browsershot package but am facing some socket(10106) error. ERROR :- """ The command "/laragon/bin/nodejs/node-v12/node ^"C:^laragon^www^html^pdf_sc^vendor^spatie^browsershot^src/../bin/browser.js^" ^"^{^^"url^^":^^"https: ▶ Exit Code: -2147483645(Unknown error) Working directory: C:laragonwwwhtmlpdf_scpublic Output: Error Output: socket: (10106) The requested service provider could not be loaded or initialized. I am using "laravel/framework": "5.7.*", "spatie/browsershot": "3.40",npm 6.9.0, node ..

Read more

We are creating pdf file whith hepl of laravel This file is opening on majority of laptops and software but not opening in few computers. can’t figure out the reason. this is the error they are getting Code I am using to creating pdf file $apiInstance = resolve(XeroAPIXeroPHPApiAccountingApi::class); $result = $apiInstance->getInvoiceAsPdf($this->xeroCredentials->getTenantId(), $invoice->xero_invoice_id, "application/pdf"); $content = ..

Read more

I am trying to generate a PDF with some details of an individual user using the Barryvdh DomPDF library but having some problems trying to generate it. Controller method: public function downloadPDF(Card $card) { $user = User::find($card->user_id); $pdf = (new BarryvdhDomPDFPDF)->loadView(‘pdf/cardsReport’, $user); return $pdf->download(‘cards.pdf’); } Here is how I am referencing the route. <a href="{{ ..

Read more

I’m trying to merge PDF’s together that are stored on S3 and once merged, download them all. $mergePDF = PdfMerger::init(); foreach($models as $model){ if(!is_null($model->filename)){ $mergePDF->addPDF(file_get_contents(Storage::disk(‘spaces’)->url(‘invoices/’.$model->filename)), ‘all’); } } $mergePDF->merge(); $mergePDF->save(‘invoices.pdf’, "download"); If I try: $mergePDF->addPDF(file_get_contents(Storage::disk(‘spaces’)->url(‘invoices/’.$model->filename)), ‘all’); Gives me error: file_exists() expects parameter 1 to be a valid path, string given Other options: $mergePDF->addPDF(Storage::disk(‘spaces’)->url(‘invoices/’.$model->filename), ‘all’); Gives ..

Read more

I am trying to convert PDF to image using Imagick PHP. Able to achieve it when PDF is not password protected. But unable to find solution if PDF is protected with password. Any help will be much much helpful. My function – public static function convertPdfToImage($file) { $im = new Imagick(); $im->readImage($file); $im->setIteratorIndex(0); $im->setImageFormat(‘jpg’); return ..

Read more

I have developed a system where i need to generate pdfs using this package of laravel https://github.com/barryvdh/laravel-dompdf Now client is looking for silent printing feature so that user don’t see any printing preview page and printer can get command from one click on button. I tried to get list of printers by this code as ..

Read more

I am using laravel 8 and have installed dompdf on MAMP and everything works fine, but as soon i deployed it to my production server dompdf does not work anymore. I get the following message: Failed to load PDF document. When I check the server logs i only a see 500 error without any additional ..

Read more