Printing a report to Thermal Printers RRS feed

  • Question



    I have a local report which hold my application's  main document

    I use the report viewer as a preview form to my document.

    I have also added a button which prints the report to the printer using the EMF rendering.

    1) When I print it to the regular A4 printer driver, everything is fine.

    2) When I print it to the thermal printer driver (a printer used mainly with Point of sales), I am experiencing this problem :

    • Print with the integrated  "Print" button of the report viewer, opens the print dialog, I choose the thermal driver and it prints OK!
    • Print using my button (with the rendering code translating the print to an EMF file), the printed does not print the image but only a short slip (but it is responding)

    I looked the EMF files and they are fine.

    I think that maybe this driver cannot handle the EMF images.


    My questions are:

    1. Can I emulate the exact event caused by the integrated print button of the report viewer ?
    2. Can someone give me an idea, why the printed cannot handle the EMF images ?


    I am very frustrated right now, and will appreciate any info or an idea that can help



    Thursday, December 13, 2007 1:38 PM

All replies

  • I'm not sure from your description if my experience will relate to your problem.


    I print a lot to Zebra thermal printers for UPS, Fedex and other labels.  When the label size is not set correctly, I get only a thin strip in the middle of the label, or maybe something off to the side of the label.  The default page size for a Zebra printer is "Envelope 9". If I change the label size to "4 in x 6 in" then the EMF prints ok.


    You can set this either with properties from the print dialog, or from Start - Printers & Faxes - Select Printing preferences.


    Does this help?



    Thursday, December 13, 2007 4:39 PM
  • Hi Rick,

    Thanks for your post.

    When I print through the printer dialog, everything is great!

    The problem is printing using the rendering function, which creates an EMF file to send to the printer.

    The thermal printer does not seem to support this EMF file print, as the A4 printers do.

    So I am looking for a way to solve this, maybe by mimicking the action of the print using the print dialog.


    Do you use the report viewer to print to the zebra printer without the user intervention ? (Without pressing the print button from the print dialog...).

    If you do, I will be very happy to know which code do you use

    Thank in advance.



    Friday, December 14, 2007 2:57 PM
  • No, I let the user choose a printer and then let ReportViewer handle it.


    This is my next development step however.  There is no real reason for my users to view the UPS label in advance really, I just need to send it to the Zebra.


    I assume you have seen the code that creates an array of page streams (EMF's) that you send to the printer? This link might get you started:


    I'd be surprized if you could not send a graphic directly to a Zebra printer, but then I'm not sure if that is what you are using. Perhaps it is a question for the printer manufacturer?





    Saturday, December 15, 2007 12:11 AM
  • Hi,

    I use the exact code posted on the MSDN link you have referred me to, and it works fine on other printers but not on the thermal.

    Can you send me an EMF file from your application, that you know is printing well? I will try to send it to my application just to eliminate some options.


    Did you make any special adjustments with the printer driver ?


    Thanks for the quick replies!



    Saturday, December 15, 2007 7:14 AM
  • Let me know your email or a download site and I will send you an EMF. I can't post one for general use since it is from a clients propritary information.


    I remember when I was first developing the project I had a problem with corrupt EMF's. It turned out that the last character of the EMF was being truncated. IE was able to display the EMF properly, however Windows Picture and Fax Viewer and all other viewers said it was corrupt.  I looked in Wikipidia for the EMF specs and then checked my EMF and discovered the missing closing char.  That may or may not be relevent for you.



    Saturday, December 15, 2007 4:20 PM
  • Hi Rick,


    My email is moranium at hotmail dot com, I will appreciate your sample.

    About the EMF, I actually can open it with the windows fax viewer, so I think it is ok.

    I will try to print your EMF to see if this is a printer issue.


    Again, Thanks

    Saturday, December 15, 2007 10:02 PM