diff --git a/codepot/src/codepot/views/code_file.php b/codepot/src/codepot/views/code_file.php index 46969f63..34009e9b 100644 --- a/codepot/src/codepot/views/code_file.php +++ b/codepot/src/codepot/views/code_file.php @@ -127,6 +127,7 @@ var pdf_rendering_in_progress = false; var pdf_page_num_pending = null; var pdf_canvas = null; var pdf_ctx = null; +var pdf_scale = "fw"; function render_pdf_page (num) { @@ -134,7 +135,11 @@ function render_pdf_page (num) // Using promise to fetch the page pdf_doc.getPage(num).then(function(page) { var vp1 = page.getViewport (1); - scale = ($('#code_file_result').innerWidth() - 20) / vp1.width; + var scale; + if (pdf_scale == "fw") + scale = ($('#code_file_result').innerWidth() - 20) / vp1.width; + else + scale = parseFloat (pdf_scale); var viewport = page.getViewport(scale); pdf_canvas.height = viewport.height; pdf_canvas.width = viewport.width; @@ -320,6 +325,11 @@ $(function () { queue_pdf_rendering_in_progress (pdf_page_num); }); + $('#code_file_pdf_scale').change (function () { + pdf_scale = this.value; + queue_pdf_rendering_in_progress (pdf_page_num); + }); + }); @@ -565,6 +575,10 @@ if ($login['settings'] != NULL && print '/'; print ''; print ''; + print ''; print ''; print ''; }