/*
NOTE: This xref stream indirect object is purposely temporary (i.e. not registered into the file's
indirect objects collection).
*/
XRefStream xrefStream;
PdfIndirectObject xrefStreamIndirectObject = new PdfIndirectObject(
file,
xrefStream = new XRefStream(file),
xrefStreamEntry = new XRefEntry(indirectObjects.size(), 0, 0, XRefEntry.UsageEnum.InUse)
);
XRefEntry prevFreeEntry = null;
for(PdfIndirectObject indirectObject : indirectObjects)
{
if(indirectObject.getDataObject() instanceof XRefStream)
{
/*
NOTE: Existing xref streams MUST be suppressed,
temporarily replacing them with free entries.
*/
indirectObject = new PdfIndirectObject(
file,
null,
new XRefEntry(
indirectObject.getReference().getObjectNumber(),
XRefEntry.GenerationUnreusable,