3 Replies Latest reply on Nov 30, 2017 4:15 AM by Stephen Troup

    Error printing image to card on x86 application (C#, ZXP Series 1)

    Joao Luiz Santos

      Hello everyone,


      I'm new on development of card printing solutions,


      I'm trying to make an application that reads a bmp file and then sends it to the ZXP Series 1, using Microsoft .Net Framework along with C#, as a 32 bit application.


      When I try to send the image to the printer I'm facing the following error:


      "PrintGraphicsLayers Failed (65535) - Image processing error."


      - The error also occurs on the demos provided by Zebra.


      If I build my solution as a 64bit application (referencing the 64bit version of ZXPrinterLib, my code works fine - but building the application under 64 bits implies on a more troublesome process on making an MSI for the final application that I intend to ship (it has to do with the way Setup utility handles the 64 and 32 bits versions of InstallUtil.exe for installing Windows Services).


      I believe it somehow is related to the way that ZMotifGraphics is converting the image to bytes, but I'm not 100% sure.


      Thanks in advance!

        • Re: Error printing image to card on x86 application (C#, ZXP Series 1)
          Stephen Troup

          I've been seeing this for a while, if you install the 32 bit and 64 bit zxpprinter.dll they conflict and cause the problem. I had this exact problem this morning and the only way to fix it was to unregister both versions and then re-register them in a specific order.


          I thought it had to be 64bit first and then 32bit but that didn't work and had change to 32bit then 64bit probably because the app was running in 64bit mode (I normally compile using anycpu unless I have to deal with old c++ dll's). This error only ever occurs at the printgraphicslayers point, all the code works up to that point.


          This doesn't happen when using the ZMotifPrinter.dll for the zxp 7 - 9 range and you can install both.


          I've pointed this out to the sdk team via email and the lack of the support for the ymckoo ribbon (still seen as a mono ribbon to the sdk) but no sign of either being fixed.

          1 of 1 people found this helpful
          • Re: Error printing image to card on x86 application (C#, ZXP Series 1)
            Stephen Troup

            Ok I've identified why the issue is happening i.e. why we can't install 32bit and 64bit for the ZXPPrinter.dll


            Using processmonitor I've found that when the zxpprinter.dll is installed (32 or 64bit) it creates folder called 'C:\ProgramData\Zebra Technologies\ZXP Series Card Printer SDK' when it does this it dumps a few text files and a dll. It's the dll causing all the issues and it's a file called 'ZXP3Raster.dll'.


            When you do a regsvr32 zxpprinter.dll for the 64bit it dumps a 64bit version of zxp3raster.dll in the folder and overwrites the text files. When you do it for 32bit it creates 32bit version so depending on the order you register them you either get a 32bit or a 64bit but not both .


            So when you run a 64bit program referencing the zxpprinter.dll it can fall over if the 32bit version of zxp3raster.dll is present and vice versa. I use a similar method to embed dll's but I place them in specific x64 / x86 folders but it seems Zebra didn't see the need


            If you unregister one of the zxpprinter.dll's it removes the files from the above folder - so if you have both the 32 and 64bit installed removing one will still cause a crash as the zxp3raster.dll and the .txt files have been removed you need to unregister both and then reregister the one you need.


            One possible solution, depending on the way the sdk file links to the zxp3raster.dll, is placing copies of the two versions into the relevant windows system folders / with the original ocx but as I don't have a printer to hand I can't test it atm.

            1 of 1 people found this helpful
            • Re: Error printing image to card on x86 application (C#, ZXP Series 1)
              Stephen Troup

              Got my zxp3 back and found the zxp3raster.dll is the cockroach of the sdk world.


              Delete it and it will just keep coming back, place it in another folder and use a loadlibrary and it will still won't work as the path is hard coded into the file.


              The only way I've found is to delete it every time a program starts so that when it's needed the system will recreate it in the bit version it needs.


              So using the following code at the start of a program, I've managed to switch from 32bit to 64bit and back again without issue, a card will print every time with both versions of sdk installed.


                      Dim programdatafolder As String = Environment.GetFolderPath(System.Environment.SpecialFolder.CommonApplicationData)


                      Dim zxp3rasterfile As String = System.IO.Path.Combine(programdatafolder, "Zebra Technologies\ZXP Series Card Printer SDK\zxp3raster.dll")


              1 of 1 people found this helpful