Implementing a Postek Printer on my .NET c# application - c#

So i created a .net c# application that does store article codification, and also bought a Postek c168 barcode printer, and i want to create a section on my application that prints texts and images to the direct thermal labels with the printer, i also downloaded a dll file for developers on the official printer website, my question is on how to use the dll file or how to implement the printer on my application.

Downloaded SDK contains the manual for SDK functions "Postek API Manual_CDFPSK V3.01.pdf". I do not want to be sarcastic, but maybe you should start reading that document first.
My initial observation is that DLL contains some native functions that you can call over interop.

Related

UWP PDF printing

Is there a way to print PDF from UWP application? Other than rendering it as png or BitmapImage.
I had look at Microsoft printing sample and pdf rendering sample to achieve printing pdf by rendering it into bitmapimage. But, it looses the quality of the pdf. Would like to know if any other efficient method available without using libraries .
Edit(31/12/2018)
I tried to find direct solutions from Microsoft without using libraries. But, there isn't any so i used PDfSharp to solve my problem with the help of AppServiceBridge by Microsoft. I have used AppService bridge because PdfSharp isn't directly available for WinRT.
I used a virtual printer in C# using the Github project: Microsoft/Windows-driver-samples/print/XPSDrvSmpl.
https://github.com/Microsoft/Windows-driver-samples/tree/master/print/XPSDrvSmpl
Installer: http://wixtoolset.org/
Application: Listen to internal port
Flow: Install printer and application from a single installer. User prints something with your driver while the application listens to the internal port. When data is sent the application picks it up. This is for XPS, can be converted to PDF, but the flow is similar no matter what you are printing.
Original answer:
https://stackoverflow.com/a/40370083/3850405

Embeded Acrobat Reader in Windows 8 Store Application

How can I embed Acrobat Rader in aWindows 8 Store Application. There are some tutorials based on C# and there some related question but I could not find any solution. They all suggest adding a COM element and then selecting Acrobat Reader control from toolbox. I have added Acrobat Reader COM element but it gave me error:
Sad to say, but at this time, the only way to read pdf files inside a Windows 8 Store app is to use commercial libraries such as Foxit.
You cannot do this if you want your application to be certified for distribution on the Windows Store.
COM objects can be used in Windows Store Apps, but they must be distributed with your application package, and they must not use any forbidden API for the Windows Store. This is must likely not the case for the ActiveX control of Acrobat Reader, since it uses (just to mention one example) the OPENFILENAME dialog, which is not allowed in Windows Store.
Edit on April 2013:
Amyuni PDF Creator for WinRT (a commercial library) is currently available as pre-release trial. This library provides a Xaml control for PDF viewing in Xaml-based projects, and it can also be used for PDF-to-HTML5 convertion in WinRT-Javascript projects. Disclaimer: I currently work as a developer of the library

Printing pdf files from windows mobile

I've used a third party library (iText) to create a PDF file on Windows Mobile 6.5, but it does not appear to support printing the resulting PDF. Can anyone recommend a way to print a saved PDF file from the mobile device?
I've searched the net and I'm failing miserably to locate a SDK that will let me do this. The application is written in C#.
Have a look at this 3rd party library http://www.fieldsoftware.com/PrinterCE_NetCF.htm .
Not sure it can be used to print a PDF, but you can use the library to print directly on a selection of printers. Do you need the PDF file?

Use a System.Drawing.Printing.PrintDocument to generate a PDF in memory

Does anyone know if the following is possible and if so what the best way of doing it is for free?
I am generating a PrintDocument in a project I am currently working on and displaying a print dialog box so a user can choose which printer they want to use etc. The is currently a windows form application and if a user wants to print to a PDF they can select to print to CutePDF or something similar.
However I am now putting a ASP.Net web frontend on the application and want to use the same code to generate the PrintDocument but want to print it to a PDF on the fly and serve it up via the Response stream in the format of a PDF download.
So my question is....How can I use the current PrintDocument and generate a PDF in memory from it??
Thanks
The System.Drawing code for a PrintDocument can be reused to generate a PDF document with ABCpdf .NET. See the System.Drawing example...
You would have to use a 3rd party component in order to generate the PDF. The following article has some links to some such components: Generating PDF Files from .Net
You're in a world of hurt if you think you're going to run the "same code" that deals with printers in both a forms app and an ASP.NET app.
You might be in luck, however, as it appears that PDFsharp + MigraDoc might be able to do this for you.
I think you will find there is not any tools that will take a PrintDocument as input and render a PDF as output. The only way to do what you want is to "print" the PrintDocument to a "PDF printer driver" that will generate PDF. Basically a virtual printer that will generate PDF instead of printing the actual output. There are a plethora of products on the market for that. A couple that are cheap and widely used are as follows:
Ghostscript with RedMon (open source/GPL or commercial licenses available)
Foxit Software's PDF Creator ($29)
You really should be looking at iTextSharp (it is mentioned on the iText.NET page recommended earlier)
http://itextsharp.sourceforge.net/
PrintDocument is meant for Windows Forms applications but is up and coming in SilverLight, see this video... http://silverlight.net/learn/videos/all/printing-api-basics/
If you wish to continue with the PrintDocument and a web application, I think SilverLight 4 (which is beta right now) is the only way to go, or your going to have to have a lite weight windows form application installed locally for the end user that maybe uses web services.
iTextSharp is a great tool for generating PDFs with .NET on the Internet. I highly recommend it; I've used iText with Java...and have been using iTextSharp for the past few years.
There are several ports of iText for .NET (A very popular open-source PDF library for Java).
http://www.ujihara.jp/iTextdotNET/en/

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