From 132ffec8601c54549eb3ce3771859ed8b9139dda Mon Sep 17 00:00:00 2001 From: tuancoltech Date: Tue, 12 Dec 2023 21:10:56 +0700 Subject: [PATCH] Set the Medium PDFQuality render configure to 50 pixels to prevent a crash with Medium profile: render_preview_page --- src/pdf.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pdf.rs b/src/pdf.rs index 9ad4bb9..4947baa 100644 --- a/src/pdf.rs +++ b/src/pdf.rs @@ -11,6 +11,7 @@ use log::debug; static PDFIUM: OnceCell = OnceCell::new(); // static initializers must impl Sync + Send +#[derive(Debug)] pub enum PDFQuality { High, Medium, @@ -42,7 +43,7 @@ where debug!("render_preview_page PDF 2"); let render_cfg = match quailty { PDFQuality::High => render_cfg.set_target_width(2000), - PDFQuality::Medium => render_cfg, + PDFQuality::Medium => render_cfg.thumbnail(50), PDFQuality::Low => render_cfg.thumbnail(50), } .rotate_if_landscape(PdfBitmapRotation::Degrees90, true);