1 /* 2 * Copyright (C) 2016 The Android Open Source Project 3 * Copyright (C) 2016 Mopria Alliance, Inc. 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18 package com.android.bips.render; 19 20 import com.android.bips.jni.SizeD; 21 22 /** 23 * Defines a simple PDF rendering service to protect the main process from 24 * crashes or security issues caused by unexpected PDF data. 25 */ 26 interface IPdfRender { 27 28 /** 29 * Open a new document, returning the page count or 0 on error 30 */ openDocument(in ParcelFileDescriptor file)31 int openDocument(in ParcelFileDescriptor file); 32 33 /** 34 * Return open document's page size in fractional points (1/72") or null on error. 35 */ getPageSize(int page)36 SizeD getPageSize(int page); 37 38 /** 39 * Render a page from the open document as a bitmap. 40 * 41 * @param destFile File to receive a PNG compressed bitmap corresponding to the specified 42 * portion of the page 43 * @param y y-offset from the page in pixels at the specified zoom factor 44 * @param width full-page width of bitmap to render 45 * @param height height of strip to render 46 * @return output receiver for bitmap output 47 */ renderPageStripe(int page, int y, int width, int height, double zoomFactor)48 ParcelFileDescriptor renderPageStripe(int page, int y, int width, int height, 49 double zoomFactor); 50 51 /** 52 * Release all internal resources related to the open document 53 */ closeDocument()54 oneway void closeDocument(); 55 } 56