ome / omero-figure

An OMERO.web app for creating Figures from images in OMERO
http://figure.openmicroscopy.org
GNU Affero General Public License v3.0
15 stars 30 forks source link

Pdf export with js #452

Closed will-moore closed 2 years ago

will-moore commented 2 years ago

This is a work in progress to use jsPDF to create figure PDFs in the browser and allowing download, removing the need to run export scripts on the server.

To test:

Sample JSON ``` {"version":5,"panels":[{"baseUrl":"http://idr.openmicroscopy.org/webclient","channels":[{"active":true,"coefficient":1,"color":"00FF00","emissionWave":null,"family":"linear","inverted":false,"label":"lynEGFP","reverseIntensity":false,"window":{"end":246,"max":255,"min":0,"start":3}},{"active":true,"coefficient":1,"color":"FF0000","emissionWave":null,"family":"linear","inverted":false,"label":"NLStdTomato","reverseIntensity":false,"window":{"end":133,"max":255,"min":0,"start":6}}],"datasetId":10262,"datasetName":"membranes_nuclei","deltaT":[],"dx":0,"dy":0,"height":133.12479952632185,"imageId":9836998,"labels":[{"color":"00FF00","position":"topleft","size":"14","text":"lynEGFP"},{"color":"FF0000","position":"topleft","size":"14","text":"NLStdTomato"},{"color":"000000","position":"top","size":14,"text":"membranes_nuclei"}],"max_export_dpi":1000,"name":"03887B26C1","orig_height":788,"orig_width":1584,"pixel_size_x":0.15,"pixel_size_x_symbol":"µm","pixel_size_x_unit":"MICROMETER","rotation":0,"scalebar":{"color":"FFFFFF","font_size":"10","length":30,"position":"bottomright","show":true,"show_label":true,"units":"MICROMETER"},"selected":false,"shapes":[{"id":-8480177427212277,"strokeColor":"#FFFF00","strokeWidth":3,"type":"Arrow","x1":602.933413874848,"x2":418.5126552250349,"y1":76.07356294304792,"y2":433.3887828270608},{"id":-6564188675200247,"strokeColor":"#FFFFFF","strokeWidth":3,"type":"Arrow","x1":1181.5535441386367,"x2":1070.9010889487488,"y1":656.9989526899593,"y2":474.8834535232688}],"sizeT":1,"sizeZ":142,"theT":0,"theZ":71,"width":267.6011198600175,"x":36.513661900474446,"y":108.00454876255144,"zoom":100},{"baseUrl":"https://idr.openmicroscopy.org/webgateway","channels":[{"active":true,"coefficient":1,"color":"FFFFFF","emissionWave":null,"family":"linear","inverted":false,"label":"0","reverseIntensity":false,"window":{"end":6000,"max":65535,"min":0,"start":1500}}],"datasetId":10201,"datasetName":"Intestinal Organoids","deltaT":[],"dx":0,"dy":0,"height":166.31508315778007,"imageId":9822152,"labels":[{"color":"000000","position":"top","size":14,"text":"Intestinal Organoids"}],"max_export_dpi":1000,"name":"hSIOs-2","orig_height":93184,"orig_width":144384,"pixel_size_x_symbol":"µm","pixel_size_x_unit":"MICROMETER","rotation":0,"selected":false,"sizeT":1,"sizeZ":1,"theT":0,"theZ":0,"width":218.20096201408023,"x":317.58627516446427,"y":108.00454876255144,"zoom":263}],"paper_width":595,"paper_height":842,"page_size":"A4","page_count":1,"paper_spacing":50,"page_col_count":1,"height_mm":297,"width_mm":210,"orientation":"vertical","legend":"","legend_collapsed":true,"page_color":"FFFFFF","figureName":"IDR pdf demo","fileId":13379} ```

Screenshot 2021-11-25 at 14 37 32

Still a LOT to do (maybe some of this can be left for a follow-up PR: