shikasta-net / LabBook

Lab book on web2py
Apache License 2.0
4 stars 1 forks source link

Handling application/pdf content type #6

Closed almailer closed 11 years ago

almailer commented 12 years ago

Implement rendering of PDF files on labbook pages.

almailer commented 11 years ago

Should also get javascript to provide visual feedback (on drag over) for supported/unsupported mimetypes

almailer commented 11 years ago

Branch iss6_pdfjs addresses this, as exemplified in 3c6d23e. Remaining to be done:

almailer commented 11 years ago

Idea: Handle storage of attributes (e.g. pdf page, pdf zoom) as query string at end of file url, e.g.

pdfbox = row(x,y,w,h,content_type='application/pdf', content_id='/path/to/pdf/file.pdf?page=1&zoom=1.0

I finally realised how to properly do content-type specific parameters in the database.

Separate tables, e.g. content_box, content_image, content_pdf for each content type with a constraint on an id in the boxes table. For example, content_box has two fields, box_id and child_box_id, both of which must be references to boxes.id.

When rendering a box, a left join of boxes on all the content tables (if the convention is used that the table names all begin with content_, then processing db.tables will suffice to find all content tables) will provide all the information on a specific box.

almailer commented 11 years ago

Basic support is now in. You can: