title: Adding nested bookmarks to a PDF using PyPDF2
body: <p>The documentation for <a href="https://github.com/mstamy2/PyPDF2/" rel="noreferrer">PyPDF2</a> states that it's possible to add nested bookmarks to PDF files, and the code appears (upon reading) to support this.</p>
  
  <p>Adding a bookmark to the root tree is easy (see code below), but I can't figure out what I need to pass as the <code>parent</code> argument to create a nested bookmark. I want to create a structure something like this:</p>
  
  <pre><code>Group A
      Page 1
      Page 2
  Group A
      Page 3
      Page 4 
  </code></pre>
  
  <p>Is this possible?</p>
  
  <p>Sample code to add a bookmark to the root of the tree:</p>
  
  <pre><code>#!/usr/bin/env python
  from PyPDF2 import PdfFileWriter, PdfFileReader
  output = PdfFileWriter() # open output
  input = PdfFileReader(open('input.pdf', 'rb')) # open input
  output.addPage(input.getPage(0)) # insert page
  output.addBookmark('Hello, World', 0, parent=None) # add bookmark
  </code></pre>
  
  <p>PyPDF2 addBookmark function: <a href="https://github.com/mstamy2/PyPDF2/blob/master/PyPDF2/pdf.py#L517" rel="noreferrer">https://github.com/mstamy2/PyPDF2/blob/master/PyPDF2/pdf.py#L517</a></p>