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

EANX barcode offsetX is not correct #112

Open
anyonetff opened this issue Sep 9, 2024 · 3 comments
Open

EANX barcode offsetX is not correct #112

anyonetff opened this issue Sep 9, 2024 · 3 comments

Comments

@anyonetff
Copy link

data = 123456789012

create the EAN13 svg

<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
   "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="95" height="70" version="1.1" xmlns="http://www.w3.org/2000/svg">
   <desc>123456789012</desc>
   <g id="barcode" fill="#000000">
      <rect x="0" y="0" width="95" height="70" fill="#FFFFFF" />
      <!-- ERROR -->
      <!-- the first rect starts form x=0, there is no space for the first character -->
      <rect x="0.00" y="0.00" width="1.00" height="65.00" />
      <rect x="2.00" y="0.00" width="1.00" height="65.00" />
      <rect x="5.00" y="0.00" width="1.00" height="60.00" />
      <rect x="8.00" y="0.00" width="2.00" height="60.00" />
      <rect x="11.00" y="0.00" width="4.00" height="60.00" />
      <rect x="16.00" y="0.00" width="1.00" height="60.00" />
      <rect x="19.00" y="0.00" width="3.00" height="60.00" />
      <rect x="23.00" y="0.00" width="1.00" height="60.00" />
      <rect x="25.00" y="0.00" width="2.00" height="60.00" />
      <rect x="30.00" y="0.00" width="1.00" height="60.00" />
      <rect x="35.00" y="0.00" width="1.00" height="60.00" />
      <rect x="37.00" y="0.00" width="1.00" height="60.00" />
      <rect x="40.00" y="0.00" width="1.00" height="60.00" />
      <rect x="44.00" y="0.00" width="1.00" height="60.00" />
      <rect x="46.00" y="0.00" width="1.00" height="65.00" />
      <rect x="48.00" y="0.00" width="1.00" height="65.00" />
      <rect x="50.00" y="0.00" width="1.00" height="60.00" />
      <rect x="53.00" y="0.00" width="1.00" height="60.00" />
      <rect x="57.00" y="0.00" width="3.00" height="60.00" />
      <rect x="61.00" y="0.00" width="1.00" height="60.00" />
      <rect x="64.00" y="0.00" width="3.00" height="60.00" />
      <rect x="69.00" y="0.00" width="1.00" height="60.00" />
      <rect x="71.00" y="0.00" width="2.00" height="60.00" />
      <rect x="75.00" y="0.00" width="2.00" height="60.00" />
      <rect x="78.00" y="0.00" width="2.00" height="60.00" />
      <rect x="81.00" y="0.00" width="2.00" height="60.00" />
      <rect x="85.00" y="0.00" width="1.00" height="60.00" />
      <rect x="88.00" y="0.00" width="1.00" height="60.00" />
      <rect x="92.00" y="0.00" width="1.00" height="65.00" />
      <rect x="94.00" y="0.00" width="1.00" height="65.00" />
      <!-- ERROR -->
      <!-- the first character is starts form x=-5. it's out of the canvas -->
      <text x="-5.00" y="68.00" text-anchor="end"
         font-family="Helvetica" font-size="8.00" fill="#000000">
         1
      </text>
      <text x="5.00" y="68.00" text-anchor="start"
         textLength="39.00" lengthAdjust="spacing"
         font-family="Helvetica" font-size="8.00" fill="#000000">
         234567
      </text>
      <text x="51.00" y="68.00" text-anchor="start"
         textLength="39.00" lengthAdjust="spacing"
         font-family="Helvetica" font-size="8.00" fill="#000000">
         890128
      </text>
   </g>
</svg>

the coord of every rect and text should fixed with x += some offsetX (maybe x = x + 9)
after setContent(ean13 data)
the first TextBox x value in the Symbol object is -9

@gredler
Copy link
Collaborator

gredler commented Sep 10, 2024

You'll want to use setQuietZoneHorizontal(int) to add enough horizontal space to fit the prefix digit.

It may be a good idea to document this in the JavaDoc, and/or perhaps add some default horizontal quiet zone to EAN and UPC symbols. I'll keep this bug open as a reminder to look into this.

@anyonetff
Copy link
Author

I found the method to fix the problem. but the Settings.java do not support the -w --whitesp parameter
The zint-qt whitesp support x & y two dimensions, as the zint commad line set both of x & y.

@gredler
Copy link
Collaborator

gredler commented Oct 2, 2024

Are you using Okapi via the command line, or are you using it as a Java library in your own Java code?

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