This project is read-only.

Rotate 90 degrees sticker printing

Dec 24, 2014 at 6:05 AM
Edited Dec 24, 2014 at 6:09 AM
What should I do if I need to deploy the whole sticker 90 degrees(Portrait an Landscape)?
Immediately I say, I tried using the printer to do this, the result is not given.
Dec 24, 2014 at 7:22 PM
To rotate a label, you have to rotate and reposition each element. The printer and the sharpzebra library have no capabilities to do this automatically..
Dec 29, 2014 at 6:47 AM
Gd day dear RKone,
I've tried to do it, but I somehow did not work. Could you show an example of how this is done.
Thank you very much.
Dec 30, 2014 at 11:23 AM
PrinterSettings ps = new PrinterSettings();
ps.PrinterName = "ZDesigner S4M-203dpi ZPL";

List<byte> page = new List<byte>();

page.AddRange(ZPLCommands.TextWrite(10, 150, ElementDrawRotation.ROTATE_90_DEGREES, ZebraFont.STANDARD_NORMAL, 15, "Hello World!"));

new SpoolPrinter(ps).Print(page.ToArray());
Dec 30, 2014 at 2:19 PM
Good day dear RKone,
I'm sorry but I did not mean a reversal of each element on the sticker. In my case it is necessary to fully deploy the entire ыешслук 90 degrees.
Coordinates I counted under the new coordinates by the formula:
    static private Point RotateGradPoint(Point centerPos,Point pointIn,double angelDegre)
        Vector delta = pointIn - centerPos;
        double alpha = Math.Atan2(delta.Y, delta.X);

        angelDegre = angelDegre * Math.PI / 180;

        var newPos = new Point(
            centerPos.X + delta.Length * Math.Cos(alpha + angelDegre),
            centerPos.Y + delta.Length * Math.Sin(alpha + angelDegre));

        return newPos;
But the printer does not print, although the print queue label becomes. What am I doing not so.
Thank you very much.
Dec 30, 2014 at 6:59 PM
Hi Sergey,

As I said in my first reply, you can not rotate the entire label like that with Sharpzebra. The printer only accepts an element, its origin and its direction. If you want to print a label any other way you would need to create the label as a graphic, rotate the graphic and then print that rotated graphic. This is the wrong library to do that with.
Jan 5, 2015 at 7:00 AM
Edited Jan 22, 2015 at 2:53 PM
Hi rkone.
Where I did wrong? I've done as follows:
        var rawPrntrHlpr = new RawPrinterHelper();
        RawPrinterHelper.PrinterData PS = new RawPrinterHelper.PrinterData();
        PS.Source = (int) RawPrinterHelper.PaperSource.DMBIN_AUTO;
        PS.Orientation = (int)RawPrinterHelper.PageOrientation.DMORIENT_PORTRAIT;
        PS.Duplex = (int)RawPrinterHelper.PageDuplex.DMDUP_VERTICAL;
        PS.Size = (int)RawPrinterHelper.PaperSize.DMPAPER_ENV_DL;
        RawPrinterHelper.ChangePrinterSetting("ZDesigner GK420t", PS);
        RawPrinterHelper.SendStringToPrinter("ZDesigner GK420t", barcode_ZPL_code);
Thank you very much.
PS:If you want I can send source classes