Release of version 5.5.7 for iText 5 Core brings several improvements for tables, forms, digital signatures, create ZUGFeRD invoices, and much more.
There's a new 60-page tutorial in the works about creating e-Invoices with iText. In the pdfa jar of iText 5.5.7, you'll find code that allows you to create ZUGFeRD invoices as a PDF document with an XML attachment that complies either with the ZUGFeRD Basic profile or the ZUGFeRD Comfort profile. All you need to do to create the XML, is to implement either the
BasicInvoice or the
ComfortInvoice interface. These are invoices that consist of nothing but
getX() methods in which you provide the content of your invoice (such as seller, buyer, invoice lines,...).
iText 5.5.7 Core for Java and for .NET
This release also brings several improvements, especially in these areas:
The CleanUp functionality: several bug fixes; we've also resolved some inconsistencies between iText and iTextSharp.
- Forms: fixed some problems with special (or missing) fonts, fixed some edge cases when merging forms.
- Tables: fixed edge case errors, for instance problem:
- with skip first header/last footer,
- when splitting rows,
- regarding performance issues with nested tables.
- Reading PDF: better exception messages when "bad" PDFs are being read. For instance: we've found a PDF that had (illegal) circular references that resulted in an endless loop. We can now fail early before the JVM goes out of memory.
- Digital signatures: added functionality to manage the field lock dictionary, solved a problem with the signing time attribute, and other fixes
We noticed some differences when using iText with Java 7 versus using iText with Java 8. These are now solved. We've added the
PdfASmartCopy class. You can now choose for external caching when creating PDF/A (to save memory). We've also introduced some improvements to
PdfStamper: you can now add named destinations, and you can incrementally update a file on disk (if you want to save memory).
iText 5.5.7 Core
Bugs and improvements
- Ported "use full range" functionality so that the Java version of the Clipper library can work with numbers as large as in the C# version; fixed a lot of bugs raised due to inconsistency between C# and Java versions of the library.
- Fix autobookmarking for headers in div
- Add keepTogether property to PdfDiv to indicate if the content of a div should be placed entirely on a new page or distributed over two pages, if it doesn't fit previous
- Fix incorrect fields merging when second document has the same reference as a non-widget annotation in the first document
- Fix PdfDiv keepTogether behavior when a page is empty
- Add support for incrementally writing the stamped PDF
- PdfReader now throws an InvalidPdfException if document has circular references in its Page Tree.
- Circular references in Resources caused an infinite loop
- Fix named destinations structure in document root
- Fixed processing of degenerate subpaths, fixed some minor bugs, did some refactoring.
- Fix logic for skipping first/last header/footer in ptables
- Added an opportunity to add named destinations in and existing file via PdfStamper.
- PdfReader: When null is read as a PdfLiteral, it isn't recognized as a PdfNull object
- Fixed calculation of rotations for squares when zero-length dash pattern is used and line cap is set to projecting square
- Fixed bug with an incorrect glyph code page in acroforms.
- Added possibility to manage field lock dictionary when signature field is created on the fly, so now there is no need to explicitly create signature field to manage mdp.
- Add external caching feature, add external caching for tag structure
- Overrided toPdf method in PdfIndirectReference.
- Avoid adding the same annotation twice
- Make PdfReader#setPageContent method more consistent. setPageContent used to remove recursively the old contents and reuse old xRefs, so if a content stream or an array of streams was reused across the pages or in other ways, the result of stamping was invalid. Now by default setPageContent does not remove old content recursively. But you can use a new overload to do so. When old content is not removed, it may be left in the resulting document. Use PdfReader#removeUnusedObjects() to clean up.
- Fixed NullPointerException when there is the following line dash pattern in the document:  0 (solid). Also deleted incorrect method LineDashPattern.isZeroDashed and fixed LineDashPattern.isSolid (a path can be solid even if the phase is not zero, e.g. [3 0] 4).
- Fixed PdfSignatureAppearance.preClose method behavior. Before this preClosed worked incorrectly because it retrieved field dictionary as widget annotation. It's incorrect in case when field and widget dicts are not merged. In case they were merged, everything worked as expected. The latter is the most possible case for digital signature fields, but it isn't obligated according to spec.
- Add null-pointer check for chunk background color
- TIFF images: extended the variety of possible types for fill order field.
- Fix conversion of CMapKey of large font to byte Convert CMap keys for fonts from char to byte without using String::getBytes(). Large fonts can have CMap keys falling in illegal char ranges (0xD800 to 0xDFFF), which are not handled graciously by String. Method call in FontDetails::convertToBytes, new method in StringUtils. Also unit tests in StringUtilsTest, because this is a low-level issue.
- Add transparency support for fill color and for stroke color; XmlWorker: add support for rgba colors.
- Delete unneeded parameter from new StringUtils method and add JavaDocs
- Reuse of PdfDestination object causes problems with links Once you set a page on a PdfDestination, you can't change it afterwards. This means that we need to be careful when creating different links using the same PdfDestination. A copy constructor was introduced and it is being used to create a new PdfDestination when creating links or actions.
- Removed the code which was responsible for adding the signing time attribute to the digital signature since this attribute is prohibited in PAdES, part 3.
- CompareTool: Fails when the path to GhostScript/ImageMagic contains whitespaces
- Create fallback mechanism for illegal Color values Mostly of interest for reading badly created PDFs.
- Reimplement fallback mechanism for illegal color values New logic is x > 1 => x = 1 and x < 0 => x = 0, as Acrobat and Foxit do.
- Add BMC/EMC tags for RTL text in Tagged PDF
- Move hard-coded ReversedChars to PdfName
- Fixed wrong appearance generation for radio buttons
- Improve tab support in case of right-to-left text
- Make CompareToolTest more clear (compare generated reports). Minor improvements in CompareTool report (error order independent of Java version)
- Fix PdfCopyTest#largeFilePerformanceTest failure on Java 8
- Add background color tracking to image render listener Some image draw operations that use masks rely on background color to render the final image.
- Fix issue with splitLate property for the first regular row of a table Introduce additional state of splittedRow property to handle the first attempt to split the first row.
- Fix serious performance issues with nested tables
- Allow PdfReader to overcome missing entry /Type in /Root/Pages
- Font parsing error for Noto font Temporary fix for cff subset failure
- Get font type from Typographic Family name property (name, id=16) and add subfamily property More info on MS Typography. Contributed by Daniel Lichtenberger, CHEMDOX.
- Update font selector algorithm Before this update 'Arial Regular' and 'Arial Light' were considered being the same fonts: 'Arial' with Normal style and only alphabetical order controlled priority. From now when we add a regular font, we add it twice. For example 'Arial Regular'. We add it as 'Arial Regular' and as 'Arial'. So, if we try to find 'Arial' we will find 'Arial Regular'.
- Regression: Setting Compression after stamping images corrupts document Update javadoc
- Text expansion does not work with all Chunk constructors Check the accessible attributes when chunks are appended
- Inline image problem Ignore all unsupported decode filters for inline images
- Get rid of Java 1.5 compile errors The Arrays.copyOfRange method was included only in Java 1.6. Introduced a copy method to Utilities.
- Add shallow copy methods for lists. Refactor shallow copy for paragraphs
- Make text expansion and PdfTemplate work together correctly Add template without opening new MCBlock if one is currently opened for this template. See also: Text Expansion Not Working in Certain Conditions
- Make text expansion visible in Adobe Acrobat Tag Properties dialog Put text expansion not in the StructElem dictionary but in the marked content dictionary. Revise TextExpansionTest.
- Fix layers stamping bug Before this fix, old layers disappeared from the document when new ones are registered.
- Fix iteration order differences between java 7 and 8
- Add null check in ColumnText copy method
- Fixed encoding of SignedAttributeV2 field The main problem was related to the fact that iText generated the SigningCertificateV2 attribute using BER. It happened because iText wrote AlgorithmIdentifier attribute (RFC 5035, 22.214.171.124, definition of ESSCertIDv2) even if the value was sha256 (which is the default). If we look into X.690-0207, clause 11.5, we can see that using DER all the components of a sequence having default values shall not be included. The next problem was that iText always wrote NULL as the value for the parameters attribute (see X.590, clause 7.2, AlgorithmIdentifier attribute). As this attribute is marked as OPTIONAL it should simply be omitted.
- If a font used in /DA is not in /DR, do a fallback If a font is not available in the Font dictionary of the DR dictionary, we apply a fallback to still try to find the font. It makes sense to also do this when the Font or DR dictionary is missing altogether.
- Fixed bug with copying fields with the same name
- Fixed CleanUp tool There were two problems. The first one was related to incorrect string comparison (== instead of equals) when the actual operator was compared to q (save state) or Q (restore state). The next problem was in switching colors from stroke to fill (set color space operator (CS) wasn't converted).
- Add background image support for PdfDiv
- Show the path of the culprit resource when throwing a 'Read Timed out' exception.
- Remove redundant static variable
- Update documentation of DocWriter. The methods "setMarginMirroring(boolean)" and "setMarginMirroringTopBottom(boolean)" always return false. Update the the documentation to reflect this implementation.
- Fix endless loop caused by reading incorrect xref
- Flag saveAppearance was added to setField method of AcroFields class.
- Revert changes made in [cca9f78b44]: arrays contained in ParentTree sometimes shall have doubled entries Arrays that contain repetitions set the correspondence between marked contents identifiers (mcid) and the structure elements, which contain those marked content sequences. These repetitions are valid, as in fact single structure element may contain several marked content sequences.
- minor changes in merge field; remove unused code
- Add external caching for pdfa writer
- Fixed PdfA checkers. None of the PDF/A specifications (1, 2, 3) specify the Contents entry of the non-textual field as required, so the checks for Link and Widget annotations used to be too severe.
- Added PdfASmartCopy implementation
- Added experimental ZUGFeRD implementation
- Replace String.isEmpty() for Java 5 compatibility
Ported "use full range" functionality so that the Java version of the Clipper library can work with numbers as large as in the C# version; fixed a lot of bugs raised due to inconsistency between C# and Java versions of the library.
Fixed processing of degenerate subpaths, fixed some minor bugs, did some refactoring.
Fixed calculation of rotations for squares when zero-length dash pattern is used and line cap is set to projecting square
Fixed NullPointerException rising when some of redact annotations has no IC entry (in other words, redaction region is left transparent), added corresponding test.
Fixed NullPointerException rising when there is the following line dash pattern in the document:  0 (solid). Also deleted incorrect method LineDashPattern.isZeroDashed and fixed LineDashPattern.isSolid (a path can be solid even if the phase is not zero, e.g. [3 0] 4).
Fixed the code responsible for determination of whether glyph and redacted annotation rectangles intersect each other.
Fixed CleanUp tool There were two problems. The first one was related to incorrect string comparison (== instead of equals) when actual operator was compared to q (save state) or Q (restore state). The next problem was in switching colors from stroke to fill (set color space operator (CS) wasn't converted).
Normalize line endings
Remove NoStackException used in not exceptional flow; add test for autobookmarking
Fix empty CDATA processing
Add support for "page-break-inside: avoid" css tag
Change role property of paragraphs which contain parsed html headers
Add support for page-break-inside: avoid for tables
Fix work with tags of irregular case, e.g.
<b>. Fix spaces sanitization, allow HtmlPipeline parsing customization.
Fix bullets font style inheritance Now bullets inherit their font style from corresponding list items and not from list styles.
Table alignment support, alignment applying refactoring
Improve missing context error message Old error message contained "funny" text. Replace this by a more serious text.
NoNewLineParagraph Bugfix The check on line 233 currently always fails because an element will never be an instance of the image tag processor class.
Provide identical iteration order in different Java versions
Fixed css applying to the direct text inside div tag
Add initial support for background-image css property for div tags
Fix incomplete css parsing
Add generalized url links resolver, add new way to set resources path
Data binding fixes in case of binding to same data node and minOccur = 0.
Initial implementation of loadXML function for RichText. Fix RichText processing in DataPipeline. New prototypes to be able to check isNull for Image fields.
Add possibility to use loadXML JS function for loading images
Initial parsing of config package. Processing fracDigits property Locale specified in /config/acrobat/common/locale in Config package will override locale even if it's specified as an element's attribute. So we mimic Acrobat behavior in this respect. FracDigits property is treated differently dependent of XFA version. Mimic Acrobat as well. Minor cosmetic changes.
Correct a presumable typo which causes NPE
Flatten form even if the dataset is empty
Fit barcode width in the available area correctly. Support subtypes of barcode 128.
Fix alignment problem - proper caption element area calculation in draw elements
Fix paragraph alignment problem in case the alignment is specified in RichText
Fix xfa.record property retrieval - it is now equivalent to the root node of the xml data
Update XFA font selector algorithm Before this update 'Arial Regular' and 'Arial Light' was the same fonts: 'Arial' with Normal style. And only alphabetical order controls priority. From now when we add regular font, we add them twice. For example 'Arial Regular'. We add them as 'Arial Regular' and as 'Arial'. So, if we try to find 'Arial' we will find 'Arial Regular'.
XFAWorker: More accurate 2D barcode drawing, more precise rows/columns ratio and bar height/width for BarcodePDF417
XFAWorker: Support lists in RichText
Refactor #cloneShallow() in XFAParagraph
Fix FileNotFoundException - do not write to directories which are not explicitly allowed
Avoid creating invalid Pdf/A flattening results caused by using unembedded ZapfDingBats symbols
Fix problem DrawElement height shortage problem.
Implement InstanceManager's count property setter.
Fix break elements tag selection
Fix instanceIndex property implementation