How to create barcodes using ReportViewer Local Report VS 2008? - c#

I'm trying to figure out how to create barcodes using ReportViewer Local Report VS 2008.
I find a component at:
www.neodynamic.com/barcodes/Interleaved_2_of_5_Barcode_asp_net.aspx
It seems there is no other solution native... Is there another alternative way?

Depends on what kind of barcode you need. For basic barcodes you could just use free barcode font

I've always implemented barcodes using a font. Barcodes are nothing more than data presented in a different way. Instead of human-readable they are "barcode scanner readable", so to speak.
You'll need to find fonts (Google search - there's lots available for free) that suit the symbology (or symbologies) supported by the scanner being used. Some readers need start and stop characters as well. So, for example, if you had an ID value of 123456 you might put that in a textbox on your report surrounded by start and stop character * - *123456*, and then apply your barcode font to the textbox.

Related

Uneven character kerning in PDF when converted from Word via automation

I need your expertise in fixing a problem I have been facing from a week. This has already turned into a 'royal pain in the lower back side' category and time is running out fast.
Problem
I have developed a C# script that I call from ColdFusion to assist me in converting Word documents to PDF. This script is doing the conversion properly, but the (justified) text in the paragraphs is not being spaced properly. I get a non-select-able space next to some character.
See the image -
What is should look like...
What it looks like...
The red marks are added to show the spaces created.
Now, if I open the file by word manually and save it, I do not get this same problem. What is that I'm missing or doing wrong, that has resulted in this error?
Details of my application flow -
I create a DOC (based on my design needs) and save it as HTML.
This HTML will be used by my CF application to manipulate the content based on some placeholders and the final output is again saved as HTML.
The xx.html file is renamed to xx.doc and passed to my C# based converter, which does the doc to pdf convertion via Word Automation.
I ponder in joy seeing my well formed PDF output, but get sad that the text is a bit messy.
I have tried this with multiple fonts and what i observe is that it only happens with certain fonts (in my case its Palatino - Linotype). I want to know, what is the difference from manual to automation? Is there a setting (like a boolean) that is to done for this or some other hacks?
My system configuration -
Windows 2008 R2 64b + .NET 4 + Office 2010
Note: I know that office automation is bad. So on this date and time, this is the only option I have to get my job done.
I found a work-around for this. It seems to be dependent on the selected printer!
First go to the print dialog (File / Print) and select "Microsoft XPS Document Writer" instead of your normal printer. You don't need to print anything,
Now export the PDF (File / Export / Create PDF)
Selecting other printer drivers may work also. I found this solution at this thread: http://www.howtofixcomputers.com/forums/microsoft-office/bad-kerning-pdf-using-save-pdf-xps-add-244886.html
Notes:
I also installed Adobe PDF Writer before finding this. It's possible that affected it.
My system is Windows 8.1 & Office 2013 running under Fusion 5.0.3 on a Mac mini.
I guess that the trouble could be in used font. Please try:
change font
ensure, that language of the text (LanguageID Property) is correct
Or it could be inserted special character, for example, wrong way interpreted inserted "no-width optional break". Try to select the text, cut&paste in word and see non-printable characters - it should be visible.

How to work on Bixolon POS Printer using C#

I've been programming an application that deals with a POS printer. The printer is BIXOLON branded, and I haven't found any SDKs for using this type of printers as well as no example on how to deal with it.
Since I'm new to this type of printer, I don't know how should I design my report as well as which report engine should I use.
Any advice will be helpful.
I have worked on POS printers before to issue receipts etc.
What I did is to read in a template from a rtf file, set some variables that is to be replaced.
For example for the receipt I want to have the name of the person, so in the rtf file template, I would put something like <NAME>. When I read in the content of the rtf file, i just do a string.replace to replace <NAME> with the actual text in my program. Once I have replaced all the variables, using the class found in this link.
http://msdn.microsoft.com/en-us/library/ms996492.aspx#wnf_richtextbox_topic06 , I have a well formatted rtf and ready to be printed.
Printing wise works just like other printer. This means that as long as your coding targeted the correct printer and using the correct setup, it should be printed correctly. The only difference is that printing on a office printer would give u a A4 size, whereas printing on a POS printer will give you the size allowed by the POS printer. Just remember to format your rtf well.
Most report engines (I'm thinking of Reporting Services in particular) won't need this level of programming to print reports. You will get that functionality out of the box as long as the printer drivers are installed on the machine you wish to print reports from.
It was so simple, I used crystal report to design my report and then easily show.

How to print data form C#

I've searched Stackoverflow and google and found many ways
how I can print stuff in C#.
The best way for me would be to populate blank white windows form
with some label, textbox and picturebox elements and print it as a windows form.
This way is very poor because it prints in 72 DPI, and is not flexible for multiple
pages print.
Next way that I found that would be good is using iTextSharp, but there is a problem
that iTextSharp only generates PDF-s, and you have to open it in PDF viewer and print
from there.
I love this way of thinking where I create a paragraph, and then fill it with text and graphic, so I found this thread
http://www.devarticles.com/c/a/C-Sharp/Printing-Using-C-sharp/
where it discusses how to create your own printing engine in C#, something like iTextSharp,
but very lightweight...
Now that I've said that, I want to know is there any ready to use printing engine that would be like iTextSharp, made for printing, not for PDF generation? What is the best way to print something, without using reporting services like CrystalReports.
I think Crystal Reports wouldn't work for my case cause I don't want to print generic reports, but some text and graphics that I need to dynamicaly generate every time I need to print.
I found that it was much easier to do printing using the printing stuff in WPF.
EDIT
XPS is the page description format that Microsoft included into .NET with .NET 3.0. It is nominally part of WPF, and is integrated with the WPF form layout model. But you can create XPS documents in memory and send them to printers, from any .NET app, including a WinForms App.
An example:
http://statestreetgang.net/post/2008/03/Creating-an-XPS-document-in-memory-via-the-DOM.aspx
It is approximately equivalent to the iTextSharp capability you explored, except:
you can do it all in memory if you like, no need to save to a filesystem file. Of course if you want to save to a filesystem file, you can do that too.
you don't need an external viewer in order to start the print.
If you are new in programming and you have some data like from Data Base, and you want to print it after retrieving it from Data Base. Then just follow this link it will guide you step by step.
Print Data in Dot Net (C#,Vb.net)

Print simple numbers on label printer (Brother, Dymo, etc) from C# (.NET)

As part of a project I'm working on, I need to automate a label printer. It will be one of those inexpensive USB printers from Brother or Dymo (open to other suggestions). All it needs to do is print two numbers on one label.
The challenge is that I'm hoping to keep it ultra-simple in C#. It seems like the solution from Brother is antiquated, and the Dymo SDK is a little more complicated than what I would like. Both solutions require the end user to install the full blown application.
Do I have to suck it up and use the low-level COM solution provided by Dymo? Or has someone found a simpler way to print uncomplicated labels?
DYMO now has a very handy framework that can be used to create and print labels using templates or built in XML.
Here is the download:
http://sites.dymo.com/Support/Pages/ProductDetails.aspx?MainTab=1&Tab=1&ProductID=DYMOSDK(DYMO)
Here is the documentation:
http://www.labelwriter.com/software/dls/sdk/docs/DYMOLabelFrameworkdotNETHelp/html/N_DYMO_Label_Framework.htm
Install the labelmaker as a printer on the computer.
Then, use mail-merge from Excel to Word.
Create a spreadsheet with rows representing labels and columns representing pieces of information on that label.
Use mail-merge in MS Word using the spreadsheet as the data.

How to generate barcode from a string using C#?

Is it possible to generate barcode from a string
using c#?
Is there any builtin classes for generating barcodes in asp.net?
Is it possible to detect a barcode printer connected with a system?
Yep. Of course it is possible. :-)
As far as I know there are two ways to generate bar codes:
Using a special bar code font (try to google for "barcode font free")
Render the bar code to an image and display that (try using the Barcode Rendering Framework available on github)
In response to your updated question about detecting barcode printers:
I think a barcode printer will show up as a regular printer on your system. At least that is how the devices I have played with have worked.
This means that you can detect a specific barcode printer by enumerating the installed printers on the system and looking for the specified device, but in most cases I would suggest that you let the user specify the printer himself using either the standard print dialog or using a custom dialog.
Is it possible to generate barcodes from a string using c#?
Yes, it is. There are quite a lot of frameworks that do it - either as a font or an image.
Is there any built-in classes for generating barcodes in asp.net?
No, but this c# project on github allows a string to be converted into an image (even multiple barcode types). All you need to do then is display the image in your application, just like any other image.
Is it possible to detect a barcode printer connected with a system?
Yes, in a WinForm application, for example, you could use System.Drawing.Printing.PrinterSettings.InstalledPrinters.
to detect if you have printer installed then you may simply enumerate available printers using:
System.Drawing.Printing.PrinterSettings.InstalledPrinters
Is it possible to generate barcode from a string using c#?
If you want a C# barcode generator that can create your desired barcode type in a single line of code, you can use IronOcr.
// Create A Barcode in 1 Line of Code
BarcodeWriter.CreateBarcode("https://ironsoftware.com/csharp/barcode", BarcodeWriterEncoding.QRCode).SaveAsJpeg("QR.jpg");
The result can be exported as images, bitmaps, binary data, streams, stand-alone HTML image tag, Data Uris, PDFs or HTML.
If you need more advanced barcodes, QR Codes with logos - these are also supported.
Disclaimer: I work for Iron Software, makers of IronBarcode
Yes, it's possible using C#.
No, there are no built-in classes. But there are 3rd-party libraries.
For example, a free cross-platform C# library Gehtsoft.Barcodes for generation of different types of barcodes and QR codes from string into image. You can find it in nuget.
Moreover, you can generate barcode directly into PDF document with Gehtsoft.PDFFlowLib.Barcodes C# library (it uses Gehtsoft.Barcodes library automatically). It can also be downloaded from nuget.
DocumentBuilder.New()
.AddSection()
.AddParagraph()
.AddBarcode("4810151021665", BarcodeType.EAN_13)
.ToDocument()
.Build("Result.pdf");
Using this libraries you can generate barcodes UPC-A, EAN-13, EAN-8, GS1-128 (Code Sets A, B, and C) and QR codes (variants 1-40, four levels of error correction available).
Here is a tutorial with many examples: Adding barcodes.
Note, that Gehtsoft.PDFFlowLib.Barcodes library is an extension of PDFFlow library for generation PDF documents using C#.

Categories

Resources