stephanrauh / ngx-extended-pdf-viewer

A full-blown PDF viewer for Angular 16, 17, and beyond
https://pdfviewer.net
Apache License 2.0
480 stars 182 forks source link

Do not round the drawings #2607

Open BossuytWannes opened 6 days ago

BossuytWannes commented 6 days ago

Is your feature request related to a problem? Please describe. Is there a way that when you draw on the pdf that the lines do not get redrawn. The lines that are drawn get rounded, which I want to disable.

Describe the solution you'd like Make an option to not round the lines.

Additional context Using version 17.4.10 currently

stephanrauh commented 6 days ago

You request requires a modification of https://github.com/stephanrauh/pdf.js/blob/bleeding-edge/src/display/editor/ink.js#L666-L667 and https://github.com/stephanrauh/pdf.js/blob/bleeding-edge/src/display/editor/ink.js#L678-L679. If you replace the divisor "3" by a bigger value, there's less smoothing. I guess if you pass a million, you've reached your goal.

Currently, this parameter is a fixed value. I'd like to make this a variable that can be set by the user. You know, I've got the opposite problem you have: when I try to write my name, you can't read it. I need more smoothing for creating a readable signature. Maybe I'm a particularly clumsy person, but I think many people think like me. Or like you. :)

stephanrauh commented 6 days ago

If I'm not mistaken, you're a long-term user of the library, so you know the drill: I'll implement the improvement in version 22. It's difficult for me to back-port it to version 17. At the moment, new issues pop up faster than I can close them, so please bear with me.

BossuytWannes commented 4 days ago

I'll look into upgrading my project, then I'll be able to include version 22. Thanks for the effort!

stephanrauh commented 4 days ago

Perfekt. BTW; Yesterday, I started implementing the feature, and there's some progress.

stephanrauh commented 9 hours ago

I've implemented a prototype, but the result is underwhelming. Maybe that's caused by my computer: My drawings have so many points that they cover almost every pixel, so smoothing doesn't do much of a difference.

Is it different on your machine? To test this, please navigate to https://pdfviewer.net/extended-pdf-viewer/export-annotations and draw a simple line. After that, klick on "export annotations". How many "points" are in the exported data?