title: Problems to display pdf in PagePanel
body: <p>I'm having trouble viewing a page in PagePanel, when trying to display the pdf, error occurs "java.nio.BufferUnderflowException."</p>
  
  <p>Error:</p>
  
  <blockquote>
    <p>java.nio.BufferUnderflowException
        at java.nio.HeapByteBuffer.get(Unknown Source)
        at com.sun.pdfview.decode.RunLengthDecode.decode(RunLengthDecode.java:64)
        at com.sun.pdfview.decode.RunLengthDecode.decode(RunLengthDecode.java:96)
        at com.sun.pdfview.decode.PDFDecoder.decodeStream(PDFDecoder.java:134)
        at com.sun.pdfview.PDFObject.decodeStream(PDFObject.java:347)
        at com.sun.pdfview.PDFObject.getStream(PDFObject.java:261)
        at com.sun.pdfview.PDFObject.getStream(PDFObject.java:298)
        at com.sun.pdfview.PDFImage.getImage(PDFImage.java:306)
        at com.sun.pdfview.PDFRenderer.drawImage(PDFRenderer.java:274)
        at com.sun.pdfview.PDFImageCmd.execute(PDFPage.java:665)
        at com.sun.pdfview.PDFRenderer.iterate(PDFRenderer.java:577)
        at com.sun.pdfview.BaseWatchable.run(BaseWatchable.java:101)
        at java.lang.Thread.run(Unknown Source)</p>
  </blockquote>
  
  <p>Code:</p>
  
  <pre><code>public class Test {
  
  public static void setup() throws IOException {
  
      //set up the frame and panel
      JFrame frame = new JFrame("PDF Test");
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      PagePanel panel = new PagePanel();
      frame.add(panel);
      frame.pack();
      frame.setVisible(true);
  
      //load a pdf from a byte buffer
      File file = new File("C:\\testeImpressora\\Print\\pdf\\tutorial.pdf");
      RandomAccessFile raf = new RandomAccessFile(file, "r");
      FileChannel channel = raf.getChannel();
      ByteBuffer buf = channel.map(FileChannel.MapMode.READ_ONLY,  0, channel.size());
      PDFFile pdffile = new PDFFile(buf);
  
      // show the first page
      PDFPage page = pdffile.getPage(0);
  
  
      panel.showPage(page);
  
  }
  
  public static void main(String[] args) {
       SwingUtilities.invokeLater(new Runnable() {
              public void run() {
                  try {
                      Test.setup();
                  } catch (IOException ex) {
                      ex.printStackTrace();
                  }
              }
          });
  
  }}
  </code></pre>