Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

help mimicking an Avery label #9

Closed
bbrendon opened this issue Jan 22, 2021 · 3 comments
Closed

help mimicking an Avery label #9

bbrendon opened this issue Jan 22, 2021 · 3 comments

Comments

@bbrendon
Copy link

I'm trying to mimic an Avery Label for my printer. I'm pretty close but the rest isn't coming together. I think my main issue is the top, bottom, left, right margins and the space down the center. Also, I'm not really sure the labels are 2x4 like the red boxes would have me believe. I don't suppose someone could give me a few hints?

The below creates this: https://i.imgur.com/OFsykvp.png
What I'm going for is this : https://i.imgur.com/k3DFVvn.png

@page {
  width: 8.5in;
  height: 11in;
  padding-top: 12.5mm;
  padding-left: 3mm;
}

img {
  height: 90%;
  display: inline-block;
  vertical-align: middle;
  image-rendering: pixelated;
}
.text {
  font-family: Verdana;
  font-weight: bold;
  vertical-align: middle;
  display: inline-block;
  font-size: 30px;
}
.item {
  width: 4in;
  height: 2in;
  text-align: center;
  border: 1px solid red;
}
<img src="{{label_tools.qr_code(url)}}"/>
<span class='text'>
    BOX <br/>
    LABEL <br/>
    # {{ label_num }} <br/>
</span>
@bbrendon
Copy link
Author

bbrendon commented Jan 22, 2021

Also, I just realized the page padding is causing the page to be 8.74 x 11.97 instead of 8.5x11 . Using margin's on the page have no effect.

@veghp
Copy link
Member

veghp commented Jan 22, 2021

I'm not sure what would be the best approach, but if you subtract the padding from the US page size (216x279), then it creates a pdf with the correct size.

@page {
  width: 213mm;
  height: 267mm;
  padding-top: 12mm;
  padding-left: 3mm;
}

I checked with Inkscape and the width of the boxes is correct for me. Note that the 4x1 px width of the red borders adds to the width of the boxes.

I don't know at the moment how to set the width between the boxes, but this is related to the div tag, also mentioned in issue #6 and this discussion. The relevant part of the code is in print_template.html.

@bbrendon
Copy link
Author

Thanks for the tips!

I think this works by increasing the size of the empty space character which increases the center column width. Bit of a hack.

body {
  font-size: 30px;
}

@veghp veghp closed this as completed Dec 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants