Comments (5)
There are many ways to do it; for example edit style.css
to resize label and add "right" class:
@page {
width: 35mm;
height: 11mm;
padding: 0.5mm;
}
img {
height: 6.4mm;
display: inline-block;
vertical-align: middle;
image-rendering: pixelated;
}
.label {
font-family: Ubuntu;
font-weight: bold;
vertical-align: middle;
display: inline-block;
font-size: 7px;
}
.right{
float:right;
}
And the template html:
<img src="{{label_tools.qr_code(sample_id)}}"/>
<span class='label'>
{{ sample_name }} <br/>
52/3 Avenue road, <br/>
Chumpo district, <br/>
Lamgo province 19456 <br/>
<span class="right"><John Saverilo></span>
</span>
For more customization, see the online documentations on html and css.
from blabel.
To change the font, replace "Ubuntu" in the css file with the font that you want to use and is installed on the system.
Putting multiple items on a page is covered in the examples, see the Python and css files in this folder: https://github.com/Edinburgh-Genome-Foundry/blabel/tree/master/examples/several_items_per_page
Let me know if this solves the problem.
from blabel.
@veghp Thanks so much, after reading your guide + some tweaks, now my task is done.
from blabel.
Thank you so much for the prompt response, your solution is working.
But I still need to add 2 options.
- Change the font to my local TTF, OTF file
- Put all of the labels in a single A4 page.
My current code is below, and the current result is attached, I want to put all the labels in a single A4 page(s)
Files:
my_blabel.py
from blabel import LabelWriter
import pandas
df = pandas.read_excel("file.xlsx")
df = df.iloc[:100,:]
records = df.to_dict(orient="records")
label_writer = LabelWriter("item_template.html", default_stylesheets=("style.css",))
label_writer.write_labels(records, target="labels_from_spreadsheet.pdf")
style.css
@page {
width: 297mm;
height: 420mm;
padding: 4.5mm;
}
img {
height: 6.4mm;
display: inline-block;
vertical-align: middle;
image-rendering: pixelated;
}
.label {
font-family: Ubuntu;
font-weight: bold;
vertical-align: middle;
display: inline-block;
font-size: 7px;
}
.right{
float:right;
}
item_template.html
<span class='label'>
{{ FIRST_NAME }} {{ SURNAME }} <br/>
{{ ADDLINE1 }}, <br/>
{{ ADDLINE2 }}, <br/>
{{ ADDLINE3 }} {{ ZIPCODE }} <br/>
<span class="right"><{{ ID_NUM }}></span>
</span>
from blabel.
Resolution is valid and tested
from blabel.
Related Issues (20)
- Python Blabel generate broken PDF file HOT 5
- Please help me setup blabel. HOT 8
- Help using Blabel HOT 2
- Help making a label with a "title" and "description HOT 1
- How to print multiple stickers in one row. HOT 2
- QR Code is too small to scan with web cam HOT 3
- Putting multiple elements into QR code HOT 4
- Adding UTF-8 support HOT 1
- Don't force an specific weasyprint version HOT 2
- blabel gives error with pyinstaller HOT 3
- module 'barcode' has no attribute 'get_barcode_class' HOT 2
- Printing multiple labels HOT 4
- No Barcode when generating only one Label
- QR Codes are shifted!
- Remove
- Unwanted margin on divs/labels HOT 2
- Issues printing labels with multiprocessing HOT 3
- Cairo library module not loading HOT 4
- help mimicking an Avery label HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from blabel.