-
-
Notifications
You must be signed in to change notification settings - Fork 106
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
Barcode Text not rendered in Viewer output #119
Comments
Hello this is a known bug that we still need to fix |
@tinohager thanks for the quick reply. I looks like var barcodeElement = new Barcode
{
BarWidth = barcode.ModuleWidth,
BackColor = Color.Transparent,
Height = barcode.Height
}; For the example above, I was able to get fairly reasonable results using the following: var barcodeElement = new Barcode {
BarWidth = barcode.ModuleWidth,
BackColor = Color.Transparent,
Height = barcode.Height + 33,
IncludeLabel = true,
LabelFont = new Font("DejaVu Sans Mono", 22)
}; The appropriate label size and additional height would need to computed at some point before the draw, but I don't see a convenient site. Likely these would need to be passed as properties of the ZplBarcode. |
The problem is that the label can also be above the barcode
|
you need to get the text width and define offset in X and Y depending on the case:
This is a pseudocode, but It will work, I have ported the viewer to Go and draw the text correctly |
@ingfdoaguirre is your viewer also open source available? Is there a reason for porting to another language? |
Hi Tino, first I'm dont have the sufficient knowledge of C#, also I used tried to use the viewer to create PDF files intead images. The first approach was to only append the image to a pdf file, but the final file size, was big on a document with some labels. Then I tried pdfSharp to make "native pdf file", it worked well. The problem came when I made some tests, the ram memory usage was increasingly, lets say that on every page added to document, ram was increased by 20mb. I tried some some solutions, but no one worked. Then I tried on my win11 partition, and the ram leak was not present (I develop on Ubuntu). After some research I discovered that the "System.Drawing.Common" library only works on windows (: and the problem with memory leak, was pdfSharp that doesn't already implemented a solution to that. Also this is the only open source library to analyze Zpl, and I use Go in my microservices, so I made a port. I will upload that port to github and make open source this week, I'm solving some details. And I will explicitily say that is a port from this library, thats the reality and not a problem to me. Also was a personal challenge, and it was fun. |
Have you already built your port on the Protocol project? |
You can also set the var barcodeElement = new Barcode {
BarWidth = barcode.ModuleWidth,
BackColor = Color.Transparent,
Height = barcode.Height + barcode.LabelHeight,
IncludeLabel = true,
LabelPosition = LabelPositions.TOPCENTER,
LabelFont = barcode.LabelFont
}; |
@primo-ppcg Can you create a pull request? |
The one bit of difficulty that I'm having is that |
@primo-ppcg |
Mode |
Using:
.NET Framework 4.7.2
BinaryKits.Zpl.Label 3.1.0
BinaryKits.Zpl.Viewer 1.1.1
All other dependencies up to date.
Method for creating label preview:
Using this sample label data:
Actual:
![](https://user-images.githubusercontent.com/4907320/174963293-995cfa64-5313-4d69-9da4-de22c130206b.png)
Expected (labelary.com reference):
![](https://user-images.githubusercontent.com/4907320/174963410-585da1c7-845a-4c73-b782-dc9074b57a4b.png)
The text was updated successfully, but these errors were encountered: