Analysis
Overview
User should be able to:
- Import entire pdf document
- Import pdf page
- Import page content
- Use pdf as resource
- Extract elements from pdf file to resources
- Select pdf elements - to allow copy/paste functionality.
- Embed in the application, single page from a pdf file. This page should be used as a resource.
- There should be button in insert menu that allows this functionality. The label of the button could be "Insert PDF Page". This should evoke open file dialog that allows the user to select pdf file. After the file is selected preview window should appear. This window should let the user to navigate to the desire page and insert it.
- Navigate through pages if several pdf pages are imported. There should be arrows for left and right navigation which shows the corresponding page.
- Export book to pdf(user should be aware of the loses of data if any)
Task requirements
For now the specified things from the overview that will be implemented in this group of pdf tasks are:
- Create new module where you have to implement:
- pdf content and content view
- pdf resource with appropriate fields(i.e. metas, orgin).
- appropriate saver and loader for pdf documents
- Research libraries which shows pdfs and give the functionality to search, navigate and zoom in a pdf document.
- Do not forget to check if the licenses of the founded libraries are compatible with our(Educational Community License 2.0)
- See http://java-source.net/open-source/pdf-libraries.
- Create demo using the chosen library before integrating it to the project.
- Create pdf frame which should be added in Insert menu.
- Implement the showing dialog for selecting the pdf file and preview window for choosing a page. Think about choosing several pages and easy way to import the whole document(may be dialog asking the user if he wants to choose a page).
- Implement navigation arrows(frame huds) which go through the imported pdf pages(if it is one may be they shouldn't be shown).
Task result
- Source code demonstrating the chosen library.
- New module with source code.
Implementation idea
- See https://pdf-renderer.dev.java.net/ and http://www.lowagie.com/iText/, they seem useful and with compatible licenses.
- Because pdf support is one of the "extra" part of Sophie all the functionality has to be provided in the pdf module - content, content view, pdf resource implementations and the GUI part.
Related
- trunk/sophie2-platform/modules/org.sophie2.base.model.resources
- trunk/sophie2-platform/modules/org.sophie2.base.persistence
- content views in trunk/sophie2-platform/modules/org.sophie2.main.view
- contents in trunk/sophie2-platform/modules/org.sophie2.main.model
How to demo
- Show the created demo and run the unit tests.
- Show the new frame and preview window.
Design
For now, because there are more important things to do, only the following pdf functionality should be implemented:
- Insert -> pdf in the menus.
- Dialog for choosing pdf file.
- Pdf frame which shows the first page of the chosen pdf.
You should create new module, named org.sophie2.extra.pdf, which consist of:
- model part
- PDFFrameContent
- PDFResource
- for now the resource should contain pdf file and pdf page num fields(properties)
- view part
- logic part
- PDFLogic which should use the new logic LogicR3 so it should be enum with operation for adding pdf frame
- Insert pdf item for the insert menu
- file dialog and file dialog input for opening pdf files
- content view and content view provider (more info about this will follow)
- logic part
- pdf module with needed extensions (insert menu item, the pdf dialog and pdf content view provider)
The content views in org.sophie2.main.view module need refactoring:
- There should be a FrameContentViewProvider extension point which should be used by the various frame contents and should create content views
- FrameContentViewFactory should be refactored to use modules, extension and extension points.
We should use the pdf-renderer(https://pdf-renderer.dev.java.net/) library which gives a way to create and image from a given pdf page so we can use ImageSceneElement auto property displaying the content.
Implementation
Testing
(Place the testing results here.)
Comments
(Write comments for this or later revisions here.)