2 Replies Latest reply on Jul 13, 2016 10:47 AM by Oleksandr Chekmez

    Print Excel label via c# service

    Oleksandr Chekmez

      Labels are prepared as Excel files.

      When purchase is done, we use Excel file as template and fill it with data in our C# Windows Service.

      Now we want to print this filled Excel file to Zebra printer (ZDesigner 140Xi4)

       

      Since it is C# Windows Service, we cannot send file to printer (installed as printer in Windows) via Excel.

      What is the correct approach for this task?

       

      We tried different solutions, but all of them didn`t work well. First of all, if we compare print result via Excel and other methods - size of the label is different. It looks like Excel is adjusting label to paper size (we send to printer with No Scaling option).

      At this moment we tried the following options:

      1. Convert Excel file to PDF and send PDF to printer via ghostscript. Problem - PDF has size info and page size does not match paper size. When PDF is printer, size and location is wrong.

      2. Convert Excel file to BMP and send BMP image to printer via Paint. Result is much better, but size of printed image does not match original size and size of label printed in Excel.

      3. Convert Excel file to BMP. Convert BMP to monochrome. Send monochrome image to printer via ZLP. Printed page has the same size as BMP (but does not match label printer via Excel). But new problem appears - text quality is very low after conversion to monochrome. 

       

      Main target here is to get the same result as if we print via Excel, because user who prepare Excel templates adjust size and texts and test it via Excel (first of all print preview, and final test via real printing from Excel).

        • Re: Print Excel label via c# service
          Robin West

          Can you send the settings in the ZDesigner 140Xi4 driver for the label size?  I suspect this may be what is the issue.  Also, what size labels are you actually trying to print?

            • Re: Print Excel label via c# service
              Oleksandr Chekmez

              Here is settings of my printer:

               

              settings.png

               

              Size of BMP I send to printer is 730x503 px.

              Main problem is that print size from direct printing via Excel and via BMP is different. Top label is printed from Excel. Bottom label is printed via conversion to BMP and then sent to printer via MS Paint.

              Please ignore different values in the labels, because first one is empty, second is filled with data.

              Please note that we export Excel to BMP with 100% size (without zooming).

              result.png

               

              Here is the example of BMP file we sent to printer: