personalizedrefrigerator / js-draw

Draw pictures using a pen, touchscreen, or mouse! JS-draw is a freehand drawing library for JavaScript and TypeScript.
https://personalizedrefrigerator.github.io/js-draw/typedoc/
MIT License
79 stars 8 forks source link

Import PDF in A4 format for better export experience #77

Open tobias0409 opened 1 month ago

tobias0409 commented 1 month ago

Is your feature request related to a problem? Please describe. I want to import an A4 PDF file into js-draw. Each page should be automatically scaled to fit perfectly on an A4 page when I export the Markdown file to a PDF (via Joplin?).

Describe the solution you'd like The end result should be a nice, annotated PDF. Each PDF page should be exactly one page when exported after editing. Assuming that the imported PDF was also A4 should make it easier?

Additional context As a computer science student, I often have exercise sheets in PDF format with tables to fill in or blank areas for calculations. It would be great to import the PDF file, make the changes and then export it as the same PDF file as before.

personalizedrefrigerator commented 1 month ago

Fixing this issue through js-draw or the Joplin plugin

Here are a few possible approaches for fixing this issue:

Workaround

The end result should be a nice, annotated PDF. Each PDF page should be exactly one page when exported after editing. Assuming that the imported PDF was also A4 should make it easier?

In the markdown editor, provided that the js-draw image is perfectly cropped to the original PDF pages, it should be possible to export to PDF by adding the following CSS to the end of a note, then exporting the note to PDF:

<style>
    /* Assumes that the Joplin note contains a single image */
    img { width: 100vw; }
    @page {
        size: auto; /* Change this to a4 or letter to match the original document size. */
        margin: 0;
    }
    * {
        margin: 0 !important;
        padding: 0 !important;
    }
</style>