如何将长字符串分成多个qr区域?

时间:2019-09-03 06:06:39

标签: java qr-code

使用RSA密钥对数据签名后,我具有CMS签名。我需要将较长的CMS签名字符串放入qr代码中。但是签名字符串太长,无法生成单个qr。我认为我应该将QR划分为多个区域(在多个QR中)。有没有办法将QR划分为多个区域?

示例:

最近在Java中,我尝试使用zxing库来帮助生成qr代码。但是,它会像其他任何在线服务一样为长字符串引发错误。

String signedData = "9MA0GCSqGSIb3DQEBCwUABIIBABVim6AYRyf6AmkZFdAkKvaAvMkQEGYVwa2KUz/FBeuK9MA0GCSqGSIb3DQEBCwUABIIBABVim6AYRyf6AmkZFdAkKvaAvMkQEGYVwa2KUz/FBeuK9MA0GCSqGSIb3DQEBCwUABIIBABVim6AYRyf6AmkZFdAkKvaAvMkQEGYVwa2KUz/FBeuK9MA0GCSqGSIb3DQEBCwUABIIBABVim6AYRyf6AmkZFdAkKvaAvMkQEGYVwa2KUz/FBeuK9MA0GCSqGSIb3DQEBCwUABIIBABVim6AYRyf6AmkZFdAkKvaAvMkQEGYVwa2KUz/FBeuK9MA0GCSqGSIb3DQEBCwUABIIBABVim6AYRyf6AmkZFdAkKvaAvMkQEGYVwa2KUz/FBeuK9MA0GCSqGSIb3DQEBCwUABIIBABVim6AYRyf6AmkZFdAkKvaAvMkQEGYVwa2KUz/FBeuK9MA0GCSqGSIb3DQEBCwUABIIBABVim6AYRyf6AmkZFdAkKvaAvMkQEGYVwa2KUz/FBeuK9MA0GCSqGSIb3DQEBCwUABIIBABVim6AYRyf6AmkZFdAkKvaAvMkQEGYVwa2KUz/FBeuK9MA0GCSqGSIb3DQEBCwUABIIBABVim6AYRyf6AmkZFdAkKvaAvMkQEGYVwa2KUz/FBeuK9MA0GCSqGSIb3DQEBCwUABIIBABVim6AYRyf6AmkZFdAkKvaAvMkQEGYVwa2KUz/FBeuK9MA0GCSqGSIb3DQEBCwUABIIBABVim6AYRyf6AmkZFdAkKvaAvMkQEGYVwa2KUz/FBeuK9MA0GCSqGSIb3DQEBCwUABIIBABVim6AYRyf6AmkZFdAkKvaAvMkQEGYVwa2KUz/FBeuK9MA0GCSqGSIb3DQEBCwUABIIBABVim6AYRyf6AmkZFdAkKvaAvMkQEGYVwa2KUz/FBeuK9MA0GCSqGSIb3DQEBCwUABIIBABVim6AYRyf6AmkZFdAkKvaAvMkQEGYVwa2KUz/FBeuK9MA0GCSqGSIb3DQEBCwUABIIBABVim6AYRyf6AmkZFdAkKvaAvMkQEGYVwa2KUz/FBeuK9MA0GCSqGSIb3DQEBCwUABIIBABVim6AYRyf6AmkZFdAkKvaAvMkQEGYVwa2KUz/FBeuK9MA0GCSqGSIb3DQEBCwUABIIBABVim6AYRyf6AmkZFdAkKvaAvMkQEGYVwa2KUz/FBeuK9MA0GCSqGSIb3DQEBCwUABIIBABVim6AYRyf6AmkZFdAkKvaAvMkQEGYVwa2KUz/FBeuK9MA0GCSqGSIb3DQEBCwUABIIBABVim6AYRyf6AmkZFdAkKvaAvMkQEGYVwa2KUz/FBeuK/2CkQG0a0x+X9MA0GCSqGSIb3DQEBCwUABIIBABVim6AYRyf6AmkZFdAkKvaAvMkQEGYVwa2KUz/FBeuK/dI";

QRCodeWriter qrCodeWriter = new QRCodeWriter();
BitMatrix bitMatrix = qrCodeWriter.encode(signedData, 
BarcodeFormat.QR_CODE, 1000, 1000);

File signedFile = new File(id + ".png");

Path path = signedFile.toPath();

MatrixToImageWriter.writeToPath(bitMatrix, "PNG", path);

我希望像Java的链接附件图像一样,从signedData字符串生成多个qrs。

0 个答案:

没有答案