Example usage for android.graphics.pdf PdfRenderer PdfRenderer

List of usage examples for android.graphics.pdf PdfRenderer PdfRenderer

Introduction

In this page you can find the example usage for android.graphics.pdf PdfRenderer PdfRenderer.

Prototype

public PdfRenderer(@NonNull ParcelFileDescriptor input) throws IOException 

Source Link

Document

Creates a new instance.

Usage

From source file:com.franctan.pdfviewpager.library.adapter.PDFPagerAdapter.java

@SuppressWarnings("NewApi")
protected void init() {
    try {// w  w w.  j  a  va2 s  .c  o m
        renderer = new PdfRenderer(getSeekableFileDescriptor(pdfPath));
        inflater = (LayoutInflater) context.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
        initBitmapPool();
    } catch (IOException e) {
        e.printStackTrace();
        Log.e("PDFPagerAdapter", e.getMessage());
    }
}

From source file:com.epubtest.hxfy.epubtest.BasePDFPagerAdapter.java

@SuppressWarnings("NewApi")
protected void init() {
    try {/*from   w ww  .  ja v  a2  s  .c  o m*/
        renderer = new PdfRenderer(getSeekableFileDescriptor(pdfPath));
        inflater = (LayoutInflater) context.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
        PdfRendererParams params = extractPdfParamsFromFirstPage(renderer, renderQuality);
        bitmapContainer = new SimpleBitmapPool(params);
    } catch (IOException e) {
        e.printStackTrace();
    }
}

From source file:com.example.pdfviewer.PdfRendererBasicFragment.java

/**
 * Sets up a {@link android.graphics.pdf.PdfRenderer} and related resources.
 *//*  w w  w  .ja v  a2s.  c  o  m*/
private void openRenderer(Context context) throws IOException {
    // In this sample, we read a PDF from the assets directory.
    mFileDescriptor = context.getContentResolver().openFileDescriptor(mUri, "r");
    // This is the PdfRenderer we use to render the PDF.
    mPdfRenderer = new PdfRenderer(mFileDescriptor);
}

From source file:com.example.android.pdfrendererbasic.PdfRendererBasicFragment.java

/**
 * Sets up a {@link android.graphics.pdf.PdfRenderer} and related resources.
 *//*from  ww  w  .  j  a v  a  2s.co  m*/
private void openRenderer(Context context) throws IOException {
    // In this sample, we read a PDF from the assets directory.
    mFileDescriptor = context.getAssets().openFd("sample.pdf").getParcelFileDescriptor();
    // This is the PdfRenderer we use to render the PDF.
    mPdfRenderer = new PdfRenderer(mFileDescriptor);
}