Class DefaultPDFWriter

java.lang.Object
org.sejda.sambox.output.DefaultPDFWriter
All Implemented Interfaces:
Closeable, AutoCloseable

class DefaultPDFWriter extends Object implements Closeable
Default PDF writer that writes part of the pdf document using the given IndirectObjectsWriter.
  • Field Details

    • LOG

      private static final org.slf4j.Logger LOG
    • COMMENT

      byte COMMENT
    • GARBAGE

      byte[] GARBAGE
    • writer

      private final IndirectObjectsWriter writer
  • Constructor Details

  • Method Details

    • writeHeader

      public void writeHeader(String version) throws IOException
      Throws:
      IOException
    • writeXrefTable

      public long writeXrefTable() throws IOException
      writes the xref table
      Returns:
      the startxref value
      Throws:
      IOException
    • writeTrailer

      public void writeTrailer(COSDictionary trailer, long startxref) throws IOException
      Writes the given trailer setting startxref to the given offsets
      Parameters:
      trailer -
      startxref -
      Throws:
      IOException
    • writeTrailer

      public void writeTrailer(COSDictionary trailer, long startxref, long prev) throws IOException
      Writes the given trailer setting the /Prev entry and startxref to the given offsets
      Parameters:
      trailer -
      startxref -
      prev - prev offset, written only if != -1
      Throws:
      IOException
    • writeXrefStream

      public void writeXrefStream(COSDictionary trailer) throws IOException
      Writes an xref stream using the given trailer
      Parameters:
      trailer -
      Throws:
      IOException
    • writeXrefStream

      public void writeXrefStream(COSDictionary trailer, long prev) throws IOException
      Writes an xref stream using the given trailer and setting the /Prev entry to the given offset
      Parameters:
      trailer -
      prev -
      Throws:
      IOException
    • sanitizeTrailer

      private static void sanitizeTrailer(COSDictionary trailer, long prev)
    • writeXrefFooter

      private void writeXrefFooter(long startxref) throws IOException
      Throws:
      IOException
    • writer

    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException