wiki:BOOK_STATIC_PDF_EXPORT_R0
Last modified 16 years ago Last modified on 05/26/09 15:40:07

Error: Macro BackLinksMenu(None) failed
compressed data is corrupt

Error: Macro TicketQuery(summary=BOOK_STATIC_PDF_EXPORT_R0, format=table, col=summary|owner|status|type|component|priority|effort|importance, rows=description|analysis_owners|analysis_reviewers|analysis_score|design_owners|design_reviewers|design_score|implementation_owners|implementation_reviewers|implementation_score|test_owners|test_reviewers|test_score|) failed
current transaction is aborted, commands ignored until end of transaction block

Analysis

Overview

The task is to create a way for a Sophie 2.0 Book to be exported in PDF file. Dialogs should appear - one with the PDF options and one with where to save the PDF file.

Task requirements

From the user point of view the PDF exporting should fulfill these requirements:

  • PDF export must be selected from menu File -> Export As... -> PDF
    • This should invoke a dialog window
      • This dialog gives the opportunity to choose where the file will be saved
      • And asks the user to enter a file name, even when the user didn't specify extension a .pdf file is created
    • A message that warns for loss of the video content and some interactivity (timelines and etc.) should appear
  • Other option is File -> Exports as PDF, this should be discussed and considered in the design phase.
  • In this first revision, a dialog with PDF options won't appear, but you must consider the previous requirements when you're designing this task.
  • The created PDF document must represent something like a snapshot of the original book in preview mode
    • The video clips can be replaced with a picture (screenshot of the movie)
    • Because the PDF export is similar to the book in preview mode this suggests that frame borders (when they are 0), page borders, halos and HUDs won't be visible
      • When frame border is different than 0, the frame has a border that is visible in the preview mode, so this will also be reflected in the PDF document, but frame borders (with value 0) must not be visible, otherwise our book will look like lots of rectangulars filled with text, however this could be achieved if it is user's initial idea, when a value greater than 0 is set for the frame border.
      • The same must be applied to the page border, when it isn't modified, it shouldn't be displayed in the PDF, otherwise the PDF must include the page border.
    • The option which gives the user opportunity to choose whether the text will or won't be selectable will be good (this will solve some copyrights issues). This probably is going to be done in later revisions of this task.
    • The images must be preserved as vectors when possible. For example if you include a vector image in your book in the PDF export this image will be also vector image (not sure if we support such file formats now). However the screenshots supposed to subsitute the video clips in the PDF document and other raster images used in the book, won't be vectors.
    • The audio content on the page won't be represented if it is on background or part of timeline. However if you have audio frame on the page probably it is a good idea to have at least the name of the audio file (or some metada like artist and track for example) in the PDF document.

Task result

  • The result of this task should be source code.

Implementation idea

How to demo

  • Run Sophie 2.0.
  • From "File" menu choose "Print To PDF" item.
  • A dialog should appear for the user to choose the directory where to save the newly created file.
  • Press "OK".
  • In the directory that the user has chosen should appear a PDF file with the content of the book.

Design

  • Create new package org.sophie2.extra.func.print.pdf.export in the org.sophie2.extra.func.print. For now, it is a better idea the code for the pdf export to be in the existed module rather than to be put in a new module.
  • In the File Menu of the application add "Export To PDF" menu item. Create ExportToPDFItem class in the newly created package.
  • Create ExportToPDFLogic class that will handle clicks perform over ExportToPDFItem menu item.
  • Create a static method getFile(BookView view) in the ExportToPDFItem that will show a dialog to choose where to save the new file.
  • Make the paintComponent(Graphics graphics) method from the SimpleSceneVisual class use a SceneHelper class static "paint" method. The idea is to provide the same logic for drawing a part of a scene over given graphics. Use the newly created method to draw over a PDF document.
  • Over the PDF file will be drawn everything that is visible on the scene at the moment of exporting. In other words, if there is a movie frame on the scene, in the pdf file it will appear this frame of the movie that is drawn over the scene at the moment of exporting.
  • ExportToPDFSystemTest -> 2847

Design related code is merged into the trunk in [2872].

Implementation

2866
2862
2847
2678

Merged to the trunk in [2881].

Testing

(Place the testing results here.)

Comments

  • It will be better if the menu item is named "To PDF" and is part of a submenu called "Export" since we will have HTML, Sophie 1, etc
  • The button should invoke File Dialog with extension PDF selected.
  • It is important which part of the book will be printed - will it be the page, will it include border?
  • How we will present the video frames for example? Should the pdf include frame bounds? I guess it will be good if the print is the same as the preview of the book.
  • I guess "static" means that the text won't be selectable and the graphics will be like images, not like vectors? please clarify