Skip to content

Commit

Permalink
Merge pull request LibrePDF#1122 from LibrePDF/merge/1.3-in-1.4
Browse files Browse the repository at this point in the history
Merge 1.3 into 1.4
  • Loading branch information
asturio authored Mar 30, 2024
2 parents c66761f + 70a95c0 commit 6a197d5
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 59 deletions.
2 changes: 1 addition & 1 deletion changelogs/1.3.37.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

## Changes

* OpenPDF 1.3.37 requires Java 11.
* OpenPDF 1.3.37 requires Java 11.
1 change: 0 additions & 1 deletion openpdf/src/main/java/com/lowagie/text/StandardFonts.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ public enum StandardFonts {
HELVETICA_ITALIC(Font.HELVETICA, Font.ITALIC),
HELVETICA_BOLD(Font.HELVETICA, Font.BOLD),
HELVETICA_BOLDITALIC(Font.HELVETICA, Font.BOLDITALIC),

// Times
TIMES(Font.TIMES_ROMAN, Font.NORMAL),
TIMES_ITALIC(Font.TIMES_ROMAN, Font.ITALIC),
Expand Down
1 change: 0 additions & 1 deletion openpdf/src/main/java/com/lowagie/text/html/Markup.java
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,6 @@ public static float parseLength(String string, float actualFontSize) {
return fs.getScale() * DEFAULT_FONT_SIZE;
}
}

int pos = 0;
int length = string.length();
boolean ok = true;
Expand Down
6 changes: 3 additions & 3 deletions openpdf/src/main/java/com/lowagie/text/pdf/AcroFields.java
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,7 @@ public boolean renameField(String oldName, String newName) {
}

