aspose-barcode-for-python-via-java 24.9.0__tar.gz → 24.11.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {aspose-barcode-for-python-via-java-24.9.0 → aspose-barcode-for-python-via-java-24.11.0}/PKG-INFO +1 -1
- {aspose-barcode-for-python-via-java-24.9.0 → aspose-barcode-for-python-via-java-24.11.0}/aspose_barcode_for_python_via_java.egg-info/PKG-INFO +1 -1
- {aspose-barcode-for-python-via-java-24.9.0 → aspose-barcode-for-python-via-java-24.11.0}/aspose_barcode_for_python_via_java.egg-info/SOURCES.txt +1 -1
- aspose-barcode-for-python-via-java-24.11.0/asposebarcode/Assist.py +338 -0
- aspose-barcode-for-python-via-java-24.11.0/asposebarcode/ComplexBarcode.py +2914 -0
- aspose-barcode-for-python-via-java-24.11.0/asposebarcode/Generation.py +6456 -0
- aspose-barcode-for-python-via-java-24.11.0/asposebarcode/Recognition.py +2763 -0
- {aspose-barcode-for-python-via-java-24.9.0 → aspose-barcode-for-python-via-java-24.11.0}/asposebarcode/__init__.py +1 -1
- aspose-barcode-for-python-via-java-24.9.0/asposebarcode/jlib/aspose-barcode-python-24.9.jar → aspose-barcode-for-python-via-java-24.11.0/asposebarcode/jlib/aspose-barcode-python-24.11.jar +0 -0
- {aspose-barcode-for-python-via-java-24.9.0 → aspose-barcode-for-python-via-java-24.11.0}/setup.py +1 -1
- aspose-barcode-for-python-via-java-24.9.0/asposebarcode/Assist.py +0 -299
- aspose-barcode-for-python-via-java-24.9.0/asposebarcode/ComplexBarcode.py +0 -2776
- aspose-barcode-for-python-via-java-24.9.0/asposebarcode/Generation.py +0 -6737
- aspose-barcode-for-python-via-java-24.9.0/asposebarcode/Recognition.py +0 -2839
- {aspose-barcode-for-python-via-java-24.9.0 → aspose-barcode-for-python-via-java-24.11.0}/MANIFEST.in +0 -0
- {aspose-barcode-for-python-via-java-24.9.0 → aspose-barcode-for-python-via-java-24.11.0}/README.md +0 -0
- {aspose-barcode-for-python-via-java-24.9.0 → aspose-barcode-for-python-via-java-24.11.0}/aspose_barcode_for_python_via_java.egg-info/dependency_links.txt +0 -0
- {aspose-barcode-for-python-via-java-24.9.0 → aspose-barcode-for-python-via-java-24.11.0}/aspose_barcode_for_python_via_java.egg-info/requires.txt +0 -0
- {aspose-barcode-for-python-via-java-24.9.0 → aspose-barcode-for-python-via-java-24.11.0}/aspose_barcode_for_python_via_java.egg-info/top_level.txt +0 -0
- {aspose-barcode-for-python-via-java-24.9.0 → aspose-barcode-for-python-via-java-24.11.0}/license/End+User+License+Agreement.html +0 -0
- {aspose-barcode-for-python-via-java-24.9.0 → aspose-barcode-for-python-via-java-24.11.0}/license/ThirdPartyLicenses.Aspose.BarCode.Java.pdf +0 -0
- {aspose-barcode-for-python-via-java-24.9.0 → aspose-barcode-for-python-via-java-24.11.0}/setup.cfg +0 -0
{aspose-barcode-for-python-via-java-24.9.0 → aspose-barcode-for-python-via-java-24.11.0}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: aspose-barcode-for-python-via-java
|
|
3
|
-
Version: 24.
|
|
3
|
+
Version: 24.11.0
|
|
4
4
|
Summary: Barcode generation and recognition component. It allows developers to quickly and easily add barcode creation and scanning functionality to their Python applications.
|
|
5
5
|
Home-page: UNKNOWN
|
|
6
6
|
Author: Aspose
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: aspose-barcode-for-python-via-java
|
|
3
|
-
Version: 24.
|
|
3
|
+
Version: 24.11.0
|
|
4
4
|
Summary: Barcode generation and recognition component. It allows developers to quickly and easily add barcode creation and scanning functionality to their Python applications.
|
|
5
5
|
Home-page: UNKNOWN
|
|
6
6
|
Author: Aspose
|
|
@@ -11,6 +11,6 @@ asposebarcode/ComplexBarcode.py
|
|
|
11
11
|
asposebarcode/Generation.py
|
|
12
12
|
asposebarcode/Recognition.py
|
|
13
13
|
asposebarcode/__init__.py
|
|
14
|
-
asposebarcode/jlib/aspose-barcode-python-24.
|
|
14
|
+
asposebarcode/jlib/aspose-barcode-python-24.11.jar
|
|
15
15
|
license/End+User+License+Agreement.html
|
|
16
16
|
license/ThirdPartyLicenses.Aspose.BarCode.Java.pdf
|
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from abc import ABC, abstractmethod
|
|
4
|
+
from typing import Optional, List, Union
|
|
5
|
+
import jpype
|
|
6
|
+
|
|
7
|
+
class BaseJavaClass(ABC):
|
|
8
|
+
|
|
9
|
+
def __init__(self, javaClass) -> None:
|
|
10
|
+
if javaClass is None:
|
|
11
|
+
raise ValueError("javaClass cannot be None")
|
|
12
|
+
self.javaClass = javaClass
|
|
13
|
+
self.javaClassName: str = ""
|
|
14
|
+
|
|
15
|
+
if not self.javaClassName:
|
|
16
|
+
self.javaClassName = str(self.javaClass.getClass().getName())
|
|
17
|
+
self.init()
|
|
18
|
+
|
|
19
|
+
@abstractmethod
|
|
20
|
+
def init(self) -> None:
|
|
21
|
+
pass
|
|
22
|
+
|
|
23
|
+
def getJavaClass(self):
|
|
24
|
+
return self.javaClass
|
|
25
|
+
|
|
26
|
+
def setJavaClass(self, javaClass) -> None:
|
|
27
|
+
self.javaClass = javaClass
|
|
28
|
+
self.init()
|
|
29
|
+
|
|
30
|
+
def getJavaClassName(self) -> str:
|
|
31
|
+
return self.javaClassName
|
|
32
|
+
|
|
33
|
+
def isNull(self) -> bool:
|
|
34
|
+
return self.javaClass.isNull()
|
|
35
|
+
|
|
36
|
+
def printJavaClassName(self) -> None:
|
|
37
|
+
print("Java class name => \'" + self.javaClassName + "\'")
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class Rectangle(BaseJavaClass):
|
|
41
|
+
"""!
|
|
42
|
+
A Rectangle specifies an area in a coordinate space that is
|
|
43
|
+
enclosed by the Rectangle object's upper-left point
|
|
44
|
+
in the coordinate space, its width, and its height.
|
|
45
|
+
"""
|
|
46
|
+
|
|
47
|
+
javaClassName = "java.awt.Rectangle"
|
|
48
|
+
|
|
49
|
+
def init(self) -> None:
|
|
50
|
+
pass
|
|
51
|
+
|
|
52
|
+
def __init__(self, x: int, y: int, width: int, height: int) -> None:
|
|
53
|
+
"""!
|
|
54
|
+
Rectangle constructor.
|
|
55
|
+
@param x The x-coordinate of the upper-left corner of the rectangle.
|
|
56
|
+
@param y The y-coordinate of the upper-left corner of the rectangle.
|
|
57
|
+
@param width The width of the rectangle.
|
|
58
|
+
@param height The height of the rectangle.
|
|
59
|
+
"""
|
|
60
|
+
javaRectangle = jpype.JClass(self.javaClassName)
|
|
61
|
+
self.javaClass = javaRectangle(x, y, width, height)
|
|
62
|
+
super().__init__(self.javaClass)
|
|
63
|
+
|
|
64
|
+
def __str__(self) -> str:
|
|
65
|
+
return f"{self.getX()},{self.getY()},{self.getWidth()},{self.getHeight()}"
|
|
66
|
+
|
|
67
|
+
def __eq__(self, other: Optional[Rectangle]) -> bool:
|
|
68
|
+
"""!
|
|
69
|
+
Determines whether this instance and a specified object,
|
|
70
|
+
which must also be a Unit object, have the same value.
|
|
71
|
+
@param other: The Unit to compare to this instance.
|
|
72
|
+
@return: True if other is a Unit and its value is the same as this instance, otherwise False. If other is None, the method returns false.
|
|
73
|
+
"""
|
|
74
|
+
if other is None:
|
|
75
|
+
return False
|
|
76
|
+
if not isinstance(other, Rectangle):
|
|
77
|
+
return NotImplemented
|
|
78
|
+
return bool(self.getJavaClass().equals(other.getJavaClass()))
|
|
79
|
+
|
|
80
|
+
def __hash__(self) -> int:
|
|
81
|
+
"""!
|
|
82
|
+
Returns the hash code for the current instance.
|
|
83
|
+
@return A hash code for the current object.
|
|
84
|
+
"""
|
|
85
|
+
return int(self.getJavaClass().hashCode())
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
@staticmethod
|
|
89
|
+
def construct(arg) -> Rectangle:
|
|
90
|
+
rectangle = Rectangle(0, 0, 0, 0)
|
|
91
|
+
rectangle.javaClass = arg
|
|
92
|
+
return rectangle
|
|
93
|
+
|
|
94
|
+
def getX(self) -> int:
|
|
95
|
+
"""!
|
|
96
|
+
Returns the X coordinate of the bounding Rectangle in
|
|
97
|
+
double precision.
|
|
98
|
+
@return the X coordinate of the bounding Rectangle.
|
|
99
|
+
"""
|
|
100
|
+
return int(self.getJavaClass().getX())
|
|
101
|
+
|
|
102
|
+
def getY(self) -> int:
|
|
103
|
+
"""!
|
|
104
|
+
Returns the Y coordinate of the bounding Rectangle in
|
|
105
|
+
double precision.
|
|
106
|
+
@return the Y coordinate of the bounding Rectangle.
|
|
107
|
+
"""
|
|
108
|
+
return int(self.getJavaClass().getY())
|
|
109
|
+
|
|
110
|
+
def getLeft(self) -> int:
|
|
111
|
+
"""!
|
|
112
|
+
Gets the x-coordinate of the left edge of self Rectangle class.
|
|
113
|
+
@returns The x-coordinate of the left edge of self Rectangle class.
|
|
114
|
+
"""
|
|
115
|
+
return self.getX()
|
|
116
|
+
|
|
117
|
+
def getTop(self) -> int:
|
|
118
|
+
"""!
|
|
119
|
+
Gets the y-coordinate of the top edge of self Rectangle class.
|
|
120
|
+
@returns The y-coordinate of the top edge of self Rectangle class.
|
|
121
|
+
"""
|
|
122
|
+
return self.getY()
|
|
123
|
+
|
|
124
|
+
def getRight(self) -> int:
|
|
125
|
+
"""!
|
|
126
|
+
Gets the x-coordinate that is the sum of X and Width property values of self Rectangle class.
|
|
127
|
+
@returns The x-coordinate that is the sum of X and Width of self Rectangle.
|
|
128
|
+
"""
|
|
129
|
+
return self.getX() + self.getWidth()
|
|
130
|
+
|
|
131
|
+
def getBottom(self) -> int:
|
|
132
|
+
"""!
|
|
133
|
+
Gets the y-coordinate that is the sum of the Y and Height property values of self Rectangle class.
|
|
134
|
+
@returns The y-coordinate that is the sum of Y and Height of self Rectangle.
|
|
135
|
+
"""
|
|
136
|
+
return self.getY() + self.getHeight()
|
|
137
|
+
|
|
138
|
+
def getWidth(self) -> int:
|
|
139
|
+
"""!
|
|
140
|
+
Returns the width of the bounding Rectangle in
|
|
141
|
+
double precision.
|
|
142
|
+
@return the width of the bounding Rectangle.
|
|
143
|
+
"""
|
|
144
|
+
return int(self.getJavaClass().getWidth())
|
|
145
|
+
|
|
146
|
+
def getHeight(self) -> int:
|
|
147
|
+
"""!
|
|
148
|
+
Returns the height of the bounding Rectangle in
|
|
149
|
+
double precision.
|
|
150
|
+
@return the height of the bounding Rectangle.
|
|
151
|
+
"""
|
|
152
|
+
return int(self.getJavaClass().getHeight())
|
|
153
|
+
|
|
154
|
+
def intersectsWithInclusive(self, rectangle: Rectangle) -> bool:
|
|
155
|
+
"""!
|
|
156
|
+
Determines if self rectangle intersects with rect.
|
|
157
|
+
@param rectangle
|
|
158
|
+
@returns {boolean
|
|
159
|
+
"""
|
|
160
|
+
return not ((self.getLeft() > rectangle.getRight()) | (self.getRight() < rectangle.getLeft()) |
|
|
161
|
+
(self.getTop() > rectangle.getBottom()) | (self.getBottom() < rectangle.getTop()))
|
|
162
|
+
|
|
163
|
+
@staticmethod
|
|
164
|
+
def intersect(a: Rectangle, b: Rectangle) -> Rectangle:
|
|
165
|
+
"""!
|
|
166
|
+
Intersect Shared Method
|
|
167
|
+
Produces a new Rectangle by intersecting 2 existing
|
|
168
|
+
Rectangles. Returns None if there is no intersection.
|
|
169
|
+
"""
|
|
170
|
+
if not a.intersectsWithInclusive(b):
|
|
171
|
+
return Rectangle(0, 0, 0, 0)
|
|
172
|
+
|
|
173
|
+
return Rectangle.fromLTRB(max(a.getLeft(), b.getLeft()),
|
|
174
|
+
max(a.getTop(), b.getTop()),
|
|
175
|
+
min(a.getRight(), b.getRight()),
|
|
176
|
+
min(a.getBottom(), b.getBottom()))
|
|
177
|
+
|
|
178
|
+
@staticmethod
|
|
179
|
+
def fromLTRB(left: int, top: int, right: int, bottom: int) -> Rectangle:
|
|
180
|
+
"""!
|
|
181
|
+
FromLTRB Shared Method
|
|
182
|
+
Produces a Rectangle class from left, top, right,
|
|
183
|
+
and bottom coordinates.
|
|
184
|
+
"""
|
|
185
|
+
return Rectangle(left, top, right - left, bottom - top)
|
|
186
|
+
|
|
187
|
+
def isEmpty(self) -> bool:
|
|
188
|
+
return (self.getWidth() <= 0) | (self.getHeight() <= 0)
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
class Point(BaseJavaClass):
|
|
192
|
+
javaClassName = "java.awt.Point"
|
|
193
|
+
|
|
194
|
+
def __init__(self, x: int, y: int) -> None:
|
|
195
|
+
javaPoint = jpype.JClass(Point.javaClassName)
|
|
196
|
+
self.javaClass = javaPoint(int(x), int(y))
|
|
197
|
+
super().__init__(self.javaClass)
|
|
198
|
+
|
|
199
|
+
@staticmethod
|
|
200
|
+
def construct(arg) -> Point:
|
|
201
|
+
point = Point(0, 0)
|
|
202
|
+
point.javaClass = arg
|
|
203
|
+
return point
|
|
204
|
+
|
|
205
|
+
def init(self) -> None:
|
|
206
|
+
pass
|
|
207
|
+
|
|
208
|
+
def getX(self) -> int:
|
|
209
|
+
"""!
|
|
210
|
+
The X coordinate of this <code>Point</code>.
|
|
211
|
+
If no X coordinate is set it will default to 0.
|
|
212
|
+
"""
|
|
213
|
+
return int(self.getJavaClass().getX())
|
|
214
|
+
|
|
215
|
+
def getY(self) -> int:
|
|
216
|
+
"""!
|
|
217
|
+
The Y coordinate of this <code>Point</code>.
|
|
218
|
+
If no Y coordinate is set it will default to 0.
|
|
219
|
+
"""
|
|
220
|
+
return int(self.getJavaClass().getY())
|
|
221
|
+
|
|
222
|
+
def setX(self, x: int) -> None:
|
|
223
|
+
"""!
|
|
224
|
+
The Y coordinate of this <code>Point</code>.
|
|
225
|
+
If no Y coordinate is set it will default to 0.
|
|
226
|
+
"""
|
|
227
|
+
self.getJavaClass().x = x
|
|
228
|
+
|
|
229
|
+
def setY(self, y: int) -> None:
|
|
230
|
+
"""!
|
|
231
|
+
The Y coordinate of this <code>Point</code>.
|
|
232
|
+
If no Y coordinate is set it will default to 0.
|
|
233
|
+
"""
|
|
234
|
+
self.getJavaClass().y = y
|
|
235
|
+
|
|
236
|
+
def __str__(self) -> str:
|
|
237
|
+
return f"{self.getX()},{self.getY()}"
|
|
238
|
+
|
|
239
|
+
def __eq__(self, other: Optional[Point]) -> bool:
|
|
240
|
+
"""!
|
|
241
|
+
Determines whether this instance and a specified object,
|
|
242
|
+
which must also be a Unit object, have the same value.
|
|
243
|
+
@param other: The Unit to compare to this instance.
|
|
244
|
+
@return: True if other is a Unit and its value is the same as this instance, otherwise False. If other is None, the method returns false.
|
|
245
|
+
"""
|
|
246
|
+
if other is None:
|
|
247
|
+
return False
|
|
248
|
+
if not isinstance(other, Point):
|
|
249
|
+
return NotImplemented
|
|
250
|
+
return bool(self.getJavaClass().equals(other.getJavaClass()))
|
|
251
|
+
|
|
252
|
+
def __hash__(self) -> int:
|
|
253
|
+
"""!
|
|
254
|
+
Returns the hash code for the current instance.
|
|
255
|
+
@return A hash code for the current object.
|
|
256
|
+
"""
|
|
257
|
+
return int(self.getJavaClass().hashCode())
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
class License(BaseJavaClass):
|
|
261
|
+
javaClassName = "com.aspose.python.barcode.license.PythonLicense"
|
|
262
|
+
|
|
263
|
+
def __init__(self) -> None:
|
|
264
|
+
javaLicense = jpype.JClass(self.javaClassName)
|
|
265
|
+
self.javaClass = javaLicense()
|
|
266
|
+
super().__init__(self.javaClass)
|
|
267
|
+
|
|
268
|
+
def setLicense(self, filePath: str) -> None:
|
|
269
|
+
"""
|
|
270
|
+
Licenses the component.
|
|
271
|
+
@:param: filePath: Can be a full or short file name. Use an empty string to switch to evaluation mode.
|
|
272
|
+
"""
|
|
273
|
+
try:
|
|
274
|
+
file_data = License.openFile(filePath)
|
|
275
|
+
jArray = jpype.JArray(jpype.JString, 1)(file_data)
|
|
276
|
+
self.getJavaClass().setLicense(jArray)
|
|
277
|
+
except Exception as ex:
|
|
278
|
+
raise BarCodeException(ex)
|
|
279
|
+
|
|
280
|
+
def isLicensed(self) -> bool:
|
|
281
|
+
javaClass = self.getJavaClass()
|
|
282
|
+
is_licensed = javaClass.isLicensed()
|
|
283
|
+
return str(is_licensed) == "true"
|
|
284
|
+
|
|
285
|
+
def resetLicense(self) -> None:
|
|
286
|
+
javaClass = self.getJavaClass()
|
|
287
|
+
javaClass.resetLicense()
|
|
288
|
+
|
|
289
|
+
@staticmethod
|
|
290
|
+
def openFile(filename: str) -> List[str]:
|
|
291
|
+
file = open(filename, "rb")
|
|
292
|
+
image_data_binary = file.read()
|
|
293
|
+
file.close()
|
|
294
|
+
array = []
|
|
295
|
+
array.append('')
|
|
296
|
+
i = 0
|
|
297
|
+
while i < len(image_data_binary):
|
|
298
|
+
array.append(str(image_data_binary[i]))
|
|
299
|
+
i += 1
|
|
300
|
+
return array
|
|
301
|
+
|
|
302
|
+
def init(self) -> None:
|
|
303
|
+
pass
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
class BarCodeException(Exception):
|
|
307
|
+
"""!
|
|
308
|
+
Represents the exception for creating barcode image.
|
|
309
|
+
"""
|
|
310
|
+
|
|
311
|
+
@staticmethod
|
|
312
|
+
def MAX_LINES() -> int:
|
|
313
|
+
return 4
|
|
314
|
+
|
|
315
|
+
def __init__(self, exc: Union[str, Exception]) -> None:
|
|
316
|
+
"""!
|
|
317
|
+
Initializes a new instance of the BarCodeException class with specified error message.
|
|
318
|
+
"""
|
|
319
|
+
self.message: Optional[str] = None
|
|
320
|
+
super().__init__(self, exc)
|
|
321
|
+
if isinstance(exc, str):
|
|
322
|
+
self.setMessage(str(exc))
|
|
323
|
+
return
|
|
324
|
+
|
|
325
|
+
exc_message = 'Exception occurred in file:line\n'
|
|
326
|
+
self.setMessage(exc_message)
|
|
327
|
+
|
|
328
|
+
def setMessage(self, message: str) -> None:
|
|
329
|
+
"""!
|
|
330
|
+
Sets message
|
|
331
|
+
"""
|
|
332
|
+
self.message = message
|
|
333
|
+
|
|
334
|
+
def getMessage(self) -> Optional[str]:
|
|
335
|
+
"""!
|
|
336
|
+
Gets message
|
|
337
|
+
"""
|
|
338
|
+
return self.message
|