Skip to content

Commit

Permalink
Migrating changes from our branch to openPDF Part I (#853)
Browse files Browse the repository at this point in the history
* Migrating changes from our branch to openPDF Part I

* 2nd Batch of changes

* Fixed checkstyle + junit

* Fixing checkstyle and lift

* lift stuff

* lift stuff II

* hopefully last lift change

* Corrected prop_build OS

* Another round of lift adaptions

* Fixing lift error

* Fixed yet another lift find (but was not caused by us)

* neverending Lift issues

* Fixed checkstyle

* Yet another lift thing

* Neverending story with Lift

* Neverending Lift
  • Loading branch information
Lonzak authored Nov 1, 2023
1 parent 1d970b9 commit b9a3ea1
Show file tree
Hide file tree
Showing 32 changed files with 1,970 additions and 250 deletions.
42 changes: 42 additions & 0 deletions openpdf/src/main/java/com/lowagie/text/Document.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@

import com.lowagie.text.error_messages.MessageLocalization;
import com.lowagie.text.pdf.FopGlyphProcessor;
import com.lowagie.text.pdf.PdfDate;

import java.io.IOException;
import java.io.InputStream;
Expand Down Expand Up @@ -663,6 +664,47 @@ public boolean addCreationDate() {
throw new ExceptionConverter(de);
}
}

/**
* Adds the current date and time to a Document.
*
* @return <CODE>true</CODE> if successful, <CODE>false</CODE> otherwise
*/
public boolean addCreationDate(PdfDate date) {
try {
return add(new Meta(Element.CREATIONDATE, date.toString()));
}
catch (DocumentException de) {
throw new ExceptionConverter(de);
}
}

/**
* Adds the current date and time to a Document.
*
* @return <CODE>true</CODE> if successful, <CODE>false</CODE> otherwise
*/
public boolean addModificationDate() {
try {
return add(new Meta(Element.MODIFICATIONDATE, new PdfDate().toString()));
} catch (DocumentException de) {
throw new ExceptionConverter(de);
}
}

/**
* Adds the current date and time to a Document.
*
* @return <CODE>true</CODE> if successful, <CODE>false</CODE> otherwise
*/
public boolean addModificationDate(PdfDate date) {
try {
return add(new Meta(Element.MODIFICATIONDATE, date.toString()));
}
catch (DocumentException de) {
throw new ExceptionConverter(de);
}
}

// methods to get the layout of the document.

