-
Notifications
You must be signed in to change notification settings - Fork 57
Add support for text markup annotation #121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
Changing eslint and the yarn.lock doesn't seem related to that PR. Can you split it into 2 PRs please? |
|
Okey, this PR is ready for review! |
|
|
||
| const quadPointsArray = context.obj( | ||
| [ | ||
| options.quadPoints.leftbottomX, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to the PDF Spec, the order should be: leftBottom, rightBottom, rightTop, leftTop, meaning that you probably inverted the top part.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, sorry for that. I fixed it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait, I remembered now why I did this.
https://stackoverflow.com/questions/9855814/pdf-spec-vs-acrobat-creation-quadpoints
It seems that Adobe implemented the last two corners horizontally inverted.
I tried the order in the spec and became like this hourglass shape:

/QuadPoints [69.9398 58.8418 96.5932 58.8418 96.5932 47.3526 69.9398 47.3526 ]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
↑forgot to mention: The image is rendered by Adobe Acrobat
| /** | ||
| * The quad points that define the region(s) to be marked up. | ||
| */ | ||
| quadPoints: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a very annoying data format. Please use Rect instead. Way easier to manipulate!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean Rect as src\utils\elements\Rectangle.ts?
Actually, qualPoints also covers trapezoids and hourglass shapes, not only rectangles. So I think that is not a good idea
my experiments (sorry it's in Japanese): https://qiita.com/konbraphat51/items/a7ddb30e5277d5e10a5a#%E8%9D%B6%E3%81%A4%E3%81%8C%E3%81%84
This needs further discussion according on https://stackoverflow.com/questions/9855814/pdf-spec-vs-acrobat-creation-quadpoints This reverts commit 2f8db96.
What?
This add supports reading and writing text markup annotation objects.
This adds:
PDFPage.addTextMarkupAnnotation()to add text markup annotation objectReading
PDFPage.annotations()PDFAnnotationclass instancesEditing
PDFAnnotationclassAdding
PDFPage.addTextMarkupAnnotation()Why?
How?
PDFAnnotationclass instance.PDFAnnotationTesting?
New Dependencies?
N/A
Screenshots
This is created by this code:
Suggested Reading?
Anything Else?
N/A
Checklist