none
Unable to create QR barcode - OPOS RRS feed

  • Question

  • I am trying to implement the QR and Datamatrix barcode, when i try calling the PrintBarCode method by setting the symbology to BarCodeSymbology.QRCode i get exception saying the parameter value is invalid. 

    In the stack trace i am able to see an exception is thrown by the validateBarCodeSymbology

       at Microsoft.PointOfService.Internal.PosCommonInternal.ThrowPOSException(String Resource, ErrorCode code)
       at Microsoft.PointOfService.BaseServiceObjects.PosPrinterBase.ValidateBarCodeSymbology(BarCodeSymbology symbology)
       at Microsoft.PointOfService.BaseServiceObjects.PosPrinterBase.PrintBarCode(PrinterStation station, String data, BarCodeSymbology symbology, Int32 height, Int32 width, Int32 alignment, BarCodeTextPosition textPosition)

     I am not sure what i should try next, any pointer/help in resolving the issue is appreciated .


    ss



    • Edited by winn88 Friday, August 5, 2016 3:03 PM
    Friday, August 5, 2016 2:59 PM

All replies

  • Hi,

    can you post here your code?

    or you can try using web api 

    https://api.qrserver.com/v1/create-qr-code/?size=150x150&data=abcd

    to generate qrcode on the fly.

    Note: abcd in the url is the data that you want to generate

    Friday, August 5, 2016 3:08 PM
  • I figured that the QR code was added in release OPOS  1.13 onwards, and my project was referencing  Micorsoft.PointOfService and ControlBase dll from version 1.12. So i upgraded the OPOS to version 1.14. This lead to a new issue, PointOfServer and pointOfservice.ControlBase dlls and now showing a warning sign on the references list. giving error missing a using directive or an assembly reference 

     new dll files are present int he path, but its not taking for some reason.. Could it be the framework.? Currently my target framework is 3.5 ? should i upgrade it to 4 ?


    ss

    Friday, August 5, 2016 3:46 PM
  • I still get same error even after updating dll to 1.14

    this is my function call (the value for QR code is 204)

    POSPrinterObj.PrintBarCode(Station,data,BarCodeSymbology.QRCode,height,width,alignment,textPos);


    ss


    • Edited by winn88 Friday, August 5, 2016 8:56 PM
    Friday, August 5, 2016 8:23 PM
  • Hi winn88,

    According to your description, it seems that you pass invalid parameters to this method. please check if you pass the correct type of Parameters to the method.

    public abstract void PrintBarCode(
    	PrinterStation station,
    	string data,
    	BarCodeSymbology symbology,
    	int height,
    	int width,
    	int alignment,
    	BarCodeTextPosition textPosition
    );
    

    Parameters

    station

    The printer station to be used. Possible values are defined by the PrinterStation enumeration. Valid values are PrinterStation.Receipt or PrinterStation.Slip.

    data

    Character string to be bar-coded.

    symbology

    Bar code symbol type to use. Possible values are defined by the BarCodeSymbology enumeration.

    height

    Bar code height. Expressed in the unit of measure indicated by the MapMode property.

    width

    Bar code width. Expressed in the unit of measure indicated by the MapMode property.

    alignment

    Placement of the bar code. For possible values, see Remarks below.

    textPosition

    Placement of the readable character string. Possible values are defined by the BarCodeTextPosition enumeration.

    For more information, please refer to:

    https://msdn.microsoft.com/en-us/library/dd161646%28v=winembedded.10%29.aspx?f=255&MSPPError=-2147217396

    Best regards,

    Cole Wu


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Tuesday, August 9, 2016 7:58 AM
    Moderator
  • Hi Cole..

    Thanks for looking into this. I went through the whole list. Is there a way to get the sample code? or do we need to set some other properties.?  

    I did some testing with the PosPrinter->Microsoft PosPrinter Simulator  which is a testApp that comes along with the SDk (I have 1.14 installed, Path : C:/Program Files (x86)/Microsoft Point Of Service/SDk/Samples/Sample Application/

     For Most of the barcode(codabarP,Pdf417,Maxicode....etc.) i see exception saying Mehtod or operation not implemented, which is understandable since i have not overridden the PrintBarCode function.. but if i try to use the QRCode or the DataMatrix or Aztec , i see ans exception "POSControlException ErrorCode(Illegal) ExtendedErrorCode(0) occurred: An invalid parameter value was specified."  So when i see the stack trace i see the exception being generated from Microsoft.PointOfService.BaseServiceObjects.PosPrinterBase.ValidateBarCodeSymbology(BarCodeSymbology symbology

    When its QRCode it totally took a different path.. I m not able to understand this behavior and also not sure how to debug further.  So i believe this is what happening in my code as well leading to exception. I believe the control object is not able to recognize these barcodes. And also where is this method "ValidateBarCodeSymbology", i am not able to find any info about it. even in the microsoft documentation

     https://msdn.microsoft.com/en-us/library/microsoft.pointofservice.baseserviceobjects.posprinterbase_methods(v=winembedded.11).aspx


    ss



    • Edited by winn88 Tuesday, August 9, 2016 9:17 PM
    Tuesday, August 9, 2016 1:49 PM
  • Hi winn88,

    >>I went through the whole list. Is there a way to get the sample code? or do we need to set some other properties.?  

    If you want to get the sample code. I would suggest that you could post a sample request from the following link.

    http://code.msdn.microsoft.com/windowsapps/site/requests

    The following thread provide some code, which could print barcodes horizontally using the PosPrinter.PrintBarBarcode method.

    http://stackoverflow.com/questions/27308996/is-it-possible-to-print-barcodes-vertically-using-pos-for-net

    Best regards,

    Cole Wu


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Proposed as answer by Hart Wang Tuesday, August 30, 2016 10:00 AM
    Wednesday, August 17, 2016 8:45 AM
    Moderator
  • Could any one tell me the significance of the function :

    Microsoft.PointOfService.BaseServiceObjects.PosPrinterBase.ValidateBarCodeSymbology(BarCodeSymbology)

    I am not able to find any reference to ValidateBarCodeSymbology in the specs/or IBM POS for .NEt docs. If you see my stack trace , ValidateBarCodeSymbology is the one throwing exception since its not able to recognize the QRCode. 


    ss

    Wednesday, August 31, 2016 3:00 PM
  • Hi,

    You can try 3rd plugins to create QR code directly.

    This one is totally free:

    Generating QR Code In C#


    • Edited by Shawn Sh Tuesday, September 20, 2016 9:32 AM
    Tuesday, September 20, 2016 8:52 AM
  • Hi Cole,

    I have the same issue as Winn88 and as it looks like this seems to be a Microsoft problem.

    What I can see from my testing is the same result as Winn88 that some barcodes work but others that have been implemented with the QR code are creating an exception. The sample code SS is referring to in stackoverflow is only using barcodes that I can successfully execute as well.

    Is there an implementation problem in the POS for .NET 1.14?

    Can you elaborate more on the specifics of the parameters for the QR code?

    Best regards,

    Manfred Wilner

    Thursday, September 22, 2016 5:25 PM