Repository navigation
Enhancement (config): Add option $mergeInkStrokes to merge strokes of pen/hand written drawings into a single image - #203
Open
Open
Conversation
…of pen/hand written drawings into a single image OneNote exports each stroke of a pen/hand written drawing (`InkDrawing`) as a separate image in the `.docx`, without its position. In the converted markdown, the strokes of a drawing end up lined up next to each other. `$mergeInkStrokes = 2` renders the strokes of each drawing into a single image, preserving the position of each stroke: - The strokes are read from the page content (Ink Serialized Format), which contains their positions on the page, and are rendered using WPF. - The stroke images in the `.docx` are identified by their size, which is the size of the stroke plus a padding of about 8.25 points, in the same order as in the page content. - Each group of adjacent stroke image references in the markdown is replaced with a single image. The default `$mergeInkStrokes = 1` keeps the existing behavior. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…eInkStrokes = 2` Strokes drawn on an image, e.g. annotations on a pasted lecture slide, were merged into a separate image below the image they were drawn on. Now such strokes are rendered on a copy of the image they were drawn on, in the image's resolution: - Images in outlines have no position in the page content. Their position is determined from the outline's position and the heights of the paragraphs preceding or following the image, if those are known, i.e. images and empty paragraphs (a single line in the paragraph style's font). If all heights are known, they must add up to the outline's height, or else no position is determined. - The images in the `.docx` are identified by their size, in the same order as in the page (top to bottom). - A stroke is drawn on an image if its center is within the image. The image is extended if strokes exceed it. - Strokes that are not drawn on an image are merged into a single image as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #200
OneNote exports each stroke of a pen/hand written drawing (
InkDrawing) to the.docxas a separate image, without its position. So in the markdown, the strokes of a drawing are lined up next to each other, and strokes drawn on an image (e.g. annotations on a pasted lecture slide) end up below that image. See Known Issues inREADME.md.Changes
$mergeInkStrokes:1keeps each stroke as a separate image (default, existing behavior),2merges the strokes:.docxare identified by their size (the stroke's size plus a padding of about 8.25 points), in page order. Stroke images that cannot be identified are kept as they are.README.md: Known Issues mention the option.Tests: unit tests for the new functions and the config option (rendering tests are skipped on non-Windows). Unit tests pass on Windows PowerShell 5.1 and PowerShell 7.0. In this repo's CI (run on my fork), all jobs that can currently run pass: Windows PowerShell 5.1 (
windows-2022) and PowerShell 7.1 to 7.4. The other jobs currently fail for any PR, before checkout: thewindows-2019runner image was retired, and the PowerShell 6.0 to 7.0 container images are too old foractions/checkout(GLIBC_2.28' not found). Also tested on real notebook pages: the calculated image positions matched OneNote's own PDF export within 0.2 points, and the pages convert identically on both PowerShell versions.🤖 Generated with Claude Code