/**
  * Rewrites the contents of the PDF page being transformed with those of the output list, if at
  * least one change has been indicated.
  *
  * @param pdfPage A PDF page (belonging to the PDF document).
  * @throws IOException if any processing error occurs.
  */
 protected synchronized void writeResult(PdfPage pdfPage) throws IOException {
   if (atLeastOneChange) {
     logger.debug3("Writing result to PDF page");
     PDStream resultStream = pdfPage.getPdfDocument().makePdStream();
     OutputStream outputStream = resultStream.createOutputStream();
     ContentStreamWriter tokenWriter = new ContentStreamWriter(outputStream);
     tokenWriter.writeTokens(getOutputList());
     pdfPage.setContents(resultStream);
   } else {
     logger.debug3("No result to write to PDF page");
   }
 }