This is my problem:
I have a print document on my c# program.
When i see the print preview dialog of print document all appears correctly but when i print this document the image on the document appear oversize and cut on the edge.
I try on my pc (Windows 7 1920x1080) all works correctly but when i try to print same document on my second pc (Windows 8 1366x768) i have this problem.....
I try to change Graphics.PageUnit to Point from Display but it always not work...
Draw image extract of my programm
Rectangle logo = new Rectangle(x, yLogo - 11, 136, 67);
e.Graphics.DrawRectangle(penTransparent, logo);
try
{
e.Graphics.DrawImage(Image.FromFile(settaggi.pathLogo().ToString()), logo);
}
Can anyone help me?
Thanks
P.S.: If i try to print it with virtual printer like PDF24 all appears correct
Related
Zebra model: Zebra Z4M
I have a problem with printing labels from a PDF file on a Zebra printer. If I send a file to be printed that has several pages (one page = one label) the printer prints one page, pauses for 2 seconds, and prints another label (instead of printing continuously)
I create C# app where I generate simple PDF file (using iTextSharp) and print it on Zebra (i send file to Zebra one file who contain multiple pages -> each page == one label)
In iTextSharp i create PDF file with custom dimension:
var pgSize = new iTextSharp.text.Rectangle(353, 180);
Document pdfDocument = new Document(pgSize, 0, 0, 0, 0);
In printer i set dimensions corresponding to the actual size of the label:
P.S.
I noticed that if I send a PDF file for printing with only one page, but by setting the number of copies (e.g. to 5 copies) the printer prints normally (without pausing on each label)
It reads the PDF one page at a time, after printing the first page it will clear it from memory then convert and load the second page.
This printer is discontinued, PDF is not easy to print, especially for old models.
I recommend using ZebraDesigner Professional software for better printing performance, it is more optimized for Zebra printers and have many great options (see image below)
I need to print a receipt on thermal paper from Crystal Reports. I created a print layout which works fine if printed from the preview. If I try to print from code, the printer just rolls out empty paper. The printer is installed properly (POS58). How can I properly print this from code?
ReportDocument rptDoc = new ReportDocument();
rptDoc.Load(Directory.GetCurrentDirectory() + #"\Reports\receipt.rpt");
rptDoc.SetParameterValue("pOrderID",OrderID);
rptDoc.PrintOptions.PrinterName = "POS58";
rptDoc.PrintToPrinter(1,false,0,0);
Since I can't comment on your question, I am going to ask you here: Do you have any data on the report to show? I don't see any datasource assignment in your code, so maybe you need to provide some data to be printed.
Have you tried setting the paperSize in your code using the PrintOption in your report? I did this once; I was printing to a receipt printer but my paper was set to A4 so my actual report data were printed outside of the receipt paper. Try to send your document to a printer with A4 paper or better yet send it to oneNote so you don't waste paper and see how it prints.
I had a Code 128 True Type Font.
Font font1DText = new Font("Code 128", 16);
e.Graphics.DrawString("12345", font1DText, Brushes.Black, fInfoStartX , fInfoStartY);
I had tried this on Windows 10 and Window 7. The funny thing is initially with Win10 when i print to a printer, it does not show the the barcode which is supposed to be line and spaces. It shows the raw text of the content ie "12345".
At a later stage(i am not sure what i did) it suddenly is able to print correctly.
I now use the same font and code on another PC Win7. The problem happens again showing the raw text "12345"
My purpose of this thread is not about encoding the 128. But why doesn't the print correctly display the 128 font.
As per suggestion and provided link by #HansPassant and #Juan from (C# POS receipt printing issue), i have made the changes in code and now writing the print commands directly to the printer, bypassing the driver (using RawPrinterHelper class). But still there is an issue with the POS printer receipt. It is not taking full width to print the row though the text is not cutting now and it is showing as full text (Screenshot attached)
But as you can see in screenshot, there are enough space left in between the right side border (Marked black) and where the text ends. If text is large string then it breaks into new line but not printing to the right side.The receipt is printing with max width which is up-to the end of dotted line.Rest right side part is blank.
Also, Can you tell me how to print Rupee Symbol before the price or amount while writing the print commands directly to the printer. Earlier when i was using the printer driver for a POS printer, there in c# code i was writing as following:
CultureInfo ci = new CultureInfo("hi-IN"); String.Format(ci, "{0:c}",ProductPrice);
But this is not working with print commands directly to the printer. It prints as "?" as you can see just before the price of each item in attached screenshot.
Thanks in advance.
I am generating PDF document using iTextSharp (winforms), now i need to print this generated PDF document using a Label Printer.
I have multiple Printers installed on my machine, so with VB.net I need to Select a certain Thermal printer.
Once the Printer is Selected I need to Specify Shipping Label Size (width & height).
So Once Label Printer is selected and I specified custom Label dimensions, I would like the label to be printed without any user action (Like skip the Confitm box to print).
I dont need the full code, I just need someone to put me into right direction.
Thanks
You can use the PrintDocument object. Use the Print method, and do the actual printing in the PrintPage handler. To do this, you can output to the graphics object of the parameter PrintPageEventArgs in your PrintPage handler.