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