Skip to content

Commit 268a19c

Browse files
committed
[RELEASE] iText Android 9.7.0
1 parent bf7a554 commit 268a19c

701 files changed

Lines changed: 971 additions & 21635 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

barcodes/pom.xml

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,35 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2+
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
34
<modelVersion>4.0.0</modelVersion>
4-
55
<parent>
6-
<groupId>com.itextpdf</groupId>
7-
<artifactId>root</artifactId>
6+
<groupId>com.itextpdf.android</groupId>
7+
<artifactId>root-android</artifactId>
88
<version>9.7.0</version>
99
</parent>
10-
11-
<artifactId>barcodes</artifactId>
12-
10+
<artifactId>barcodes-android</artifactId>
1311
<name>iText - barcodes</name>
1412
<url>https://itextpdf.com/</url>
15-
1613
<properties>
1714
<sharpen.phase>install</sharpen.phase>
18-
<sharpen.projectName>barcodes</sharpen.projectName>
1915
<sharpen.cSharpTargetFolder>./../../../sharp/itextcore</sharpen.cSharpTargetFolder>
20-
<sharpen.cSharpSourceCodeDestination>itext/itext.barcodes</sharpen.cSharpSourceCodeDestination>
2116
<sharpen.cSharpTestCodeDestination>itext.tests/itext.barcodes.tests</sharpen.cSharpTestCodeDestination>
17+
<sharpen.projectName>barcodes</sharpen.projectName>
18+
<sharpen.cSharpSourceCodeDestination>itext/itext.barcodes</sharpen.cSharpSourceCodeDestination>
2219
</properties>
23-
2420
<dependencies>
2521
<dependency>
26-
<groupId>com.itextpdf</groupId>
27-
<artifactId>kernel</artifactId>
22+
<groupId>com.itextpdf.android</groupId>
23+
<artifactId>kernel-android</artifactId>
2824
<version>${project.version}</version>
2925
</dependency>
3026
<dependency>
31-
<groupId>com.itextpdf</groupId>
32-
<artifactId>pdftest</artifactId>
27+
<groupId>com.itextpdf.android</groupId>
28+
<artifactId>pdftest-android</artifactId>
3329
<version>${project.version}</version>
3430
<scope>test</scope>
3531
</dependency>
3632
</dependencies>
37-
3833
<build>
3934
<resources>
4035
<resource>
@@ -45,4 +40,4 @@
4540
</resource>
4641
</resources>
4742
</build>
48-
</project>
43+
</project>

barcodes/src/main/java/com/itextpdf/barcodes/Barcode128.java

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -715,56 +715,6 @@ public void setCode(String code) {
715715
}
716716
}
717717

718-
// Android-Conversion-Skip-Block-Start (java.awt library isn't available on Android)
719-
/**
720-
* Creates a <CODE>java.awt.Image</CODE>. This image only
721-
* contains the bars without any text.
722-
*
723-
* @param foreground the color of the bars
724-
* @param background the color of the background
725-
* @return the image
726-
*/
727-
@Override
728-
public java.awt.Image createAwtImage(java.awt.Color foreground, java.awt.Color background) {
729-
int f = (foreground == null) ? DEFAULT_BAR_FOREGROUND_COLOR.getRGB() : foreground.getRGB();
730-
int g = (background == null) ? DEFAULT_BAR_BACKGROUND_COLOR.getRGB() : background.getRGB();
731-
java.awt.Canvas canvas = new java.awt.Canvas();
732-
String bCode;
733-
if (codeType == CODE128_RAW) {
734-
int idx = code.indexOf('\uffff');
735-
if (idx >= 0) {
736-
bCode = code.substring(0, idx);
737-
} else {
738-
bCode = code;
739-
}
740-
} else {
741-
bCode = getRawText(code, codeType == CODE128_UCC);
742-
}
743-
int len = bCode.length();
744-
int fullWidth = (len + 2) * 11 + 2;
745-
byte[] bars = getBarsCode128Raw(bCode);
746-
747-
boolean print = true;
748-
int ptr = 0;
749-
int height = (int) barHeight;
750-
int[] pix = new int[fullWidth * height];
751-
for (int k = 0; k < bars.length; ++k) {
752-
int w = bars[k];
753-
int c = g;
754-
if (print) {
755-
c = f;
756-
}
757-
print = !print;
758-
for (int j = 0; j < w; ++j) {
759-
pix[ptr++] = c;
760-
}
761-
}
762-
for (int k = fullWidth; k < pix.length; k += fullWidth) {
763-
System.arraycopy(pix, 0, pix, k, fullWidth);
764-
}
765-
return canvas.createImage(new java.awt.image.MemoryImageSource(fullWidth, height, pix, 0, fullWidth));
766-
}
767-
// Android-Conversion-Skip-Block-End
768718

