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:
Save a figure. URL is /figure/file/ID/. Then add pdf/ to the URL: /figure/file/ID/pdf/. This should generate a PDF.
OR, if you can't save a figure (e.g. loading images from IDR) then go to /figure/pdf/ (can be on a different server) and paste in the figure JSON (e.g. use the JSON in the 'Sample JSON' tab below. Click the button and this will generate the PDF:
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}
```
Still a LOT to do (maybe some of this can be left for a follow-up PR:
[ ] Support ALL shapes (only Line and Arrow done currently)
[ ] Handle panel rotation
[ ] Handle multiple pages
[ ] Glencoe feature of shape labels
[ ] Interpolation / DPI handling
[ ] Info page with links, thumbnails, figure Legend etc.
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:
/figure/file/ID/
. Then addpdf/
to the URL:/figure/file/ID/pdf/
. This should generate a PDF./figure/pdf/
(can be on a different server) and paste in the figure JSON (e.g. use the JSON in the 'Sample JSON' tab below. Click the button and this will generate the PDF: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} ```Still a LOT to do (maybe some of this can be left for a follow-up PR: