title: Android - PdfDocument - breaking a LinearLayout into multiple pdf pages
body: <p>I have an android linear layout which I want to convert as a PDF. Many a times, this PDF would span multiple pages. While I am able to convert the content into a single page PDF, have some difficulty in breaking the PDF into a multi-page one. I have given the relevant code block below, hard coded some numbers for simplicity sake. Here, PdfDocument.PageInfo.Builder takes 3 arguments - width, height and page number (earlier, it used to accept new Rect(0,0,800,100) which is not working any longer in API 23). Now, when I iterate through the for loop, I am not sure how I can get different content for a multi-page PDF. The current piece of code given below generates same content for every page, since it is based on width and height and not based on co-ordinates.</p>
  
  <pre><code>    PdfDocument.PageInfo pageInfo;
      int noOfPages = (int)Math.floor(content.getHeight()/1000)+1;
      for (int i=1;i&lt;=noOfPages;i++) {
          pageInfo = new PdfDocument.PageInfo.Builder
                  (800,1000,i).create();
          PdfDocument.Page page = document.startPage(pageInfo);
          content.draw(page.getCanvas());
          document.finishPage(page);
      }
  </code></pre>