zxingify / zxingify-objc

An Objective-C Port of ZXing
Apache License 2.0
3.07k stars 753 forks source link

Generated DataMatrix Invalid #437

Closed RyanBluth closed 6 years ago

RyanBluth commented 6 years ago

I am trying to generate a data matrix that contains 300 characters. The generated data matrix is always in valid

I'm using the following code: NSString *qrContents = @"abGQiCU413ZlK5sxgqBnLxysXWEQsmZzAykxtbvkpVzEshILHtqYYDvAYolgOh9g8OPD9eFMHbwKxh1NH5Li4snQczwRmivbJdt9EiPTG4WcpOEvzhnAyPc6Acuw1zyjAwY5aCr61JWFs5HqCzEFVyo2Ur69eLBwA3vWdlqbxDNkTnzV0L61QwKq8KPg97VugF3GiYeZEPxanYctznrktw2Q1LTGdekmbgA1Jzy3vytscRBiI8xvtbw6R6dafeZg9bUUjKT8OYWgWmIdZ54L60DY4foAaVbwqZlXATtGCRwY";; NSError *error = nil; ZXDataMatrixWriter *writer = [ZXDataMatrixWriter new]; ZXEncodeHints *hints = [ZXEncodeHints hints]; hints.encoding = NSUTF8StringEncoding; hints.dataMatrixShape = ZXDataMatrixSymbolShapeHintForceSquare; ZXBitMatrix* result = [writer encode:qrContents format:kBarcodeFormatDataMatrix width:1000 height:1000 hints:hints error:&error]; if (result) { CGImageRef image = [[ZXImage imageWithMatrix:result] cgimage]; self.qrImageView.image = [UIImage imageWithCGImage:image]; } else { NSString *errorMessage = [error localizedDescription]; }

It generates this image

screen shot 2018-09-26 at 3 31 50 pm