769719
private static char getStartSymbol(Barcode128CodeSet codeSet) {
770720
switch (codeSet) {

barcodes/src/main/java/com/itextpdf/barcodes/Barcode1D.java

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,6 @@ public abstract class Barcode1D {
5050
*/
5151
public static final int ALIGN_CENTER = 3;
5252

53-
// Android-Conversion-Skip-Block-Start (java.awt library isn't available on Android)
54-
/**
55-
* The default color to draw if a bar is present.
56-
*/
57-
protected final java.awt.Color DEFAULT_BAR_FOREGROUND_COLOR = java.awt.Color.BLACK;
58-
/**
59-
* The default color to draw if a bar is not present.
60-
*/
61-
protected final java.awt.Color DEFAULT_BAR_BACKGROUND_COLOR = java.awt.Color.WHITE;
62-
// Android-Conversion-Skip-Block-End
6353

6454
protected PdfDocument document;
6555

@@ -502,17 +492,6 @@ public void setAltText(String altText) {
502492
this.altText = altText;
503493
}
504494

505-
// Android-Conversion-Skip-Block-Start (java.awt library isn't available on Android)
506-
/**
507-
* Creates a <CODE>java.awt.Image</CODE>. This image only
508-
* contains the bars without any text.
509-
*
510-
* @param foreground the color of the bars. If <CODE>null</CODE> defaults to {@link Barcode1D#DEFAULT_BAR_FOREGROUND_COLOR}
511-
* @param background the color of the background. If <CODE>null</CODE> defaults to {@link Barcode1D#DEFAULT_BAR_BACKGROUND_COLOR}
512-
* @return the image
513-
*/
514-
public abstract java.awt.Image createAwtImage(java.awt.Color foreground, java.awt.Color background);
515-
// Android-Conversion-Skip-Block-End
516495

517496
/**
518497
* Creates a PdfFormXObject with the barcode. Default bar color and text color will be used.

barcodes/src/main/java/com/itextpdf/barcodes/Barcode39.java

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -369,50 +369,4 @@ public Rectangle placeBarcode(PdfCanvas canvas, Color barColor, Color textColor)
369369
return getBarcodeSize();
370370
}
371371

372-
// Android-Conversion-Skip-Block-Start (java.awt library isn't available on Android)
373-
/**
374-
* Creates a <CODE>java.awt.Image</CODE>. This image only
375-
* contains the bars without any text.
376-
*
377-
* @param foreground the color of the bars
378-
* @param background the color of the background
379-
* @return the image
380-
*/
381-
@Override
382-
public java.awt.Image createAwtImage(java.awt.Color foreground, java.awt.Color background) {
383-
int f = (foreground == null) ? DEFAULT_BAR_FOREGROUND_COLOR.getRGB() : foreground.getRGB();
384-
int g = (background == null) ? DEFAULT_BAR_BACKGROUND_COLOR.getRGB() : background.getRGB();
385-
java.awt.Canvas canvas = new java.awt.Canvas();
386-
String bCode = code;
387-
if (extended) {
388-
bCode = getCode39Ex(code);
389-
}
390-
if (generateChecksum) {
391-
bCode += getChecksum(bCode);
392-
}
393-
int len = bCode.length() + 2;
394-
int nn = (int) n;
395-
int fullWidth = len * (6 + 3 * nn) + (len - 1);
396-
byte[] bars = getBarsCode39(bCode);
397-
boolean print = true;
398-
int ptr = 0;
399-
int height = (int) barHeight;
400-
int[] pix = new int[fullWidth * height];
401-
for (int k = 0; k < bars.length; ++k) {
402-
int w = (bars[k] == 0 ? 1 : nn);
403-
int c = g;
404-
if (print) {
405-
c = f;
406-
}
407-
print = !print;
408-
for (int j = 0; j < w; ++j) {
409-
pix[ptr++] = c;
410-
}
411-
}
412-
for (int k = fullWidth; k < pix.length; k += fullWidth) {
413-
System.arraycopy(pix, 0, pix, k, fullWidth);
414-
}
415-
return canvas.createImage(new java.awt.image.MemoryImageSource(fullWidth, height, pix, 0, fullWidth));
416-
}
417-
// Android-Conversion-Skip-Block-End
418372
}

barcodes/src/main/java/com/itextpdf/barcodes/BarcodeCodabar.java

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -351,46 +351,4 @@ public Rectangle placeBarcode(PdfCanvas canvas, Color barColor, Color textColor)
351351
return getBarcodeSize();
352352
}
353353

354-
// Android-Conversion-Skip-Block-Start (java.awt library isn't available on Android)
355-
/**
356-
* Creates a <CODE>java.awt.Image</CODE>. This image only
357-
* contains the bars without any text.
358-
*
359-
* @param foreground the color of the bars
360-
* @param background the color of the background
361-
* @return the image
362-
*/
363-
public java.awt.Image createAwtImage(java.awt.Color foreground, java.awt.Color background) {
364-
int f = (foreground == null) ? DEFAULT_BAR_FOREGROUND_COLOR.getRGB() : foreground.getRGB();
365-
int g = (background == null) ? DEFAULT_BAR_BACKGROUND_COLOR.getRGB() : background.getRGB();
366-
java.awt.Canvas canvas = new java.awt.Canvas();
367-
368-
byte[] bars = getBarsCodabar(generateChecksum ? calculateChecksum(code) : code);
369-
int wide = 0;
370-
for (int k = 0; k < bars.length; ++k) {
371-
wide += bars[k];
372-
}
373-
int narrow = bars.length - wide;
374-
int fullWidth = narrow + wide * (int) n;
375-
boolean print = true;
376-
int ptr = 0;
377-
int height = (int) barHeight;
378-
int[] pix = new int[fullWidth * height];
379-
for (int k = 0; k < bars.length; ++k) {
380-
int w = (bars[k] == 0 ? 1 : (int) n);
381-
int c = g;
382-
if (print) {
383-
c = f;
384-
}
385-
print = !print;
386-
for (int j = 0; j < w; ++j) {
387-
pix[ptr++] = c;
388-
}
389-
}
390-
for (int k = fullWidth; k < pix.length; k += fullWidth) {
391-
System.arraycopy(pix, 0, pix, k, fullWidth);
392-
}
393-
return canvas.createImage(new java.awt.image.MemoryImageSource(fullWidth, height, pix, 0, fullWidth));
394-
}
395-
// Android-Conversion-Skip-Block-End
396354
}

barcodes/src/main/java/com/itextpdf/barcodes/BarcodeDataMatrix.java

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -275,39 +275,6 @@ public Rectangle placeBarcode(PdfCanvas canvas, Color foreground, float moduleSi
275275
return getBarcodeSize();
276276
}
277277

278-
// Android-Conversion-Skip-Block-Start (java.awt library isn't available on Android)
279-
/**
280-
* Creates a <CODE>java.awt.Image</CODE>. A successful call to the method <CODE>generate()</CODE>
281-
* before calling this method is required.
282-
*
283-
* @param foreground the color of the bars
284-
* @param background the color of the background
285-
* @return the image
286-
*/
287-
public java.awt.Image createAwtImage(java.awt.Color foreground, java.awt.Color background) {
288-
if (image == null)
289-
return null;
290-
int f = foreground.getRGB();
291-
int g = background.getRGB();
292-
java.awt.Canvas canvas = new java.awt.Canvas();
293-
294-
int w = width + 2 * ws;
295-
int h = height + 2 * ws;
296-
int[] pix = new int[w * h];
297-
int stride = (w + 7) / 8;
298-
int ptr = 0;
299-
for (int k = 0; k < h; ++k) {
300-
int p = k * stride;
301-
for (int j = 0; j < w; ++j) {
302-
int b = image[p + j / 8] & 0xff;
303-
b <<= j % 8;
304-
pix[ptr++] = (b & 0x80) == 0 ? g : f;
305-
}
306-
}
307-
java.awt.Image img = canvas.createImage(new java.awt.image.MemoryImageSource(w, h, pix, 0, w));
308-
return img;
309-
}
310-
// Android-Conversion-Skip-Block-End
311278

