java.lang.Object | |
↳ | com.pdftron.pdf.utils.ViewerUtils |
A utility class for pdf viewer
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
String | IMAGE_DPI_CONVERSION_OPTION |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
ViewerUtils() |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
static void |
addPageToBookmark(Context context, boolean isReadOnly, PDFViewCtrl pdfViewCtrl, int page)
Adds a page bookmark
| ||||||||||
static void | animateScreenRect(PDFViewCtrl pdfViewCtrl, Rect screenRect) | ||||||||||
static void |
animateUndoRedo(PDFViewCtrl pdfViewCtrl, Rect annotRect, int pageNum)
Animates for showing undo/redo action.
| ||||||||||
static boolean |
checkImageIntent(Map imageIntent)
Checks whether the internal image intent map is valid.
| ||||||||||
static StateListDrawable | createBackgroundSelector(Drawable drawable) | ||||||||||
static void | createFileAttachment(Activity activity, Intent data, PDFViewCtrl pdfViewCtrl, PointF targetPoint) | ||||||||||
static void |
createFileIntent(Activity activity, Fragment fragment, String fileName, String mimeType)
Send a generic file creation intent
| ||||||||||
static void | createImageSignature(Activity activity, Intent data, PDFViewCtrl pdfViewCtrl, Uri outputFileUri, PointF targetPoint, int targetPage, Long widget) | ||||||||||
static void | createImageStamp(Activity activity, Intent data, PDFViewCtrl pdfViewCtrl, Uri outputFileUri, PointF imageStampTargetPoint) | ||||||||||
static boolean |
exportFileAttachment(PDFViewCtrl pdfViewCtrl, FileAttachment attachment, Uri targetUri)
Export file attachment to target URI, return whether successful.
| ||||||||||
static String | exportFileAttachment(PDFViewCtrl pdfViewCtrl, FileAttachment attachment, File directory) | ||||||||||
static String | exportFileAttachment(PDFViewCtrl pdfViewCtrl, FileAttachment attachment) | ||||||||||
static String | extractFileFromPortfolio(int type, Context context, PDFDoc portfolioDoc, String destFolderPath, String fileName) | ||||||||||
static String | extractFileFromPortfolio(int type, Context context, PDFDoc portfolioDoc, String destFolderPath, Uri destFileUri, String fileName) | ||||||||||
static
|
extractFileFromPortfolioDisposable(int type, Context context, PDFDoc portfolioDoc, String destFolderPath, Uri destFileUri, String fileName) | ||||||||||
static void | flattenDoc(PDFDoc doc) | ||||||||||
static Annot |
getAnnotById(PDFDoc pdfDoc, String id, int pageNum)
Returns annotation by providing its ID.
| ||||||||||
static Annot |
getAnnotById(PDFViewCtrl ctrl, String id, int pageNum)
Returns annotation by providing its ID.
| ||||||||||
static BitmapDrawable | getBitmapDrawable(Context context, int drawableId, int width, int height, int targetColor, boolean roundedCorner, boolean nonWhiteOnly) | ||||||||||
static BitmapDrawable | getBitmapDrawable(Context context, int drawableId, int width, int height, int targetColor, boolean roundedCorner) | ||||||||||
static Intent |
getFileIntent(String fileName, String mimeType)
Send a generic file creation intent
| ||||||||||
static Bitmap |
getImageBitmap(Context context, Map imageIntent)
Returns the image bitmap.
| ||||||||||
static Bitmap |
getImageBitmap(Context context, Uri imageUri, String filePath)
Returns the image bitmap.
| ||||||||||
static String |
getImageFilePath(Map imageIntent)
Returns the image file path.
| ||||||||||
static String | getImageSignaturePath(Activity activity, Intent data, Uri outputFileUri) | ||||||||||
static Uri |
getImageUri(Map imageIntent)
Returns the image URI
| ||||||||||
static Uri | getImageUriFromIntent(Intent data, Activity activity, Uri outputFileUri) | ||||||||||
static int | getLastHPosForURL(Context context, String url) | ||||||||||
static int | getLastPageForURL(Context context, String url) | ||||||||||
static int | getLastVPosForURL(Context context, String url) | ||||||||||
static double | getLastZoomForURL(Context context, String url) | ||||||||||
static ArrayList<MenuEditorItem> |
getMenuEditorItemsArray(String savedToolbarMenu)
This method is deprecated.
No replacement.
| ||||||||||
static String |
getMenuEditorItemsJSON(ArrayList<MenuEditorItem> newMenuItems)
This method is deprecated.
No replacement.
| ||||||||||
static PageSet |
getPageSet(SparseBooleanArray positions)
Converts page positions to the page set
| ||||||||||
static int | getRotationForURL(Context context, String url) | ||||||||||
static String |
getSelectedString(PDFViewCtrl pdfViewCtrl, boolean appendNewLine)
Returns selected text in pdf
| ||||||||||
static String |
getSelectedString(PDFViewCtrl pdfViewCtrl)
Returns selected text in pdf
| ||||||||||
static String |
imageIntentToPdf(Context context, Uri imageUri, String imagePath, ExternalFileInfo documentFile)
Converts image to PDF from an image intent
| ||||||||||
static String |
imageIntentToPdf(Context context, Uri imageUri, String imagePath, String outputPath)
Converts image to PDF from an image intent
| ||||||||||
static void |
importAnnotationCommand(PDFViewCtrl pdfViewCtrl, String xfdfCommand)
Import annotation XFDF command to the document
| ||||||||||
static boolean |
isContinuousPageMode(PDFViewCtrl pdfViewCtrl)
Checks if the tab is in continuous page mode.
| ||||||||||
static boolean |
isImageFromCamera(Map imageIntent)
Checks whether the image is taken from camera.
| ||||||||||
static boolean | isInFullScreenMode(Context context) | ||||||||||
static boolean |
isNonContinuousVerticalPageMode(PDFViewCtrl pdfViewCtrl)
Checks if the tab is in continuous snapping page mode.
| ||||||||||
static boolean |
isSinglePageMode(PDFViewCtrl pdfViewCtrl)
Checks if the tab is in single page mode.
| ||||||||||
static boolean |
isViewerZoomed(PDFViewCtrl pdfViewCtrl)
Checks whether the PDFViewCtrl is zoomed.
| ||||||||||
static void |
jumpToAnnotation(PDFViewCtrl pdfViewCtrl, Annot annot, int pageNum)
Jumps to the specified annotation.
| ||||||||||
static void | jumpToRect(PDFViewCtrl pdfViewCtrl, Rect rect, int pageNum) | ||||||||||
static void |
keepOnScreenAfterClick(Context context, MenuItem item)
Prevents menu item from closing its popup menu on click
| ||||||||||
static Uri | openCameraIntent(Activity activity, int requestCode) | ||||||||||
static void |
openFileIntent(Fragment fragment)
Send a generic file picker intent
| ||||||||||
static void |
openFileIntent(Activity activity, Fragment fragment)
Send a generic file picker intent
| ||||||||||
static void |
openFileIntent(Activity activity)
Send a generic file picker intent
| ||||||||||
static Uri | openGalleryIntent(Activity activity, int requestCode) | ||||||||||
static Uri | openGalleryIntent(Activity activity, int requestCode, boolean multiSelect) | ||||||||||
static Uri | openImageIntent(Fragment fragment, boolean multiSelect) | ||||||||||
static Uri | openImageIntent(Activity activity, int requestCode) | ||||||||||
static Uri | openImageIntent(Fragment fragment, int requestCode) | ||||||||||
static Uri | openImageIntent(Fragment fragment) | ||||||||||
static Uri | openImageIntent(Activity activity) | ||||||||||
static void | passwordDoc(PDFDoc doc, String password) | ||||||||||
static Map |
readImageIntent(Intent data, Context context, Uri outputFileUri)
Reads an image intent.
| ||||||||||
static List<Map<String, Object>> |
readMultiImageIntent(Intent data, Context context, Uri outputFileUri, boolean parseMultiImage)
Reads an image intent with option to parse multi image.
| ||||||||||
static void |
removePageBookmark(Context context, boolean isReadOnly, PDFViewCtrl pdfViewCtrl, int page)
Removes a page bookmark
| ||||||||||
static void | renameAllFields(Page page) | ||||||||||
static void | safeUpdatePageLayout(PDFViewCtrl pdfViewCtrl) | ||||||||||
static void |
safeUpdatePageLayout(PDFViewCtrl pdfViewCtrl, ExceptionHandlerCallback callback)
Safe version of updatePageLayout, will call readLock before and unlock after this operation
as recommended by Core Team
Updates the page layout within the view. | ||||||||||
static Rect |
scrollToAnnotRect(PDFViewCtrl pdfViewCtrl, Rect annotRect, int pageNum)
Scroll to annotation rect.
| ||||||||||
static void | setLastPageForURL(Context context, String url, int page) | ||||||||||
static void | setLastPageStateForURL(Context context, String url, double zoom, int hPos, int vPos, int rotation) |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Adds a page bookmark
context | the context |
---|---|
isReadOnly | whether to edit the original pdf |
pdfViewCtrl | the PDFViewCtrl |
page | the page to add to bookmark |
Animates for showing undo/redo action.
pdfViewCtrl | The PDFViewCtrl |
---|---|
annotRect | The annotation rectangle to be animated |
pageNum | The page number |
Checks whether the internal image intent map is valid.
imageIntent | The internal image intent map obtained from readImageIntent(Intent, Context, Uri) |
---|
Send a generic file creation intent
Export file attachment to target URI, return whether successful.
Returns annotation by providing its ID.
pdfDoc | The PDFDoc |
---|---|
id | The ID of the annotation |
pageNum | The page number |
Returns annotation by providing its ID.
ctrl | The PDFViewCtrl |
---|---|
id | The ID of the annotation |
pageNum | The page number |
Send a generic file creation intent
Returns the image bitmap.
context | The context |
---|---|
imageIntent | The internal image intent map obtained from readImageIntent(Intent, Context, Uri) |
Returns the image bitmap.
context | The context |
---|---|
imageUri | Uri to image |
Returns the image file path.
imageIntent | The internal image intent map obtained from readImageIntent(Intent, Context, Uri) |
---|
Returns the image URI
imageIntent | The internal image intent map obtained from readImageIntent(Intent, Context, Uri) |
---|
This method is deprecated.
No replacement.
JSONException |
---|
This method is deprecated.
No replacement.
JSONException |
---|
Converts page positions to the page set
positions | The page positions as boolean |
---|
Returns selected text in pdf
pdfViewCtrl | The PDFViewCtrl |
---|---|
appendNewLine | Whether to append new line on line break |
Returns selected text in pdf
pdfViewCtrl | The PDFViewCtrl |
---|
Converts image to PDF from an image intent
context | the context |
---|---|
imageUri | the image intent |
imagePath | the image path |
documentFile | the result file path |
IOException | |
---|---|
PDFNetException |
Converts image to PDF from an image intent
context | the context |
---|---|
imagePath | the image intent |
outputPath | the result file path |
FileNotFoundException | |
---|---|
PDFNetException |
Import annotation XFDF command to the document
pdfViewCtrl | the viewer |
---|---|
xfdfCommand | the XFDF command string |
PDFNetException |
---|
Checks if the tab is in continuous page mode.
Checks whether the image is taken from camera.
imageIntent | The internal image intent map obtained from readImageIntent(Intent, Context, Uri) |
---|
Checks if the tab is in continuous snapping page mode.
Checks if the tab is in single page mode.
Checks whether the PDFViewCtrl is zoomed.
pdfViewCtrl | The PDFViewCtrl |
---|
Jumps to the specified annotation.
pdfViewCtrl | The PDFViewCtrl |
---|---|
annot | The annotation |
pageNum | The page number where the annotation is on |
Prevents menu item from closing its popup menu on click
item | menu item to prevent from closing menu |
---|
Send a generic file picker intent
fragment | the fragment |
---|
Send a generic file picker intent
activity | the activity |
---|---|
fragment | the fragment |
Send a generic file picker intent
activity | the activity |
---|
activity | the activity in which you can expect onActivityResult will be called with given request code |
---|---|
requestCode | the request code to returned in onActivityResult |
fragment | the fragment in which you can expect onActivityResult will be called with given request code |
---|---|
requestCode | the request code to returned in onActivityResult |
fragment | the fragment in which you can expect onActivityResult will be called
with request code PICK_PHOTO_CAM |
---|
activity | the activity in which you can expect onActivityResult will be called
with request code PICK_PHOTO_CAM |
---|
Reads an image intent.
data | The intent |
---|---|
context | The context |
outputFileUri | The output URI |
FileNotFoundException | FileNotFound exception |
---|
Reads an image intent with option to parse multi image.
FileNotFoundException |
---|
Removes a page bookmark
context | the context |
---|---|
isReadOnly | whether to edit the original pdf |
pdfViewCtrl | the PDFViewCtrl |
page | the page to remove from bookmark |
Safe version of updatePageLayout, will call readLock before and unlock after this operation as recommended by Core Team
Updates the page layout within the view. This function must be called after document page sequence is modified (such as when a page is being added to or removed from a document) or after changes to page dimensions (e.g. after a page is rotated or resized).
pdfViewCtrl | the PDFViewCtrl |
---|---|
callback | Callback object to provide exception handling, can be null |
Scroll to annotation rect.
pdfViewCtrl | the PDFViewCtrl |
---|---|
annotRect | the annot rect |
pageNum | the annot page number |
PDFNetException | PDFNet exception |
---|