Comments (7)
If you can print an image, yes. Use this https://pub.dev/packages/barcode_image
Otherwise, try with the pdf plugin: https://github.com/DavBfr/dart_pdf/wiki/Document-Output#using-another-plugin
from dart_barcode.
Thanks for the reply. But if the printer is connected only via usb, what can I do? Is there any way?
from dart_barcode.
I don't know
from dart_barcode.
Ok! I was able to print via my thermal printer. The problem now is the size of the pdf. If the sticker where I print is 50 x 30 mm, how should I set the pdf? Could you give me an example? (With what you gave me from the link it prints me badly!)
from dart_barcode.
Use a
SizedBox(
width: 50 * PdfPageFormat.mm,
height: 30 * PdfPageFormat.mm,
child: BarcodeWidget(
barcode: Barcode.ean13,
data: '12345678'
),
);
from dart_barcode.
If I use 50 and 30 it prints the blank page, to test I also put 500 and 300 and it gives me the giant sticker.
What should I put on pageFormat? Now I use "format" but I also saw PdfPageFormat.roll80.
doc.addPage(
Page(
pageFormat: format,
build: (Context context) {
return SizedBox(
width: 500 * PdfPageFormat.mm,
height: 300 * PdfPageFormat.mm,
child: BarcodeWidget(
barcode: Barcode.ean13(drawEndChar: true),
data: '8099807953185',
),
);
},
),
);
from dart_barcode.
I would do:
Future<Uint8List> _generatePdf(PdfPageFormat format, String title) async {
final pdf = pw.Document();
pdf.addPage(
pw.Page(
pageFormat: PdfPageFormat.roll57.copyWith(
marginTop: 2 * PdfPageFormat.mm,
marginLeft: 3.5 * PdfPageFormat.mm,
marginRight: 3.5 * PdfPageFormat.mm,
marginBottom: 2 * PdfPageFormat.mm,
),
build: (pw.Context context) {
return pw.Center(
child: pw.Wrap(
runSpacing: 2 * PdfPageFormat.mm, // Space between stickers
children: [
pw.SizedBox(
height: 30 * PdfPageFormat.mm,
child: pw.BarcodeWidget(
barcode: pw.Barcode.ean13(drawEndChar: true),
data: '8099807953185',
),
),
pw.SizedBox(
height: 30 * PdfPageFormat.mm,
child: pw.BarcodeWidget(
barcode: pw.Barcode.ean13(drawEndChar: true),
data: '809983425318',
),
),
pw.SizedBox(
height: 30 * PdfPageFormat.mm,
child: pw.BarcodeWidget(
barcode: pw.Barcode.ean13(drawEndChar: true),
data: '809980541185',
),
),
],
),
);
},
),
);
return pdf.save();
}
from dart_barcode.
Related Issues (20)
- Barcode 128 wrong HOT 2
- The generated data is incorrect HOT 4
- How do I download a barcode image file from the "flutter web"? HOT 1
- Unable to encode "A" to CODABAR Barcode HOT 3
- Determine number of elements/dots in a DataMatrix? HOT 2
- Using Barcode. code128() to generate barcodes will occasionally cause errors HOT 2
- Genererating invalid Aztec in some cases (Usually an 'A' is at the positions where it breaks)
- barcode_image example source code HOT 1
- Addition of Copyright notice file HOT 3
- barcode_image >=2.0.1 depends on image ^3.1.0
- hope qr add title option
- How to add new barcode format ? HOT 1
- Datamatrix SVG bytes are off-by-one from version 2.2.2 onwards HOT 4
- barcode >=2.2.0 depends on qr ^3.0 and qr_flutter >=4.0.0 depends on qr ^2.0.0 HOT 2
- Save as file support HOT 4
- dart_barcode web example source code HOT 1
- Embedding QR code in images and backgrounds HOT 1
- Ean2 barcode error in v2.2.4. HOT 4
- Datamatix: Reproduce the same code as scanned
- Add VEVENT Support
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 dart_barcode.