last day (15 days later) » 

8:06 AM
1
Q: how to center barcode image in the table?

Mohamed Fouadi'am trying to desgine barcode label in odoo it printed well if it short barcode otherwise the barcode go over the table border and i can't read it with reader also sometimes it print in 2 label if the the name is in first cell is long so i need to set fixed size for the table here is 2 screens...

 
Can you create a working demo please, and also why are you using width:120% on img it must be 100%
 
@Awais if it 100% the reader can't read the barcode
 
@MohamedFouad but its against rules, width 100% means its parent width what ever its mention there, there must be some div which have margin or static width which cause this issue, but without complete working code we just give you hints :(
 
@Awais this the whole code if width be 100% it be in center but i can't read it by reader
 
@MohamedFouad Then you need to wrap image inside some div and adjust it with using overflow:hidden as i can see there is some extra white space in your bar-code image
 
8:06 AM
@Awais can you help me how to but it in dev i'am new to this field
 
@MohamedFouad I will, but the code you provided is not enough to make any output, just create a simple table add the static data which you show us in image and add your bar-code image url correctly so that we can see bar-code
 
<odoo>
    <data>
         <template id="report_simple_label" inherit_id="product.report_simple_label">
              <xpath expr="//div" position="replace">
                  <div class="col-xs-4" style="padding:0;" align="center">
                        <table  class="table table-bordered mt32" style="width: 100%" align="center" >
                          <tr  style="font-size: 15px;padding:5;height:100px;border: 2px " align="center" valign="middle">
     <td style="font-size: 110%;padding:2">
this is the whole code
Page height (mm) 41
Page width (mm) 55
Orientation Portrait
Top Margin (mm) 2.00
Bottom Margin (mm) 2.00
Left Margin (mm) 2.00
Right Margin (mm) 1.00
i'll give you code with data because above one get values from sytem
<odoo>
    <data>
         <template id="report_simple_label" inherit_id="product.report_simple_label">
              <xpath expr="//div" position="replace">
                  <div class="col-xs-4" style="padding:0;" align="center">
                        <table  class="table table-bordered mt32" style="width: 100%" align="center" >
                          <tr  style="font-size: 15px;padding:5;height:100px;border: 2px " align="center" valign="middle">
     <td style="font-size: 110%;padding:2">
you can use this image as a brcode
 
8:29 AM
this print well but barcode not in center of cell
 
8:57 AM
Ok ill make this bar qode to center of table cell
 
9:12 AM
Try this snippet , i use object fit with width , Do let me know if that prints well, you can set its width to 100% or in px what ever you want
<!-- begin snippet: js hide: false console: true babel: false -->

<!-- language: lang-css -->

img{
max-width: 100%;
}
.img-wrap img{
width: 200px;
object-fit: contain;
}

<!-- language: lang-html -->

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" rel="stylesheet"/><script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script>
<table class="table table-bordered mb-0" style="text-align: center;" >
 
 
1 hour later…
10:23 AM
i'll try it and send you feedback
 

last day (15 days later) »