312279
/**
313280
* Gets the barcode size

barcodes/src/main/java/com/itextpdf/barcodes/BarcodeEAN.java

Lines changed: 0 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -801,71 +801,4 @@ public Rectangle placeBarcode(PdfCanvas canvas, Color barColor, Color textColor)
801801
return rect;
802802
}
803803

804-
// Android-Conversion-Skip-Block-Start (java.awt library isn't available on Android)
805-
/**
806-
* Creates a <CODE>java.awt.Image</CODE>. This image only
807-
* contains the bars without any text.
808-
*
809-
* @param foreground the color of the bars
810-
* @param background the color of the background
811-
* @return the image
812-
*/
813-
@Override
814-
public java.awt.Image createAwtImage(java.awt.Color foreground, java.awt.Color background) {
815-
int f = (foreground == null) ? DEFAULT_BAR_FOREGROUND_COLOR.getRGB() : foreground.getRGB();
816-
int g = (background == null) ? DEFAULT_BAR_BACKGROUND_COLOR.getRGB() : background.getRGB();
817-
java.awt.Canvas canvas = new java.awt.Canvas();
818-
819-
int width;
820-
byte bars[];
821-
switch (codeType) {
822-
case EAN13:
823-
bars = getBarsEAN13(code);
824-
width = 11 + 12 * 7;
825-
break;
826-
case EAN8:
827-
bars = getBarsEAN8(code);
828-
width = 11 + 8 * 7;
829-
break;
830-
case UPCA:
831-
bars = getBarsEAN13("0" + code);
832-
width = 11 + 12 * 7;
833-
break;
834-
case UPCE:
835-
bars = getBarsUPCE(code);
836-
width = 9 + 6 * 7;
837-
break;
838-
case SUPP2:
839-
bars = getBarsSupplemental2(code);
840-
width = 6 + 2 * 7;
841-
break;
842-
case SUPP5:
843-
bars = getBarsSupplemental5(code);
844-
width = 4 + 5 * 7 + 4 * 2;
845-
break;
846-
default:
847-
throw new PdfException("Invalid code type");
848-
}
849-
850-
boolean print = true;
851-
int ptr = 0;
852-
int height = (int) barHeight;
853-
int[] pix = new int[width * height];
854-
for (int k = 0; k < bars.length; ++k) {
855-
int w = bars[k];
856-
int c = g;
857-
if (print) {
858-
c = f;
859-
}
860-
print = !print;
861-
for (int j = 0; j < w; ++j) {
862-
pix[ptr++] = c;
863-
}
864-
}
865-
for (int k = width; k < pix.length; k += width) {
866-
System.arraycopy(pix, 0, pix, k, width);
867-
}
868-
return canvas.createImage(new java.awt.image.MemoryImageSource(width, height, pix, 0, width));
869-
}
870-
// Android-Conversion-Skip-Block-End
871804
}

barcodes/src/main/java/com/itextpdf/barcodes/BarcodeEANSUPP.java

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -128,18 +128,4 @@ public Rectangle placeBarcode(PdfCanvas canvas, Color barColor, Color textColor)
128128
return getBarcodeSize();
129129
}
130130

131-
// Android-Conversion-Skip-Block-Start (java.awt library isn't available on Android)
132-
/**
133-
* Creates a <CODE>java.awt.Image</CODE>. This image only
134-
* contains the bars without any text.
135-
*
136-
* @param foreground the color of the bars
137-
* @param background the color of the background
138-
* @return the image
139-
*/
140-
@Override
141-
public java.awt.Image createAwtImage(java.awt.Color foreground, java.awt.Color background) {
142-
throw new UnsupportedOperationException(BarcodesExceptionMessageConstant.TWO_BARCODE_MUST_BE_EXTERNALLY);
143-
}
144-
// Android-Conversion-Skip-Block-End
145131
}

0 commit comments

Comments
 (0)