public void decodeGenericDictionary(PdfDictionary merged, BaseField tx) throws DocumentException {
int flags = 0;
int flags;
// the text size and color
PdfString da = merged.getAsString(PdfName.DA);
if (da != null) {
Expand Down Expand Up @@ -2398,7 +2398,7 @@ public PdfPKCS7 verifySignature(String name, String provider) {
try {
PdfName sub = v.getAsName(PdfName.SUBFILTER);
PdfString contents = v.getAsString(PdfName.CONTENTS);
PdfPKCS7 pk = null;
PdfPKCS7 pk;
if (sub.equals(PdfName.ADBE_X509_RSA_SHA1)) {
PdfString cert = v.getAsString(PdfName.CERT);
pk = new PdfPKCS7(contents.getOriginalBytes(), cert.getBytes(), provider);
Expand Down Expand Up @@ -2835,7 +2835,7 @@ public static class Item {
/**
* The indirect reference of the item itself
*/
private PdfIndirectReference fieldReference;
private final PdfIndirectReference fieldReference;

public Item(PdfIndirectReference ref) {
this.fieldReference = ref;
Expand Down
53 changes: 2 additions & 51 deletions openpdf/src/main/java/com/lowagie/text/pdf/PdfWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -487,10 +487,6 @@ public class PdfWriter extends DocWriter implements
* Use bidirectional reordering with right-to-left preferential run direction.
*/
public static final int RUN_DIRECTION_RTL = 3;

// [C3] PdfViewerPreferences interface

// page layout (section 13.1.1 of "iText in Action")
/**
* Mask to separate the encryption type from the encryption mode.
*/
Expand All @@ -515,8 +511,6 @@ public class PdfWriter extends DocWriter implements
* The direct content under in this document.
*/
protected PdfContentByte directContentUnder;

// page mode (section 13.1.2 of "iText in Action")
/**
* body of the PDF document
*/
Expand All @@ -543,8 +537,6 @@ public class PdfWriter extends DocWriter implements
* @since 2.1.5
*/
protected PdfName tabs = null;

// values for setting viewer preferences in iText versions older than 2.x
/**
* A number referring to the previous Cross-Reference Table.
*/
Expand Down Expand Up @@ -598,14 +590,10 @@ public class PdfWriter extends DocWriter implements
* The color number counter for the colors in the document.
*/
protected int colorNumber = 1;

// [C4] Page labels
/**
* The patterns of this document
*/
protected HashMap<PdfPatternPainter, PdfName> documentPatterns = new HashMap<>();

// [C5] named objects: named destinations, javascript, embedded files
/**
* The pattern number counter for the colors in the document.
*/
Expand All @@ -632,8 +620,6 @@ public class PdfWriter extends DocWriter implements
* The RBGroups array in an OCG dictionary
*/
protected PdfArray OCGRadioGroup = new PdfArray();

// [C6] Actions (open and additional)
/**
* The locked array in an OCG dictionary
*
Expand All @@ -651,11 +637,7 @@ public class PdfWriter extends DocWriter implements
protected HashMap<ColorDetails, ColorDetails> documentSpotPatterns = new HashMap<>();
protected ColorDetails patternColorspaceRGB;
protected ColorDetails patternColorspaceGRAY;

// [C7] portable collections
protected ColorDetails patternColorspaceCMYK;

// [C8] AcroForm
/**
* Dictionary, containing all the images of the PDF document
*/
Expand Down Expand Up @@ -690,8 +672,6 @@ public class PdfWriter extends DocWriter implements
protected PdfWriter() {
}

// [C9] Metadata

/**
* Constructs a <CODE>PdfWriter</CODE>.
* <p>
Expand Down Expand Up @@ -911,8 +891,6 @@ public PdfIndirectObject addToBody(PdfObject object, boolean inObjStm) throws IO
return body.add(object, inObjStm);
}

// [C11] Output intents

/**
* Use this method to add a PDF object to the PDF body. Use this method only if you know what you're doing!
*
Expand Down Expand Up @@ -964,12 +942,6 @@ public PdfIndirectObject addToBody(PdfObject object, int refNumber, boolean inOb
return body.add(object, refNumber, inObjStm);
}

// PDF Objects that have an impact on the PDF body

// [F1] PdfEncryptionSettings interface

// types of encryption

/**
* Use this to get an <CODE>PdfIndirectReference</CODE> for an object that will be created in the future. Use this
* method only if you know what you're doing!
Expand Down Expand Up @@ -1018,8 +990,6 @@ protected PdfDictionary getCatalog(PdfIndirectReference rootObj) {
}
return catalog;
}
// ENCRYPTION_* = 3 reserved for implementation of the
// meanwhile deprecated proprietary AES256 variant by Adobe

/**
* Sets extra keys to the catalog.
Expand Down Expand Up @@ -1085,8 +1055,6 @@ public PdfIndirectReference getPageReference(int page) {
return ref;
}

// permissions

/**
* Gets the pagenumber of this document. This number can be different from the real pagenumber, if you have (re)set
* the page number previously.
Expand Down Expand Up @@ -1387,8 +1355,6 @@ public PdfOutline getRootOutline() {
return directContent.getRootOutline();
}

// [F2] compression

/**
* Sets the bookmarks. The list structure is defined in {@link SimpleBookmark}.
*
Expand All @@ -1415,6 +1381,7 @@ protected void writeOutlines(PdfDictionary catalog, boolean namedAsNames) throws
/**
* @see com.lowagie.text.pdf.interfaces.PdfVersion#setAtLeastPdfVersion(char)
*/
@Override
public void setAtLeastPdfVersion(char version) {
pdf_version.setAtLeastPdfVersion(version);
}
Expand Down Expand Up @@ -1477,8 +1444,6 @@ public void setPageLabels(PdfPageLabels pageLabels) {
pdf.setPageLabels(pageLabels);
}

// [F4] adding (and releasing) form XObjects

/**
* Adds named destinations in bulk. Valid keys and values of the map can be found in the map that is created by
* SimpleNamedDestination.
Expand Down Expand Up @@ -1538,8 +1503,6 @@ public void addJavaScript(String code, boolean unicode) {
addJavaScript(PdfAction.javaScript(code, this, unicode));
}

// [F5] adding pages imported form other PDF documents

/**
* Use this method to adds a JavaScript action at the document level. When the document opens, all this JavaScript
* runs.
Expand Down Expand Up @@ -1621,8 +1584,6 @@ public void addFileAttachment(PdfFileSpecification fs) throws IOException {
addFileAttachment(null, fs);
}

// [F6] spot colors

/**
* @see com.lowagie.text.pdf.interfaces.PdfDocumentActions#setOpenAction(java.lang.String)
*/
Expand Down Expand Up @@ -1666,8 +1627,6 @@ public void setCollection(PdfCollection collection) {
pdf.setCollection(collection);
}

// [F7] document patterns

/**
* @see com.lowagie.text.pdf.interfaces.PdfAnnotations#getAcroForm()
*/
Expand Down Expand Up @@ -1706,8 +1665,6 @@ public void setSigFlags(int f) {
pdf.setSigFlags(f);
}

// [F9] document shadings

/**
* Use this method to set the XMP Metadata.
*
Expand All @@ -1726,8 +1683,6 @@ public void setPageXmpMetadata(byte[] xmpMetadata) {
pdf.setXmpMetadata(xmpMetadata);
}

// [F10] extended graphics state (for instance for transparency)

/**
* Use this method to creates XMP Metadata based on the metadata in the PdfDocument.
*/
Expand All @@ -1749,8 +1704,6 @@ private byte[] createXmpMetadataBytes() {
return baos.toByteArray();
}

// [F11] adding properties (OCG, marked content)

/**
* @see com.lowagie.text.pdf.interfaces.PdfXConformance#getPDFXConformance()
*/
Expand Down Expand Up @@ -1904,8 +1857,6 @@ PdfEncryption getEncryption() {
return crypto;
}

// [F13] Optional Content Groups

/**
* @see com.lowagie.text.pdf.interfaces.PdfEncryptionSettings#setEncryption(byte[], byte[], int, int)
*/
Expand Down Expand Up @@ -3344,7 +3295,7 @@ public boolean equals(Object obj) {
if (!(obj instanceof PdfCrossReference)) {
return false;
}
PdfCrossReference other = (PdfCrossReference) obj;
final PdfCrossReference other = (PdfCrossReference) obj;
return refnum == other.refnum;
}

Expand Down
2 changes: 1 addition & 1 deletion openpdf/src/main/resources/font-fallback/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

This is only a fallback font for existing OpenPDF code. For using the full set of Liberation Fonts,
please add the openpdf-fonts-extra dependency to you project and use the class
`org.librepdf.openpdf.fonts.Liberation`.
`org.librepdf.openpdf.fonts.Liberation`.
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,4 @@ void convertToBytesShouldExerciseSomeCode() throws IOException {
assertThat(bytes).hasSize(22);
assertThat(fontDetails.isSubset()).isTrue();
}

}

0 comments on commit 6a197d5

Please sign in to comment.