Release iText 5.3.0
New release for iText 5.3.0, RUPS and XML Worker, continue reading to find out more.
Release Notes:
iText 5.3.0 Core
A short while ago, the Bouncy Castle Crypto API was upgraded from 1.46 to 1.47. This upgrade was a major one: we had to change all the iText code related to digital signatures. We took a couple of months to test this new code and during this time, we found and fixed many migration problems; we hope we caught them all.
While we were at it, we decided to completely reengineer the way iText digitally signs a PDF document. For the sake of clarity, all signing code was moved to a separate security package, and we've split up large classes into smaller helper classes.
We removed all of the traditional ("non detached") ways of signing, some of which will be deprecated as soon as the PDF 2.0 specification is released. From now on, you can only use detached signatures (which is recommended), both CMS as well as CADES style. In other words: on top of support for PAdES 2 and 4, we now also have full support for PAdES 3. Signing a message digest outside iText (for instance using a smart card) is now a no-brainer thanks to the ExternalSignature
interface.
The result of all these changes, is that you'll have to update your code if you're using the digital signature functionality. However: you'll discover that the new interface is much more straight-forward and easier to use.
It goes without saying that we also improved other features:
PdfSmartCopy
now does a better job avoiding redundant objects when concatenating PDFs;the image class is now smarter in retrieving the resolution of images;
we added a check to avoid the creation of pages that have a larger size than allowed according to ISO-32000-1.
Note that we deprecated HTMLWorker in favor of XML Worker. XML Worker does a really job job at converting XHTML to PDF (see below), so there's really no reason to continue using HTMLWorker.
As usual we've fixed some bugs that were introduced in previous versions:
there were some problems with PDFs with huge file sizes;
the CJK changes broke the VerticalText functionality,
finally we applied plenty of small enhancements and fixed several minor bugs in ColumnText (and related classes such as PdfLine).
Most important news: the dependency on BouncyCastle has changed (from 1.46 to 1.47); you'll need to rewrite your digital signing code.
iText RUPS
It was high time to create a version of RUPS using the latest iText version, and we had a good reason to do it now. Reading PDF syntax is heard, so we're now using colors to indicate the nature of the syntax: graphics state, text state, operators, operands,... They can now easily be recognized because they now have a different color.
XML Worker
XML Worker is getting really cool. We fixed the 'disappearing spaces' problem, we fixed some problems with tables (table cell spacing, double borders, list items inside tables), and we added support for div-tags with relative positions and float-layout.
For those of you who prefer C#: the iTextSharp port is scheduled for next week.
Changelog:
iText 5.3.0 Core
- Changes made by Paulo Soares
- Upgrade to BouncyCastle version 1.47 (multiple updates in April and May after serious testing)
- Complete refactoring of the way digital signatures are created (together with Bruno).
- Moving all signature-related code to a separate security package.
- Splitting up large classes in smaller, functional classes.
- Removal of subfilters that will be deprecated in ISO-32000-1, in favor of detached signatures (PKCS#7 as well as CAdES-based).
- Added a convenience method to do a detached signature.
- Introduction of an ExternalSignature interface (makes it easier to implement signing with a smart card).
- If a certificate doesn't contain a common name, use the email address instead.
- Bugfix ByteBuffer: overloaded method to deal with longs. It caused an error in signing very large files.
- Bugfix: vertical CJK cmaps weren't being loaded correctly.
- Changes made by Eugene Markovskyi
- Added a
CompareTool
class that depends on the presence of GhostScript to compare PDF output. - Bugfix
XfaForm
: avoidNullPointerException
- Bug #3514868 reported by Mike Horsey: wrong leading in Paragraphs. Eugene didn't use the proposed workaround, but fixed the problem differently.
Paragraph
: improvedcloneShallow()
andbreakUp()
logic. The first item must inherit paragraph spacing before. The last - spacing after. Some regression fixed.- Bugfix
ColumnText
composite content processing: the ascent should be used as leading for the first line of the paragraph which are placed after table. - Improving of fit page logic for
PdfPTable
. TheskipFirstHeader
flag should be taken into account.(suggested by Jason Berk) - Bugfix
PdfLine
: The line ascent/descent should be taken into account for the text rise. ColumnText
: ImageisScaleToFitLineWhenOverflow
flag is extended. The image is scaled if the image height overflow theColumnText
height.Type1Font
: added method for updating of font metrics (+ empty implementation in theBaseFont
class).- Introduced a "whitespace"
Chunk
to solve the problem of "disappearing spaces" in XML Worker. - Extra method to extract XFA nodes (originally written for XFA worker).
- Introduction of
PdfDiv
element that allows you to add floating content. - ColumnText fix: if
compositeColumn(inside goComposite(...))
doesn't place any text lines, the descent shouldn't be updated. - ColumnText: Added getter for current leading.
- ColumnText fix: the
currentLeading
should be updated bycompositeColumn.currentLeading
.
- Added a
- Changes made by Raf Hens
Image
class: now also extracting the resolution if stored in Photoshop IRBs
- Changes made by Kevin Day
LocationTextExtractionStrategy
: old comparison approach caused runtime exceptions in Java 7
- Changes made by Bruno
- Removed some unused imports in different classes.
PdfReader
: If you use theRecipientInformation.getContent(recipient)
method instead of the deprecatedRecipientInformation.getContent(key, provider)
method, the Java class loader needs to load theRecipient.class
file and for obvious reasons this results in aNoClassDefFoundError
if the BC jars aren't in the CLASSPATH. However: we don't want to force people to have the BC jars in their CLASSPATH if no encryption or digital signing is involved. As a temporary solution, I moved theRecipientInformation.getContent(recipient)
to thePdfEncryptor
class so that the class loader doesn't need to loadRecipient
if no encryption is involved.PRAcroForm
: Clarification regarding the different between the full name of a field (parent path + /T entry) and the name of the widget annotation (/NM entry).- Added extra check to avoid that a user creates a page that is too large. As per ISO-32000-1, the maximum size of a page is 14,400 by 14,000 user units.
- Bug #3522006 reported by abysas:
ArrayIndexOutOfBoundsException
inMappedRandomAccess
class because of wrong test (I replaced a>
by a>=
). - If you explicitly set the XMP metadata in
PdfStamper
, you take the responsibility to create a correct metadata stream, and iText shouldn't overrule it. - Bug #3507960 reported by InteractUK: I made some small changes to avoid an out of bound exception in
TextField
for choice fields with zero options. PdfGraphics2D
: Made some private variables protected to allow easier subclassing (for instance to changedrawString()
for better RTL support).- Deprecated
HTMLWorker
in favor of XML Worker. - ColumnText: in composite mode, we don't want the first line indentation to be repeated if there's a newline inside a
Paragraph
. - ColumnText (and PdfPCell) scale down images if they don't fit the rectangle, but in some cases, you don't want the image to be scaled down. I've set the
scaleToFitLineWhenOverflow
totrue
by default (this will have an effect on existing code that wraps images inChunk
s), and I used this parameter to decide whether or not to scale an image in a table (this shouldn't have an effect on existing code as I've setscaleToFitLineWhenOverflow
totrue
by default). - PdfSmartCopy: Instead of storing only streams, we now also store dictionaries. This dramatically reduces the resulting file size, for instance when concatenating documents using the same non-embedded fonts.
- Worked on the classes for digital signing. Added comments. Helped splitting up the code.
XML Worker 1.1.4
- Changes made by Alexander Chingarev
- CssAppliersImp: made some private variables protected.
- Changes made by Eugene Markovskyi
- Fixed the disappearing spaces problem (together with Bruno).
XMLWorkerHelper
:defaultCssFile
should be used only for default.css.- Some
XMLWorkerHelper
interfaces changed: newparseXHtml()
methods with extra (or less) parameters such as aFontProvider
. - Chunk.NEWLINE shouldn't be used directly. A new line element is created as a copy of Chunk.NEWLINE and then the styles are applied to this element.
- HTML tables:
- Support list items (not wrapped by list element) inside table cell (
td
tag). These list items should use zero left indention. - Fixed double border issue fixed by the case insensitive attribute name mapping.
- Improved table cell spacing.
- Support list items (not wrapped by list element) inside table cell (
- The last margin bottom is reseted before a tag is opened and reverted before the tag is closed. This is necessary for deep nested HTML elements because the last margin bottom could be missed or overwritten by child element.
XMLWorkerFontProvider
: changedfontSubstitutionMap
toprotected
. This is more convenient for implementing subclasses.HtmlCellCssApplier
: ImageisScaleToFitLineWhenOverflow
flag is extended. The image is scaled if the image height overflow theColumnText
height.- Support for "position: relative" and float layout CSS properties using
PdfDiv
object Fixed a problem with
- tags inside a tag (bullets were all wrong).
RUPS 1.0.2
Changes made by Bruno Lowagie
Fixed the disappearing spaces problem (together with Eugene).
XMLWorkerHelper
: Extra convenience method that was needed becauseparseXHtml()
with valuenull
for theCharset
was ambiguous.XMLWorkerFontProvider
: People should be able to chose whether or not to use unicode.- Fix: If you want to create a PDF with nothing but embedded fonts, you need to apply the CSS to all chunks, even the white space chunks.
- Changes made by Raf Hens
- Added syntax highlighting for content streams (with hard coded config, for now)
- Fixed infinite loop problem in logging console