From 28faad5672fdefc2243137345d49a3fc077ece19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Cerrini?= Date: Fri, 9 Nov 2018 18:32:46 -0300 Subject: [PATCH] Fixed margins and zoom level WOMM --- lib/afip_bill/generator.rb | 15 ++++++++++++--- .../views/shared/_factura_header.html.erb | 2 ++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/lib/afip_bill/generator.rb b/lib/afip_bill/generator.rb index 012a84a..c08c5df 100644 --- a/lib/afip_bill/generator.rb +++ b/lib/afip_bill/generator.rb @@ -44,14 +44,23 @@ def barcode @barcode ||= Barby::Code25Interleaved.new(code_numbers) end + def pdfkit_options + { + zoom: '1.65', + 'margin-bottom': '0.05in', + 'margin-top': '0.05in', + 'margin-left': '0.2in', + 'margin-right': '0.2in' + } + end + def generate_pdf_file tempfile = Tempfile.new("afip_bill.pdf") - - PDFKit.new(template).to_file(tempfile.path) + PDFKit.new(template, pdfkit_options).to_file(tempfile.path) end def generate_pdf_string - PDFKit.new(template).to_pdf + PDFKit.new(template, pdfkit_options).to_pdf end private diff --git a/lib/afip_bill/views/shared/_factura_header.html.erb b/lib/afip_bill/views/shared/_factura_header.html.erb index 86fe58a..e196b00 100644 --- a/lib/afip_bill/views/shared/_factura_header.html.erb +++ b/lib/afip_bill/views/shared/_factura_header.html.erb @@ -29,6 +29,7 @@ } body { line-height: 1; + width: 595px !important; } ol, ul { list-style: none; @@ -54,6 +55,7 @@ margin-left: -297px; top: 0px; width: 595px; + width: 100%; height: 842px; overflow: hidden; border: 1px solid grey;