-
-
Notifications
You must be signed in to change notification settings - Fork 647
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
Add getAttachments to PDFDocument #1242
base: master
Are you sure you want to change the base?
Conversation
This adds the getAttachments method to get all the attachments from a pdf document. This is basically implementing the suggestion in Hopding#534 (comment) There's some interesting behavior here, as the attachments don't show up until after save is called. That's tested in the test and described in the README, just so it's clear that's the behavior. I don't know how to do all that great jsfiddle setup, so for the README Ijust copied the basic example from that issue for now.
Can we merge this? Need this +1 |
Hello sverch, is this feature still available? I want to read the data out of a .csv attachment and I think with this feature I can do it. Thanks in advance and keep up the great work |
@SpinatmitBlub I don't have contributor access to this repository, and it needs one approving review. There may be more things @Hopding wants to see before this is merged, or he may just be busy with other things. If you want to use this right now, you'd have to use a custom version of this library based off this branch. I haven't tested it, but it might be something like |
Thx for the quick response. I will give it a try and hope that it will work. Otherwise i hope that it will be implemented in the next version. |
Are there any updates on this? I'd love to see it get merged into the code base. |
Truly a great feature. Shame that this library isn't getting the love that it deserves. Great project. But hasn't received any merges since 2021. |
@sverch maybe you could open a pr at https://github.com/cantoo-scribe/pdf-lib? they seem to maintain the project further as long as this one is stale. Would love to see it merged! :) |
What?
This adds the getAttachments method to get all the attachments from a pdf document.
Why?
This is basically implementing the suggestion in #534 (comment), where the use case was discussed. Mine is that I am looking into how to delete attachments, and this seemed like a prerequisite for that.
How?
I mostly copied the code from comments in that issue. There's some interesting behavior with
save
, as the attachments don't show up until aftersave
is called. That's tested and described in the README, just so it's clear that's the behavior, but I don't know if it's desired.Testing?
Added some unit tests for this function and for
attach
.New Dependencies?
N/A
Screenshots
N/A
Suggested Reading?
No, I hadn't seen that (and unfortunately the link is currently a 404). Besides the broken link I appreciate that section and am curious if you know if the spec is still available somewhere.
Anything Else?
I don't know how to do all that great jsfiddle setup, so for the README I just copied the basic example from that issue to start somewhere.
Also, thank you for this project!
Checklist