News for hackers. Stuff that matters.

seedgou

Re:Show HN: Make your PDF look scanned in browser on Tuesday April 19, 2022 @12:21PM (#31085284)
Oh! You mean the scanning speed. I thought you was talking about the original PDF preview. For now, scanning is using emscriptened ImageMagick Wasm. Due to the translation from C++ to Wasm, the scanning speed is very slow. Maybe re-writing blur, rotate and noise algorithm will speed up the scanning.
Re:Show HN: Make your PDF look scanned in browser on Tuesday April 19, 2022 @11:37AM (#31084585)
The rendering logic is in `src/utils/pdf/renderPage.ts` and has only 26 lines.
Re:Show HN: Make your PDF look scanned in browser on Tuesday April 19, 2022 @11:32AM (#31084513)
The site's logic is nearly identical to this gist: use ImageMagick to do the rotate, noise, etc.
Re:Show HN: Make your PDF look scanned in browser on Tuesday April 19, 2022 @11:25AM (#31084403)
Good idea! A random distribution on rotation seems a more user-friendly way instead of setting 10 rotation values.
Re:Show HN: Make your PDF look scanned in browser on Tuesday April 19, 2022 @11:23AM (#31084377)
I didn't manipulate the data in pixel level. Maybe because I render PDF in 2x which causes 4x more pixels?
Re:Show HN: Make your PDF look scanned in browser on Tuesday April 19, 2022 @10:56AM (#31083993)
There's an example PDF after clicking "START SCANNING" button. Maybe add more real-world examples.
Re:Show HN: Make your PDF look scanned in browser on Tuesday April 19, 2022 @10:46AM (#31083866)
This is inspired by baicunko/scanyourpdf and previous HN link: https://news.ycombinator.com/item?id=23157408
Re:Show HN: Make your PDF look scanned in browser on Tuesday April 19, 2022 @10:44AM (#31083833)
Use PDF.js and magica to do the rendering and processing. You could see the credits in GitHub repo page.