Skip to content

Commit 28faad5

Browse files
committed
Fixed margins and zoom level WOMM
1 parent 0d2ca8c commit 28faad5

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

lib/afip_bill/generator.rb

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,23 @@ def barcode
4444
@barcode ||= Barby::Code25Interleaved.new(code_numbers)
4545
end
4646

47+
def pdfkit_options
48+
{
49+
zoom: '1.65',
50+
'margin-bottom': '0.05in',
51+
'margin-top': '0.05in',
52+
'margin-left': '0.2in',
53+
'margin-right': '0.2in'
54+
}
55+
end
56+
4757
def generate_pdf_file
4858
tempfile = Tempfile.new("afip_bill.pdf")
49-
50-
PDFKit.new(template).to_file(tempfile.path)
59+
PDFKit.new(template, pdfkit_options).to_file(tempfile.path)
5160
end
5261

5362
def generate_pdf_string
54-
PDFKit.new(template).to_pdf
63+
PDFKit.new(template, pdfkit_options).to_pdf
5564
end
5665

5766
private

lib/afip_bill/views/shared/_factura_header.html.erb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
}
3030
body {
3131
line-height: 1;
32+
width: 595px !important;
3233
}
3334
ol, ul {
3435
list-style: none;
@@ -54,6 +55,7 @@
5455
margin-left: -297px;
5556
top: 0px;
5657
width: 595px;
58+
width: 100%;
5759
height: 842px;
5860
overflow: hidden;
5961
border: 1px solid grey;

0 commit comments

Comments
 (0)