Skip to content
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

Embed multiple files #27

Open
michd89 opened this issue Feb 15, 2019 · 8 comments
Open

Embed multiple files #27

michd89 opened this issue Feb 15, 2019 · 8 comments
Labels
enhancement New feature or request

Comments

@michd89
Copy link

michd89 commented Feb 15, 2019

Currently the addAttachment function is able to embed one single file only. If this function is called for another file, an existing attachment is overwritten. It would be useful to be able to attach multiple files (either with this or with a separate function).

@claird
Copy link
Owner

claird commented Feb 15, 2019 via email

@acsor acsor added the enhancement New feature or request label Feb 16, 2019
BelieveC added a commit to BelieveC/PyPDF4 that referenced this issue Feb 16, 2019
@BelieveC BelieveC mentioned this issue Feb 16, 2019
@michd89
Copy link
Author

michd89 commented Feb 18, 2019

I'd suggest an additional function (e.g. appendAttachment) as a prevention of confusion.

Since I need such a functionality at work I'm trying to implement it by myself. As far as I see the only issue might be the automatical selection of new object-IDs without overlapping with existing ones.

@claird
Copy link
Owner

claird commented Feb 18, 2019 via email

@michd89
Copy link
Author

michd89 commented Feb 18, 2019

Does PyPDF somewhere make arrangements for updating the xref table when the PDF content is changed?

@michd89
Copy link
Author

michd89 commented Feb 20, 2019

I see it does.
By now I added a function which receives a file path or a list of file paths and adds them to the PDF (2210451). However existing attachments will be overwritten.
Passing file paths instead of streams might be a bit more convenient.

@acsor
Copy link
Collaborator

acsor commented Feb 22, 2019

@michd89 I glanced over your code and that sounds about great. If on the future you plan to do a PR for some of your enhancements, would you be able to provide some unit tests for your code? It's very important.

A full listing of the contribution guidelines can be found here (in particular, you might consider adding a docstring documentation to your newly added method).

Keep up the good work 👍.

@michd89
Copy link
Author

michd89 commented Feb 25, 2019

@Newnone Thank you very much for your hints. I (hopefully correctly) implemented them and did a PR.

@acsor
Copy link
Collaborator

acsor commented Feb 25, 2019

I notice some unit tests, which looks quite good. Just leave me a few days and will be able to review your PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants