com.shockwave.pdfium.PdfiumCore Java Examples

The following examples show how to use com.shockwave.pdfium.PdfiumCore. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PDFView.java    From AndroidPdfViewerV2 with Apache License 2.0 7 votes vote down vote up
/**
 * Construct the initial view
 */
public PDFView(Context context, AttributeSet set) {
    super(context, set);

    renderingHandlerThread = new HandlerThread("PDF renderer");

    if (isInEditMode()) {
        return;
    }

    cacheManager = new CacheManager();
    animationManager = new AnimationManager(this);
    dragPinchManager = new DragPinchManager(this, animationManager);

    paint = new Paint();
    debugPaint = new Paint();
    debugPaint.setStyle(Style.STROKE);

    pdfiumCore = new PdfiumCore(context);
    setWillNotDraw(false);
}
 
Example #2
Source File: PDFView.java    From AndroidPdfViewer with Apache License 2.0 6 votes vote down vote up
/** Construct the initial view */
public PDFView(Context context, AttributeSet set) {
    super(context, set);

    renderingHandlerThread = new HandlerThread("PDF renderer");

    if (isInEditMode()) {
        return;
    }

    cacheManager = new CacheManager();
    animationManager = new AnimationManager(this);
    dragPinchManager = new DragPinchManager(this, animationManager);
    pagesLoader = new PagesLoader(this);

    paint = new Paint();
    debugPaint = new Paint();
    debugPaint.setStyle(Style.STROKE);

    pdfiumCore = new PdfiumCore(context);
    setWillNotDraw(false);
}
 
Example #3
Source File: DecodingAsyncTask.java    From AndroidPdfViewerV2 with Apache License 2.0 5 votes vote down vote up
DecodingAsyncTask(DocumentSource docSource, String password, PDFView pdfView, PdfiumCore pdfiumCore, int firstPageIdx) {
    this.docSource = docSource;
    this.firstPageIdx = firstPageIdx;
    this.cancelled = false;
    this.pdfView = pdfView;
    this.password = password;
    this.pdfiumCore = pdfiumCore;
    context = pdfView.getContext();
}
 
Example #4
Source File: DecodingAsyncTask.java    From AndroidPdfViewer with Apache License 2.0 5 votes vote down vote up
DecodingAsyncTask(DocumentSource docSource, String password, int[] userPages, PDFView pdfView, PdfiumCore pdfiumCore) {
    this.docSource = docSource;
    this.userPages = userPages;
    this.cancelled = false;
    this.pdfViewReference = new WeakReference<>(pdfView);
    this.password = password;
    this.pdfiumCore = pdfiumCore;
}
 
Example #5
Source File: PdfFile.java    From AndroidPdfViewer with Apache License 2.0 5 votes vote down vote up
PdfFile(PdfiumCore pdfiumCore, PdfDocument pdfDocument, FitPolicy pageFitPolicy, Size viewSize, int[] originalUserPages,
        boolean isVertical, int spacing, boolean autoSpacing, boolean fitEachPage) {
    this.pdfiumCore = pdfiumCore;
    this.pdfDocument = pdfDocument;
    this.pageFitPolicy = pageFitPolicy;
    this.originalUserPages = originalUserPages;
    this.isVertical = isVertical;
    this.spacingPx = spacing;
    this.autoSpacing = autoSpacing;
    this.fitEachPage = fitEachPage;
    setup(viewSize);
}
 
Example #6
Source File: PDFView.java    From AndroidPdfViewerV1 with Apache License 2.0 5 votes vote down vote up
/**
 * Construct the initial view
 */
public PDFView(Context context, AttributeSet set) {
    super(context, set);

    renderingHandlerThread = new HandlerThread("PDF renderer");

    if (isInEditMode()) {
        return;
    }

    miniMapRequired = false;
    cacheManager = new CacheManager();
    animationManager = new AnimationManager(this);
    dragPinchManager = new DragPinchManager(this, animationManager);

    paint = new Paint();
    debugPaint = new Paint();
    debugPaint.setStyle(Style.STROKE);
    paintMinimapBack = new Paint();
    paintMinimapBack.setStyle(Style.FILL);
    paintMinimapBack.setColor(Color.BLACK);
    paintMinimapBack.setAlpha(50);
    paintMinimapFront = new Paint();
    paintMinimapFront.setStyle(Style.FILL);
    paintMinimapFront.setColor(Color.BLACK);
    paintMinimapFront.setAlpha(50);

    // A surface view does not call
    // onDraw() as a default but we need it.
    setWillNotDraw(false);

    pdfiumCore = new PdfiumCore(context);
}
 
Example #7
Source File: DecodingAsyncTask.java    From AndroidPdfViewerV1 with Apache License 2.0 5 votes vote down vote up
public DecodingAsyncTask(DocumentSource docSource, String password, PDFView pdfView, PdfiumCore pdfiumCore) {
    this.docSource = docSource;
    this.cancelled = false;
    this.pdfView = pdfView;
    this.password = password;
    this.pdfiumCore = pdfiumCore;
    context = pdfView.getContext();
}
 
Example #8
Source File: FileSource.java    From AndroidPdfViewer with Apache License 2.0 4 votes vote down vote up
@Override
public PdfDocument createDocument(Context context, PdfiumCore core, String password) throws IOException {
    ParcelFileDescriptor pfd = ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY);
    return core.newDocument(pfd, password);
}
 
Example #9
Source File: ByteArraySource.java    From AndroidPdfViewer with Apache License 2.0 4 votes vote down vote up
@Override
public PdfDocument createDocument(Context context, PdfiumCore core, String password) throws IOException {
    return core.newDocument(data, password);
}
 
Example #10
Source File: AssetSource.java    From AndroidPdfViewer with Apache License 2.0 4 votes vote down vote up
@Override
public PdfDocument createDocument(Context context, PdfiumCore core, String password) throws IOException {
    File f = FileUtils.fileFromAsset(context, assetName);
    ParcelFileDescriptor pfd = ParcelFileDescriptor.open(f, ParcelFileDescriptor.MODE_READ_ONLY);
    return core.newDocument(pfd, password);
}
 
Example #11
Source File: InputStreamSource.java    From AndroidPdfViewer with Apache License 2.0 4 votes vote down vote up
@Override
public PdfDocument createDocument(Context context, PdfiumCore core, String password) throws IOException {
    return core.newDocument(Util.toByteArray(inputStream), password);
}
 
Example #12
Source File: UriSource.java    From AndroidPdfViewer with Apache License 2.0 4 votes vote down vote up
@Override
public PdfDocument createDocument(Context context, PdfiumCore core, String password) throws IOException {
    ParcelFileDescriptor pfd = context.getContentResolver().openFileDescriptor(uri, "r");
    return core.newDocument(pfd, password);
}
 
Example #13
Source File: FileSource.java    From AndroidPdfViewerV1 with Apache License 2.0 4 votes vote down vote up
@Override
public PdfDocument createDocument(Context context, PdfiumCore core, String password) throws IOException {
    ParcelFileDescriptor pfd = ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY);
    return core.newDocument(pfd, password);
}
 
Example #14
Source File: ByteArraySource.java    From AndroidPdfViewerV1 with Apache License 2.0 4 votes vote down vote up
@Override
public PdfDocument createDocument(Context context, PdfiumCore core, String password) throws IOException {
    return core.newDocument(data, password);
}
 
Example #15
Source File: AssetSource.java    From AndroidPdfViewerV1 with Apache License 2.0 4 votes vote down vote up
@Override
public PdfDocument createDocument(Context context, PdfiumCore core, String password) throws IOException {
    File f = FileUtils.fileFromAsset(context, assetName);
    ParcelFileDescriptor pfd = ParcelFileDescriptor.open(f, ParcelFileDescriptor.MODE_READ_ONLY);
    return core.newDocument(pfd, password);
}
 
Example #16
Source File: InputStreamSource.java    From AndroidPdfViewerV1 with Apache License 2.0 4 votes vote down vote up
@Override
public PdfDocument createDocument(Context context, PdfiumCore core, String password) throws IOException {
    return core.newDocument(Util.toByteArray(inputStream), password);
}
 
Example #17
Source File: UriSource.java    From AndroidPdfViewerV1 with Apache License 2.0 4 votes vote down vote up
@Override
public PdfDocument createDocument(Context context, PdfiumCore core, String password) throws IOException {
    ParcelFileDescriptor pfd = context.getContentResolver().openFileDescriptor(uri, "r");
    return core.newDocument(pfd, password);
}
 
Example #18
Source File: RenderingHandler.java    From AndroidPdfViewerV1 with Apache License 2.0 4 votes vote down vote up
RenderingHandler(Looper looper, PDFView pdfView, PdfiumCore pdfiumCore, PdfDocument pdfDocument) {
    super(looper);
    this.pdfView = pdfView;
    this.pdfiumCore = pdfiumCore;
    this.pdfDocument = pdfDocument;
}
 
Example #19
Source File: FileSource.java    From AndroidPdfViewerV2 with Apache License 2.0 4 votes vote down vote up
@Override
public PdfDocument createDocument(Context context, PdfiumCore core, String password) throws IOException {
    ParcelFileDescriptor pfd = ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY);
    return core.newDocument(pfd, password);
}
 
Example #20
Source File: ByteArraySource.java    From AndroidPdfViewerV2 with Apache License 2.0 4 votes vote down vote up
@Override
public PdfDocument createDocument(Context context, PdfiumCore core, String password) throws IOException {
    return core.newDocument(data, password);
}
 
Example #21
Source File: AssetSource.java    From AndroidPdfViewerV2 with Apache License 2.0 4 votes vote down vote up
@Override
public PdfDocument createDocument(Context context, PdfiumCore core, String password) throws IOException {
    File f = FileUtils.fileFromAsset(context, assetName);
    ParcelFileDescriptor pfd = ParcelFileDescriptor.open(f, ParcelFileDescriptor.MODE_READ_ONLY);
    return core.newDocument(pfd, password);
}
 
Example #22
Source File: InputStreamSource.java    From AndroidPdfViewerV2 with Apache License 2.0 4 votes vote down vote up
@Override
public PdfDocument createDocument(Context context, PdfiumCore core, String password) throws IOException {
    return core.newDocument(Util.toByteArray(inputStream), password);
}
 
Example #23
Source File: UriSource.java    From AndroidPdfViewerV2 with Apache License 2.0 4 votes vote down vote up
@Override
public PdfDocument createDocument(Context context, PdfiumCore core, String password) throws IOException {
    ParcelFileDescriptor pfd = context.getContentResolver().openFileDescriptor(uri, "r");
    return core.newDocument(pfd, password);
}
 
Example #24
Source File: RenderingHandler.java    From AndroidPdfViewerV2 with Apache License 2.0 4 votes vote down vote up
RenderingHandler(Looper looper, PDFView pdfView, PdfiumCore pdfiumCore, PdfDocument pdfDocument) {
    super(looper);
    this.pdfView = pdfView;
    this.pdfiumCore = pdfiumCore;
    this.pdfDocument = pdfDocument;
}
 
Example #25
Source File: DocumentSource.java    From AndroidPdfViewerV1 with Apache License 2.0 votes vote down vote up
PdfDocument createDocument(Context context, PdfiumCore core, String password) throws IOException; 
Example #26
Source File: DocumentSource.java    From AndroidPdfViewerV2 with Apache License 2.0 votes vote down vote up
PdfDocument createDocument(Context context, PdfiumCore core, String password) throws IOException; 
Example #27
Source File: DocumentSource.java    From AndroidPdfViewer with Apache License 2.0 votes vote down vote up
PdfDocument createDocument(Context context, PdfiumCore core, String password) throws IOException;