Expand Down
110 changes: 57 additions & 53 deletions openpdf/src/main/java/com/lowagie/text/Element.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,111 +79,114 @@ public interface Element {
// static membervariables (meta information)

/** This is a possible type of <CODE>Element</CODE>. */
int HEADER = 0;
public static final int HEADER = 0;

/** This is a possible type of <CODE>Element</CODE>. */
int TITLE = 1;
public static final int TITLE = 1;

/** This is a possible type of <CODE>Element</CODE>. */
int SUBJECT = 2;
public static final int SUBJECT = 2;

/** This is a possible type of <CODE>Element</CODE>. */
int KEYWORDS = 3;
public static final int KEYWORDS = 3;

/** This is a possible type of <CODE>Element </CODE>. */
int AUTHOR = 4;
public static final int AUTHOR = 4;

/** This is a possible type of <CODE>Element </CODE>. */
int PRODUCER = 5;
public static final int PRODUCER = 5;

/** This is a possible type of <CODE>Element </CODE>. */
int CREATIONDATE = 6;
public static final int CREATIONDATE = 6;

/** This is a possible type of <CODE>Element </CODE>. */
int CREATOR = 7;
public static final int CREATOR = 7;

/** This is a possible type of <CODE>Element </CIDE>. */
public static final int MODIFICATIONDATE = 8;

// static membervariables (content)

/** This is a possible type of <CODE>Element</CODE>. */
int CHUNK = 10;
public static final int CHUNK = 10;

/** This is a possible type of <CODE>Element</CODE>. */
int PHRASE = 11;
public static final int PHRASE = 11;

/** This is a possible type of <CODE>Element</CODE>. */
int PARAGRAPH = 12;
public static final int PARAGRAPH = 12;

/** This is a possible type of <CODE>Element</CODE> */
int SECTION = 13;
public static final int SECTION = 13;

/** This is a possible type of <CODE>Element</CODE> */
int LIST = 14;
public static final int LIST = 14;

/** This is a possible type of <CODE>Element</CODE> */
int LISTITEM = 15;
public static final int LISTITEM = 15;

/** This is a possible type of <CODE>Element</CODE> */
int CHAPTER = 16;
public static final int CHAPTER = 16;

/** This is a possible type of <CODE>Element</CODE> */
int ANCHOR = 17;
public static final int ANCHOR = 17;

// static membervariables (tables)

/** This is a possible type of <CODE>Element</CODE>. */
int CELL = 20;
public static final int CELL = 20;

/** This is a possible type of <CODE>Element</CODE>. */
int ROW = 21;
public static final int ROW = 21;

/** This is a possible type of <CODE>Element</CODE>. */
int TABLE = 22;
public static final int TABLE = 22;

/** This is a possible type of <CODE>Element</CODE>. */
int PTABLE = 23;
public static final int PTABLE = 23;

// static membervariables (annotations)

/** This is a possible type of <CODE>Element</CODE>. */
int ANNOTATION = 29;
public static final int ANNOTATION = 29;

// static membervariables (geometric figures)

/** This is a possible type of <CODE>Element</CODE>. */
int RECTANGLE = 30;
public static final int RECTANGLE = 30;

/** This is a possible type of <CODE>Element</CODE>. */
int JPEG = 32;
public static final int JPEG = 32;

/** This is a possible type of <CODE>Element</CODE>. */
int JPEG2000 = 33;
public static final int JPEG2000 = 33;

/** This is a possible type of <CODE>Element</CODE>. */
int IMGRAW = 34;
public static final int IMGRAW = 34;

/** This is a possible type of <CODE>Element</CODE>. */
int IMGTEMPLATE = 35;
public static final int IMGTEMPLATE = 35;

/**
* This is a possible type of <CODE>Element</CODE>.
* @since 2.1.5
*/
int JBIG2 = 36;
public static final int JBIG2 = 36;

/** This is a possible type of <CODE>Element</CODE>. */
int MULTI_COLUMN_TEXT = 40;
public static final int MULTI_COLUMN_TEXT = 40;

/** This is a possible type of <CODE>Element</CODE>. */
int MARKED = 50;
public static final int MARKED = 50;

/** This is a possible type of <CODE>Element</CODE>.
* @since 2.1.2
*/
int YMARK = 55;
public static final int YMARK = 55;

/** This is a possible type of <CODE>Element</CODE>.
*/
int FOOTNOTE = 56;
public static final int FOOTNOTE = 56;

// static membervariables (alignment)

Expand All @@ -192,106 +195,106 @@ public interface Element {
* aligned to the left indent and extra whitespace should be placed on the
* right.
*/
int ALIGN_UNDEFINED = -1;
public static final int ALIGN_UNDEFINED = -1;

/**
* A possible value for paragraph alignment. This specifies that the text is
* aligned to the left indent and extra whitespace should be placed on the
* right.
*/
int ALIGN_LEFT = 0;
public static final int ALIGN_LEFT = 0;

/**
* A possible value for paragraph alignment. This specifies that the text is
* aligned to the center and extra whitespace should be placed equally on
* the left and right.
*/
int ALIGN_CENTER = 1;
public static final int ALIGN_CENTER = 1;

/**
* A possible value for paragraph alignment. This specifies that the text is
* aligned to the right indent and extra whitespace should be placed on the
* left.
*/
int ALIGN_RIGHT = 2;
public static final int ALIGN_RIGHT = 2;

/**
* A possible value for paragraph alignment. This specifies that extra
* whitespace should be spread out through the rows of the paragraph with
* the text lined up with the left and right indent except on the last line
* which should be aligned to the left.
*/
int ALIGN_JUSTIFIED = 3;
public static final int ALIGN_JUSTIFIED = 3;

/**
* A possible value for vertical alignment.
*/

int ALIGN_TOP = 4;
public static final int ALIGN_TOP = 4;

/**
* A possible value for vertical alignment.
*/

int ALIGN_MIDDLE = 5;
public static final int ALIGN_MIDDLE = 5;

/**
* A possible value for vertical alignment.
*/

int ALIGN_BOTTOM = 6;
public static final int ALIGN_BOTTOM = 6;

/**
* A possible value for vertical alignment.
*/
int ALIGN_BASELINE = 7;
public static final int ALIGN_BASELINE = 7;

/**
* Does the same as ALIGN_JUSTIFIED but the last line is also spread out.
*/
int ALIGN_JUSTIFIED_ALL = 8;
public static final int ALIGN_JUSTIFIED_ALL = 8;

// static member variables for CCITT compression

/**
* Pure two-dimensional encoding (Group 4)
*/
int CCITTG4 = 0x100;
public static final int CCITTG4 = 0x100;

/**
* Pure one-dimensional encoding (Group 3, 1-D)
*/
int CCITTG3_1D = 0x101;
public static final int CCITTG3_1D = 0x101;

/**
* Mixed one- and two-dimensional encoding (Group 3, 2-D)
*/
int CCITTG3_2D = 0x102;
public static final int CCITTG3_2D = 0x102;

/**
* A flag indicating whether 1-bits are to be interpreted as black pixels
* and 0-bits as white pixels,
*/
int CCITT_BLACKIS1 = 1;
public static final int CCITT_BLACKIS1 = 1;

/**
* A flag indicating whether the filter expects extra 0-bits before each
* encoded line so that the line begins on a byte boundary.
*/
int CCITT_ENCODEDBYTEALIGN = 2;
public static final int CCITT_ENCODEDBYTEALIGN = 2;

/**
* A flag indicating whether end-of-line bit patterns are required to be
* present in the encoding.
*/
int CCITT_ENDOFLINE = 4;
public static final int CCITT_ENDOFLINE = 4;

/**
* A flag indicating whether the filter expects the encoded data to be
* terminated by an end-of-block pattern, overriding the Rows parameter. The
* use of this flag will set the key /EndOfBlock to false.
*/
int CCITT_ENDOFBLOCK = 8;
public static final int CCITT_ENDOFBLOCK = 8;

// methods

Expand All @@ -312,7 +315,7 @@ public interface Element {
* @return a type
*/

int type();
public int type();

/**
* Checks if this element is a content object.
Expand All @@ -321,29 +324,30 @@ public interface Element {
* @return true if this is a 'content' element; false if this is a 'metadata' element
*/

boolean isContent();
public boolean isContent();

/**
* Checks if this element is nestable.
* @since iText 2.0.8
* @return true if this element can be nested inside other elements.
*/

boolean isNestable();
public boolean isNestable();

/**
* Gets all the chunks in this element.
*
* @return an <CODE>ArrayList</CODE>
*/

ArrayList<Element> getChunks();
public ArrayList<Element> getChunks();

/**
* Gets the content of the text element.
*
* @return a type
*/

String toString();
@Override
public String toString();
}
2 changes: 1 addition & 1 deletion openpdf/src/main/java/com/lowagie/text/html/WebColors.java
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ private static double toDegrees(String hueString) {
* @param hue Hue angle in degrees
* @param saturation saturation (0 to 1)
* @param lightness lightness (0 to 1)
* @return
* @return int[] rgb
*/
private static int[] hsl2rgb(float hue, float saturation, float lightness) {
int[] rgb = new int[3];
Expand Down
Loading

0 comments on commit b9a3ea1

Please sign in to comment.