Skip to content

Commit

Permalink
[RELEASE] merging 'release/7.0.5' into 'master'
Browse files Browse the repository at this point in the history
  • Loading branch information
amedee committed Oct 26, 2017
2 parents 7d045d4 + 910af67 commit 1ad59bf
Show file tree
Hide file tree
Showing 368 changed files with 10,517 additions and 3,427 deletions.
92 changes: 46 additions & 46 deletions barcodes/pom.xml
Original file line number Diff line number Diff line change
@@ -1,51 +1,51 @@
<?xml version="1.0"?>
<?xml version="1.0" encoding="UTF-8"?>
<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">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>com.itextpdf</groupId>
<artifactId>root</artifactId>
<version>7.0.4</version>
</parent>

<artifactId>barcodes</artifactId>
<name>iText 7 - barcodes</name>
<url>http://itextpdf.com/</url>
<modelVersion>4.0.0</modelVersion>

<dependencies>
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>pdftest</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>kernel</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<parent>
<groupId>com.itextpdf</groupId>
<artifactId>root</artifactId>
<version>7.0.5</version>
</parent>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<groups>${unittests}</groups>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<includes>
<include>**/*Test.java</include>
</includes>
<groups>${integrationtests}</groups>
</configuration>
</plugin>
</plugins>
</build>
<artifactId>barcodes</artifactId>

<name>iText 7 - barcodes</name>
<url>http://itextpdf.com/</url>

<dependencies>
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>kernel</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>pdftest</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<groups>${unittests}</groups>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<includes>
<include>**/*Test.java</include>
</includes>
<groups>${integrationtests}</groups>
</configuration>
</plugin>
</plugins>
</build>
</project>
16 changes: 9 additions & 7 deletions barcodes/src/main/java/com/itextpdf/barcodes/Barcode128.java
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ public class Barcode128 extends Barcode1D {

/**
* Creates new Barcode128
* @param document The document
*/
public Barcode128(PdfDocument document) {
super(document);
Expand Down Expand Up @@ -252,8 +253,8 @@ public Barcode128CodeSet getCodeSet() {

/**
* Removes the FNC1 codes in the text.
* @param code the text to clean
* @return the cleaned text
* @param code The text to clean
* @return The cleaned text
*/
public static String removeFNC1(String code) {
int len = code.length();
Expand Down Expand Up @@ -531,8 +532,9 @@ public Rectangle getBarcodeSize() {
* Places the barcode in a <CODE>PdfCanvas</CODE>. The
* barcode is always placed at coordinates (0, 0). Use the
* translation matrix to move it elsewhere.<p>
* The bars and text are written in the following colors:<p>
* <P><TABLE BORDER=1>
* The bars and text are written in the following colors:
* <br>
* <TABLE BORDER=1 SUMMARY="barcode properties">
* <TR>
* <TH><P><CODE>barColor</CODE></TH>
* <TH><P><CODE>textColor</CODE></TH>
Expand Down Expand Up @@ -656,7 +658,7 @@ public Rectangle placeBarcode(PdfCanvas canvas, Color barColor, Color textColor)
/**
* Sets the code to generate. If it's an UCC code and starts with '(' it will
* be split by the AI. This code in UCC mode is valid:
* <p/>
* <br>
* <code>(01)00000090311314(10)ABC123(15)060916</code>
*
* @param code the code to generate
Expand Down Expand Up @@ -711,8 +713,8 @@ public void setCode(String code) {
*/
@Override
public java.awt.Image createAwtImage(java.awt.Color foreground, java.awt.Color background) {
int f = foreground.getRGB();
int g = background.getRGB();
int f = (foreground == null) ? DEFAULT_BAR_FOREGROUND_COLOR.getRGB() : foreground.getRGB();
int g = (background == null) ? DEFAULT_BAR_BACKGROUND_COLOR.getRGB() : background.getRGB();
java.awt.Canvas canvas = new java.awt.Canvas();
String bCode;
if (codeType == CODE128_RAW) {
Expand Down
28 changes: 20 additions & 8 deletions barcodes/src/main/java/com/itextpdf/barcodes/Barcode1D.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,15 @@ public abstract class Barcode1D {
public static final int ALIGN_RIGHT = 2;
public static final int ALIGN_CENTER = 3;

/**
* The default color to draw if a bar is present.
*/
protected final java.awt.Color DEFAULT_BAR_FOREGROUND_COLOR = java.awt.Color.BLACK;
/**
* The default color to draw if a bar is not present.
*/
protected final java.awt.Color DEFAULT_BAR_BACKGROUND_COLOR = java.awt.Color.WHITE;

protected PdfDocument document;

/**
Expand Down Expand Up @@ -413,8 +422,9 @@ public void setCodeType(int codeType) {
* Places the barcode in a <CODE>PdfCanvas</CODE>. The
* barcode is always placed at coordinates (0, 0). Use the
* translation matrix to move it elsewhere.<p>
* The bars and text are written in the following colors:<p>
* <P><TABLE BORDER=1>
* The bars and text are written in the following colors:
* <br>
* <TABLE BORDER=1 SUMMARY="barcode properties">
* <TR>
* <TH><P><CODE>barColor</CODE></TH>
* <TH><P><CODE>textColor</CODE></TH>
Expand Down Expand Up @@ -492,16 +502,16 @@ public void setAltText(String altText) {
* Creates a <CODE>java.awt.Image</CODE>. This image only
* contains the bars without any text.
*
* @param foreground the color of the bars
* @param background the color of the background
* @param foreground the color of the bars. If <CODE>null</CODE> defaults to {@link Barcode1D#DEFAULT_BAR_FOREGROUND_COLOR}
* @param background the color of the background. If <CODE>null</CODE> defaults to {@link Barcode1D#DEFAULT_BAR_BACKGROUND_COLOR}
* @return the image
*/
public abstract java.awt.Image createAwtImage(java.awt.Color foreground, java.awt.Color background);

/**
* Creates a PdfFormXObject with the barcode. Default bar color and text color will be used.
*
* @return the XObject
* @param document The document
* @return The XObject
* @see #createFormXObject(Color, Color, PdfDocument)
*/
public PdfFormXObject createFormXObject(PdfDocument document) {
Expand All @@ -511,8 +521,9 @@ public PdfFormXObject createFormXObject(PdfDocument document) {
/**
* Creates a PdfFormXObject with the barcode.
*
* @param barColor the color of the bars. It can be <CODE>null</CODE>
* @param textColor the color of the text. It can be <CODE>null</CODE>
* @param barColor The color of the bars. It can be <CODE>null</CODE>
* @param textColor The color of the text. It can be <CODE>null</CODE>
* @param document The document
* @return the XObject
* @see #placeBarcode(PdfCanvas canvas, Color barColor, Color textColor)
*/
Expand All @@ -527,6 +538,7 @@ public PdfFormXObject createFormXObject(Color barColor, Color textColor, PdfDocu
/**
* Make the barcode occupy the specified width.
* Usually this is achieved by adjusting bar widths.
* @param width The width
*/
public void fitWidth(float width) {
setX(x * width / getBarcodeSize().getWidth());
Expand Down
4 changes: 3 additions & 1 deletion barcodes/src/main/java/com/itextpdf/barcodes/Barcode2D.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ public abstract class Barcode2D {
* Creates a PdfFormXObject with the barcode.
* Default foreground color will be used.
*
* @param document The document
* @return the XObject.
*/
public PdfFormXObject createFormXObject(PdfDocument document) {
Expand All @@ -85,7 +86,8 @@ public PdfFormXObject createFormXObject(PdfDocument document) {
/**
* Creates a PdfFormXObject with the barcode.
*
* @param foreground the color of the pixels. It can be <CODE>null</CODE>
* @param foreground The color of the pixels. It can be <CODE>null</CODE>
* @param document The document
* @return the XObject.
*/
public abstract PdfFormXObject createFormXObject(Color foreground, PdfDocument document);
Expand Down
10 changes: 6 additions & 4 deletions barcodes/src/main/java/com/itextpdf/barcodes/Barcode39.java
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ public class Barcode39 extends Barcode1D {

/**
* Creates a new Barcode39.
* @param document The document
*/
public Barcode39(PdfDocument document) {
super(document);
Expand Down Expand Up @@ -258,8 +259,9 @@ public Rectangle getBarcodeSize() {
* Places the barcode in a <CODE>PdfCanvas</CODE>. The
* barcode is always placed at coordinates (0, 0). Use the
* translation matrix to move it elsewhere.<p>
* The bars and text are written in the following colors:<p>
* <P><TABLE BORDER=1>
* The bars and text are written in the following colors:
* <br>
* <TABLE BORDER=1 SUMMARY="barcode properties">
* <TR>
* <TH><P><CODE>barColor</CODE></TH>
* <TH><P><CODE>textColor</CODE></TH>
Expand Down Expand Up @@ -382,8 +384,8 @@ public Rectangle placeBarcode(PdfCanvas canvas, Color barColor, Color textColor)
*/
@Override
public Image createAwtImage(java.awt.Color foreground, java.awt.Color background) {
int f = foreground.getRGB();
int g = background.getRGB();
int f = (foreground == null) ? DEFAULT_BAR_FOREGROUND_COLOR.getRGB() : foreground.getRGB();
int g = (background == null) ? DEFAULT_BAR_BACKGROUND_COLOR.getRGB() : background.getRGB();
java.awt.Canvas canvas = new java.awt.Canvas();
String bCode = code;
if (extended) {
Expand Down
10 changes: 6 additions & 4 deletions barcodes/src/main/java/com/itextpdf/barcodes/BarcodeCodabar.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ public class BarcodeCodabar extends Barcode1D {

/**
* Creates a new BarcodeCodabar.
* @param document The document
*/
public BarcodeCodabar(PdfDocument document) {
super(document);
Expand Down Expand Up @@ -191,8 +192,9 @@ public Rectangle getBarcodeSize() {
* Places the barcode in a <CODE>PdfCanvas</CODE>. The
* barcode is always placed at coordinates (0, 0). Use the
* translation matrix to move it elsewhere.<p>
* The bars and text are written in the following colors:<p>
* <P><TABLE BORDER=1>
* The bars and text are written in the following colors:
* <br>
* <TABLE BORDER=1 SUMMARY="barcode properties">
* <TR>
* <TH><P><CODE>barColor</CODE></TH>
* <TH><P><CODE>textColor</CODE></TH>
Expand Down Expand Up @@ -311,8 +313,8 @@ public Rectangle placeBarcode(PdfCanvas canvas, Color barColor, Color textColor)
* @return the image
*/
public java.awt.Image createAwtImage(java.awt.Color foreground, java.awt.Color background) {
int f = foreground.getRGB();
int g = background.getRGB();
int f = (foreground == null) ? DEFAULT_BAR_FOREGROUND_COLOR.getRGB() : foreground.getRGB();
int g = (background == null) ? DEFAULT_BAR_BACKGROUND_COLOR.getRGB() : background.getRGB();
java.awt.Canvas canvas = new java.awt.Canvas();

byte[] bars = getBarsCodabar(generateChecksum ? calculateChecksum(code) : code);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,9 @@ public PdfFormXObject createFormXObject(Color foreground, PdfDocument document)
/**
* Creates a PdfFormXObject with the barcode with given module width and module height.
*
* @param foreground the color of the pixels. It can be <CODE>null</CODE>
* @param moduleSide the side (width and height) of the pixels.
* @param foreground The color of the pixels. It can be <CODE>null</CODE>
* @param moduleSide The side (width and height) of the pixels.
* @param document The document
* @return the XObject.
*/
public PdfFormXObject createFormXObject(Color foreground, float moduleSide, PdfDocument document) {
Expand Down Expand Up @@ -302,6 +303,9 @@ public java.awt.Image createAwtImage(java.awt.Color foreground, java.awt.Color b

/**
* Gets the barcode size
* @param moduleHeight The height of the module
* @param moduleWidth The width of the module
* @return The size of the barcode
*/
public Rectangle getBarcodeSize(float moduleHeight, float moduleWidth) {
return new Rectangle(0, 0, (width + 2 * ws) * moduleHeight, (height + 2 * ws) * moduleWidth);
Expand All @@ -312,7 +316,7 @@ public Rectangle getBarcodeSize(float moduleHeight, float moduleWidth) {
*
* @param text the text
* @return the status of the generation. It can be one of this values:
* <p/>
*
* <CODE>DM_NO_ERROR</CODE> - no error.<br>
* <CODE>DM_ERROR_TEXT_TOO_BIG</CODE> - the text is too big for the symbology capabilities.<br>
* <CODE>DM_ERROR_INVALID_SQUARE</CODE> - the dimensions given for the symbol are illegal.<br>
Expand All @@ -335,7 +339,7 @@ public int setCode(String text) {
* @param textOffset the offset to the start of the text
* @param textSize the text size
* @return the status of the generation. It can be one of this values:
* <p/>
*
* <CODE>DM_NO_ERROR</CODE> - no error.<br>
* <CODE>DM_ERROR_TEXT_TOO_BIG</CODE> - the text is too big for the symbology capabilities.<br>
* <CODE>DM_ERROR_INVALID_SQUARE</CODE> - the dimensions given for the symbol are illegal.<br>
Expand Down Expand Up @@ -406,7 +410,7 @@ public int getHeight() {

/**
* Sets the height of the barcode. If the height is zero it will be calculated. This height doesn't include the whitespace border, if any.
* <p/>
*
* The allowed dimensions are (height, width):<p>
* 10, 10<br>
* 12, 12<br>
Expand Down Expand Up @@ -457,7 +461,7 @@ public int getWidth() {

/**
* Sets the width of the barcode. If the width is zero it will be calculated. This width doesn't include the whitespace border, if any.
* <p/>
*
* The allowed dimensions are (height, width):<p>
* 10, 10<br>
* 12, 12<br>
Expand Down Expand Up @@ -535,7 +539,7 @@ public int getOptions() {
* <CODE>DM_X12</CODE> - X12 encodation<br>
* <CODE>DM_EDIFACT</CODE> - EDIFACT encodation<br>
* <CODE>DM_RAW</CODE> - no encodation. The bytes provided are already encoded and will be added directly to the barcode, using padding if needed. It assumes that the encodation state is left at ASCII after the last byte.<br>
* <p/>
* <br>
* One of:<br>
* <CODE>DM_EXTENSION</CODE> - allows extensions to be embedded at the start of the text:<p>
* exxxxxx - ECI number xxxxxx<br>
Expand Down
10 changes: 6 additions & 4 deletions barcodes/src/main/java/com/itextpdf/barcodes/BarcodeEAN.java
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ public class BarcodeEAN extends Barcode1D {

/**
* Creates new BarcodeEAN
* @param document The document
*/
public BarcodeEAN(PdfDocument document) {
super(document);
Expand Down Expand Up @@ -541,8 +542,9 @@ public Rectangle getBarcodeSize() {
* Places the barcode in a <CODE>PdfCanvas</CODE>. The
* barcode is always placed at coordinates (0, 0). Use the
* translation matrix to move it elsewhere.<p>
* The bars and text are written in the following colors:<p>
* <P><TABLE BORDER=1>
* The bars and text are written in the following colors:
* <br>
* <TABLE BORDER=1 SUMMARY="barcode properties">
* <TR>
* <TH><P><CODE>barColor</CODE></TH>
* <TH><P><CODE>textColor</CODE></TH>
Expand Down Expand Up @@ -729,8 +731,8 @@ public Rectangle placeBarcode(PdfCanvas canvas, Color barColor, Color textColor)
*/
@Override
public Image createAwtImage(java.awt.Color foreground, java.awt.Color background) {
int f = foreground.getRGB();
int g = background.getRGB();
int f = (foreground == null) ? DEFAULT_BAR_FOREGROUND_COLOR.getRGB() : foreground.getRGB();
int g = (background == null) ? DEFAULT_BAR_BACKGROUND_COLOR.getRGB() : background.getRGB();
java.awt.Canvas canvas = new java.awt.Canvas();

int width;
Expand Down
Loading

0 comments on commit 1ad59bf

Please sign in to comment.