Named Destinations

Table of Contents

  1. Introduction
    1. Example


      The addFile() and addDocument() methods accept a name for a named destination in their $name parameter.

      This way it is possible to access the desired page by this name. 


      This named destination could be used in an URI to open the document at the specific page.

      $merger = new SetaPDF_Merger();
      // add files from the file system
          'filename' => 'files/pdfs/camtown/products/Boombastic-Box.pdf',
          'name' => 'product-A'
          'filename' => 'files/pdfs/camtown/products/Fantastic-Speaker.pdf',
          'name' => 'product-B'
          'filename' => 'files/pdfs/camtown/products/Noisy-Tube.pdf',
          'name' => 'product-C'
      // merge them together
      // get the resulting document instance
      $document = $merger->getDocument();
      // add a writer
      $document->setWriter(new SetaPDF_Core_Writer_Http('named-destinations.pdf', true));
      // save and finish

      To jump to the desired destinations see following URI examples that point to the above script (you need to view the document in your browser):