Document editor for android7/29/2023 □ Tip: If you want to see a runnable example for custom page templates, check out CustomPageTemplatesExample in our Catalog app. tNewPageFactory( new DialogNewPageFactory( PdfDocumentLoader.openDocument( this, new DocumentSource( new AssetDataProvider( "Guide-v4.pdf"))), final int pageIndex = 8 įinal PageTemplate template = new PageTemplate( )) // Load a page template from a PDF file. Set up the Document Editor to show the desired list of page templates. PdfDocumentLoader.openDocument( this, DocumentSource(AssetDataProvider( "Guide-v4.pdf"))),ĬontextCompat.getDrawable( this, R.drawable.page_template_preview) val pageIndex = 8 val template = PageTemplate( ValueNewPageFactory - This factory will immediately return a NewPage instance that is set via the factory’s constructor method. It uses the NewPageDialog to configure and create a NewPage that will be added to the document. Here are the existing factories:ĭialogNewPageFactory - This is the default factory. You can set a factory by calling PdfThumbnailGrid#setNewPageFactory. New Page Factoriesĭocument Editor will add NewPage instances it receives from the set NewPageFactory. By default, tapping this will display the NewPageDialog, allowing you to configure the new page (various page patterns, background colors, page sizes, and landscape or portrait orientation). While in editing mode, you can press the floating action button to add a new page. PdfDocumentEditor#commitTransaction() ends a batch of Document Editor operations and commits them immediately. PdfDocumentEditor#discardTransaction() discards the current batch of document operations. PdfDocumentEditor#isTransactionActive() checks if there is currently an active transaction. PdfDocumentEditor#beginTransactions() begins a transaction. The kind of operation performed is specified in EditingOperation and may be one of the following: REMOVE, MOVE, INSERT, or ROTATE. A transaction is a change that occurred because of an operation performed by the Document Editor that can be undone/redone. Transactions allow for managing batches of operations as single units. Val documentEditor = PdfDocumentEditorFactory.createForDocument(document) PdfDocumentEditor documentEditor = PdfDocumentEditorFactory.createForDocument(document) Transactions PdfDocumentEditor can be retrieved via PdfDocumentEditorFactory: ℹ️ Note: Page rotation, duplication, and deletion are also possible when selecting multiple pages. To modify the default behavior with a custom file picker, use .PdfThumbnailGrid#setFilePicker(FilePicker). When saving changes to a given destination or exporting selected pages into a new document, Document Editor will open the Storage Access Framework file picker by default in order to select a destination file. Importing a new document selected from the device storage Saving changes back to the original documentĮxporting selected pages into a new document The following is a list of currently supported editing actions:įull undo/redo support and discarding of all changes Furthermore, the floating action button will allow the creation of new pages. Once in editing mode, the toolbar will show all editing options available. ℹ️ Note: If document editing isn’t enabled in your license, the standard PdfThumbnailGrid will be used. You can begin editing by pressing the floating action button, or alternatively, by long pressing any page. To switch into document editing mode, simply press the thumbnail grid menu option and the document page grid will be displayed. The editor is integrated with the PdfActivity as a drop-in replacement for the original PdfThumbnailGrid. Customizing the PDF Editing Toolbar on Androidĭocument Editor offers you and your users a whole host of document editing features, including creation of new pages, page duplication, reordering, rotation or deletion, and the ability to create a new document from selected pages.
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |