Hello,
I tried to generate a pdf147 barcode with binary content and read it back but have problem doing this.
Below is the java code and output. Barcode data is a 256 bytes array with value from 0 to 255. Please note the decoded byte array size is 256 instead of 255. Attached is the output barcode png file.
Thanks,
Hung
License lic = new License();
try
{
//lic.setLicense(com.aspose.barcode.samples.Constants.LICENSE_FULL_PATH);
lic.setLicense("C:\\Users\\A2VAJZZ\\Documents\\NetBeansProjects\\pdf147sample\\Aspose.BarCode.lic");
}
catch (Exception e)
{
e.printStackTrace();
}
byte[] codeBytes = new byte[256];
for (int i = 0; i < 256; i++) {
codeBytes[i] = (byte) i;
}
int symbology = Symbology.Pdf417;
BarCodeReadType barCodeReadType = BarCodeReadType.getPdf417();
String file = "c:\\Pdf417apose.png";
BarCodeBuilder bd = new BarCodeBuilder();
bd.setPdf417CompactionMode(Pdf417CompactionMode.Binary);
bd.setCodeText(codeBytes);
bd.setSymbologyType(symbology);
bd.setCodeLocation(CodeLocation.NONE);
bd.save(file);
file = "c:\\Pdf417apose.png";
barCodeReadType = BarCodeReadType.getPdf417();
BarCodeReader reader = new BarCodeReader(file, barCodeReadType);
if (reader.read())
{
byte[] bcVal2 = reader.getCodeBytes();
System.out.println("Original length " + codeBytes.length);
System.out.println("barcode length " + bcVal2.length);
for (int i = 0; i < bcVal2.length; i++) {
if (bcVal2[i] != codeBytes[i]) {
System.out.println(i + " " + codeBytes[i] + " " + bcVal2[i]);
}
}
}
else
{
System.out.println("Not recognized!");
}
Original length 256
barcode length 257
1 1 0
2 2 0
3 3 73
4 4 99
5 5 -40
6 6 0
7 7 1
8 8 -74
9 9 -24
10 10 29
11 11 -32
12 12 0
13 13 3
14 14 109
15 15 -122
16 16 -41
17 17 -23
18 18 0
19 19 5
20 20 36
21 21 37
22 22 -111
23 23 -15
24 24 0
25 25 6
26 26 -38
27 27 -60
28 28 75
29 29 -6
32 32 0
33 33 9
34 34 35
35 35 -105
36 36 -18
37 37 -80
38 38 0
39 39 10
40 40 -38
41 41 54
42 42 -88
43 43 -72
44 44 0
45 45 12
46 46 -112
47 47 -43
48 48 98
49 49 -63
50 50 0
51 51 14
52 52 71
53 53 116
54 54 28
55 55 -54
56 56 0
57 57 15
58 58 -2
59 59 18
60 60 -42
61 61 -46
62 62 0
63 63 17
64 64 -76
65 65 -79
66 66 -112
67 67 -37
68 68 0
69 69 19
70 70 107
71 71 80
72 72 74
73 73 -29
74 74 0
75 75 21
76 76 33
77 77 -17
78 78 4
79 79 -20
80 80 0
81 81 22
82 82 -40
83 83 -115
84 84 -66
85 85 -12
86 86 0
87 87 24
88 88 -113
89 89 44
90 90 120
91 91 -3
92 92 0
93 93 26
94 94 69
95 95 -53
96 96 51
97 97 5
98 98 0
99 99 27
100 100 -4
101 101 105
102 102 -19
103 103 14
104 104 0
105 105 29
106 106 -77
107 107 8
108 108 -89
109 109 22
110 110 0
111 111 31
112 112 105
113 113 -89
114 114 97
115 115 31
116 116 0
117 117 33
118 118 32
119 119 70
120 120 27
121 121 39
122 122 0
123 123 20
124 124 -69
125 125 16
126 126 30
127 127 -99
128 -128 0
129 -127 36
130 -126 68
131 -125 105
132 -124 26
133 -123 -30
134 -122 0
135 -121 37
136 -120 -5
137 -119 7
138 -118 -44
139 -117 -22
140 -116 0
141 -115 39
142 -114 -79
143 -113 -90
144 -112 -114
145 -111 -13
146 -110 0
147 -109 41
148 -108 104
149 -107 69
150 -106 72
151 -105 -5
152 -104 0
153 -103 43
154 -102 30
155 -101 -28
156 -100 3
157 -99 4
158 -98 0
159 -97 44
160 -96 -43
161 -95 -126
162 -94 -67
163 -93 12
164 -92 0
165 -91 46
166 -90 -116
167 -89 33
168 -88 119
169 -87 21
170 -86 0
171 -85 48
172 -84 66
173 -83 -64
174 -82 49
175 -81 30
176 -80 0
177 -79 49
178 -78 -7
179 -77 94
180 -76 -21
181 -75 38
182 -74 0
183 -73 51
184 -72 -81
185 -71 -3
186 -70 -91
187 -69 47
188 -68 0
189 -67 53
190 -66 102
191 -65 -100
192 -64 95
193 -63 55
194 -62 0
195 -61 55
196 -60 29
197 -59 59
198 -58 25
199 -57 64
200 -56 0
201 -55 56
202 -54 -45
203 -53 -39
204 -52 -45
205 -51 72
206 -50 0
207 -49 58
208 -48 -118
209 -47 120
210 -46 -115
211 -45 81
212 -44 0
213 -43 60
214 -42 65
215 -41 23
216 -40 71
217 -39 89
218 -38 0
219 -37 61
220 -36 -9
221 -35 -74
222 -34 1
223 -33 98
224 -32 0
225 -31 63
226 -30 -82
227 -29 84
228 -28 -69
229 -27 106
230 -26 0
231 -25 65
232 -24 100
233 -23 -13
234 -22 117
235 -21 115
236 -20 0
237 -19 67
238 -18 27
239 -17 -110
240 -16 47
241 -15 124
242 -14 0
243 -13 68
244 -12 -46
245 -11 48
246 -10 -23
247 -9 -124
248 -8 0
249 -7 70
250 -6 -120
251 -5 -49
252 -4 -93
253 -3 -115
254 -2 -3
255 -1 -2