private void parsePDF(String filename, String password) throws PDFAuthenticationFailureException {
   long startTime = System.currentTimeMillis();
   try {
     File f = new File(filename);
     long len = f.length();
     if (len == 0) {
       mGraphView.showText("file '" + filename + "' not found");
     } else {
       mGraphView.showText("file '" + filename + "' has " + len + " bytes");
       openFile(f, password);
     }
   } catch (PDFAuthenticationFailureException e) {
     throw e;
   } catch (Throwable e) {
     e.printStackTrace();
     mGraphView.showText("Exception: " + e.getMessage());
   }
   long stopTime = System.currentTimeMillis();
   mGraphView.fileMillis = stopTime - startTime;
 }
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    uiHandler = new Handler();
    restoreInstance();
    if (mOldGraphView != null) {
      mGraphView = new GraphView(this, pdffilename);
      mGraphView.fileMillis = mOldGraphView.fileMillis;
      mGraphView.mBi = mOldGraphView.mBi;
      mGraphView.mLine1 = mOldGraphView.mLine1;
      mGraphView.mLine2 = mOldGraphView.mLine2;
      mGraphView.mLine3 = mOldGraphView.mLine3;
      mGraphView.mText = mOldGraphView.mText;
      mGraphView.pageParseMillis = mOldGraphView.pageParseMillis;
      mGraphView.pageRenderMillis = mOldGraphView.pageRenderMillis;
      mOldGraphView = null;
      mGraphView.mImageView.setImageBitmap(mGraphView.mBi);
      mGraphView.updateTexts();
      setContentView(mGraphView);
    } else {
      Intent intent = getIntent();
      Log.i(TAG, "" + intent);

      boolean showImages =
          getIntent()
              .getBooleanExtra(
                  PdfFileSelectActivity.EXTRA_SHOWIMAGES, PdfFileSelectActivity.DEFAULTSHOWIMAGES);
      PDFImage.sShowImages = showImages;
      boolean antiAlias =
          getIntent()
              .getBooleanExtra(
                  PdfFileSelectActivity.EXTRA_ANTIALIAS, PdfFileSelectActivity.DEFAULTANTIALIAS);
      PDFPaint.s_doAntiAlias = antiAlias;
      boolean useFontSubstitution =
          getIntent()
              .getBooleanExtra(
                  PdfFileSelectActivity.EXTRA_USEFONTSUBSTITUTION,
                  PdfFileSelectActivity.DEFAULTUSEFONTSUBSTITUTION);
      PDFFont.sUseFontSubstitution = useFontSubstitution;
      boolean keepCaches =
          getIntent()
              .getBooleanExtra(
                  PdfFileSelectActivity.EXTRA_KEEPCACHES, PdfFileSelectActivity.DEFAULTKEEPCACHES);
      HardReference.sKeepCaches = keepCaches;

      if (intent != null) {
        if ("android.intent.action.VIEW".equals(intent.getAction())) {
          pdffilename = storeUriContentToFile(intent.getData());
        } else {
          pdffilename = getIntent().getStringExtra(PdfFileSelectActivity.EXTRA_PDFFILENAME);
        }
      }
      mGraphView = new GraphView(this, pdffilename);

      if (pdffilename == null) pdffilename = "no file selected";

      mPage = STARTPAGE;
      mZoom = STARTZOOM;

      setContent(null);
    }
  }