top of page
  • Writer's pictureJLCodE Team

GoogleCloudPrint with Laravel

Hello Everyone.

We know well about Google Cloud APIs - Google Cloud Doc, Google Cloud SQL, Google Cloud VM Instace, Google Cloud Print, etc.

Today, I am going to write some our experiences with Google Cloud Print and


To use Google Cloud Print APIs, you must install necessary package.

Package name : GoogleCloudPrint.

Command : composer require bnbwebexpertise/laravel-google-cloud-print

Download google service account credential : credential.json


{ "type""service_account", "project_id""cloud-printer-****", "private_key_id""123123123123", "private_key""-----BEGIN PRIVATE KEY----- *****\n-----END PRIVATE KEY-----\n", "client_email"example@cloud-printer-**", "client_id""123123123123", "auth_uri""", "token_uri""", "auth_provider_x509_cert_url""", "client_x509_cert_url"""   }

After install package, you can use Class GoogleCloudPrint in necessary php files.

In env file, Add this line. GCP_CREDENTIALS_PATH=./cloudprint.json

Google Cloud Print have some features which can bu used to print from PDF, HTML, Image.

Here, we mention about from PDF.

Before run print function, you need to create PDF file what you want to print.

GoogleCloudPrint::asPdf()                     ->file($path.$filename.'.pdf')                     ->printer($printerId)                     ->send();

After execute print function, you can see the pdf file in google printer page under you selected printer ID.

That's all.

Hope this will be helpful.


Next time, we'll post some technologies in Mobile Hybrid application (CMS CRUD).

Thanks a lot.




bottom of page