5 ms·
Seriously, this is just `window.print()`...
by cheeaun 8y ago
Seriously, this is just `window.print()`...
- shakna 8y agoYou weren't kidding! Inspect->Events->onClick function() { return window.print() } Though the codemirror stuff is probably a bit more work.
- hombre_fatal 8y agoYeah, the project is basically a React app that implements the plumbing for the editor vs preview panes, file selection, and the drag-n-drop file handler. Nothing wrong with that, but a project named "md2pdf" juxtaposed with onClick={window.print} is unexpected.
- realdennis 8y agoThe first problem I want to solve was that convert MD file to PDF. And I found the powerful way was browser print. It allows you zoom rate/choose page range. So, I dig in CSS media query and try to compatible cross browser(Chrome&FF). I made an editor in left side just cause sometimes we want edit some typo or something before convert...haha, codemirror makes a good user experience than textarea.
- cheeaun 8y agoYeah, that technically works ;) I was kind of expecting that the PDF generation is done with some script like https://github.com/mrrio/jspdf https://github.com/mrrio/jspdf and then rendered with https://github.com/mozilla/pdf.js https://github.com/mozilla/pdf.js :)
- hnthroaway1926 8y agodo you know if there is a way to remove the datetime stamp header that is inserted into the pdf when printing?
- hombre_fatal 8y agoOnce Chrome's print dialog pops up, you can expand "More settings" and then uncheck "Headers and footers".
- hnthroaway1926 8y agothanks, worth noting that the print dialog does not support that option when using Firefox on Windows
- frosted-flakes 8y agoI think you need to open it in Print Preview to change those settings, which is accessible in the main menu (there's not a keyboard shortcut, unfortunately).
- hanniabu 8y agoSmall preference would be for the edits on the left side to be saved in local storage for the next visit similar to dillinger.io
- deleted 8y ago[deleted]