Class PD4Document


public class PD4Document extends PD4DocumentBase
  • Constructor Details

    • PD4Document

      public PD4Document(byte[] bytes, String password) throws PD4InvokeException
      Parameters:
      bytes - PDF document as an array of bytes
      password - if any. "null" for not protected PDF documents
      Throws:
      PD4InvokeException - by invalid call parameters
    • PD4Document

      public PD4Document(InputStream stream, String password) throws PD4InvokeException
      Parameters:
      stream - PDF document input stream
      password - if any. "null" for not protected PDF documents
      Throws:
      PD4InvokeException - by invalid call parameters
    • PD4Document

      public PD4Document(URL url, String password) throws PD4InvokeException
      Parameters:
      url - PDF document URL
      password - if any. "null" for not protected PDF documents
      Throws:
      PD4InvokeException - by invalid call parameters
  • Method Details

    • mergePDFs

      public static void mergePDFs(InputStream pdf1, InputStream pdf2, OutputStream result) throws IOException
      basic PDF merging method. Appends pdf2 to pdf1 bytes and writes resulting PDF to result.
      Parameters:
      pdf1 - main PDF document bytes stream
      pdf2 - PDF document bytes to append
      result - output stream to write resulting PDF
      Throws:
      IOException - reflects a variety of PDF read/parse/write errors
    • read

      protected void read(int objectCounter) throws IOException, PD4InvalidPasswordException
      reads and parses given PDF document stream
      Specified by:
      read in class PD4DocumentBase
      Parameters:
      objectCounter - initial object number to re-index PDF objects. Used by PDF merge scenarios
      Throws:
      IOException - read/parsing errors
      PD4InvalidPasswordException