cloudprint icon indicating copy to clipboard operation
cloudprint copied to clipboard

PDF not align properly.

Open CatalinVoineag opened this issue 7 years ago • 2 comments

Hi.

I'm using your gem and it works perfect, almost...

I want to print a label for a product, I construct the PDF in my app, no problem, Initialize a CloudPrint instance and call print on it. The problem comes when the printer prints the label. The position of the label is totally wrong. It's not at the top of the page where I've expected it to be.

Can you have any control over the page settings, e.g. "Fit to page" or other options you have when printing directly to a printer in Google Chrome?

Here is my code:

          client_id = file[Rails.env.downcase]["client_id"]
          client_secret = file[Rails.env.downcase]["client_secret"]
          client = CloudPrint::Client.new(
            client_id: client_id,
            client_secret: client_secret,
            refresh_token: refresh_token
          )
          client.printers.find(default_printer_id).print(content: base64, content_type: "application/pdf", ticket: {"version": "1.0", "print": {}}, content_transfer_encoding: "base64")

Thank you.

CatalinVoineag avatar Nov 14 '17 11:11 CatalinVoineag

I'm pretty new to using this gem, but I had some similar issues trying to post onto a 4x6 size paper. I eventually had to dig into google's documentation on GCP tickets.

https://developers.google.com/cloud-print/docs/cdd#cjt

I had to choose my media_size on my ticket using the vendor_id on the printer itself. If you use this gem to query printers, and then inspect the printer you want to use you can read the vendor_id's of the paper types. Not sure if that helps, but it took me FOREVER to figure it out.

bdpluim avatar Nov 14 '17 14:11 bdpluim

It did help, I managed to correctly position the label on the page. Thank you!

CatalinVoineag avatar Nov 15 '17 17:11 CatalinVoineag