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

Help: Copy all page content to a new pdf file #37

Closed
bn3t opened this issue Sep 30, 2018 · 11 comments
Closed

Help: Copy all page content to a new pdf file #37

bn3t opened this issue Sep 30, 2018 · 11 comments

Comments

@bn3t
Copy link

bn3t commented Sep 30, 2018

Hi,
I want to merge pages from 2 pdfs files into one. I already have such a tool that I wrote in GO but I want to rewrite it in Rust using lopdf.

This is the state of where I am: https://gist.github.com/bn3t/1508f3526bc4ca894f818182bf23e602. It tries to copy page 1 of the input document to the doc document but still produces a white page.

Would you be so kind to indicate the step needed to achieve this?

@J-F-Liu
Copy link
Owner

J-F-Liu commented Oct 5, 2018

There are many objects related to pages, in Resources. To merge 2 pdf files, merge all the objects, then rearrange trailer, Catalog and Pages objects.

@yodatak
Copy link

yodatak commented Mar 13, 2019

Hi i'm interested in this did you achieve @bn3t ?

@bn3t
Copy link
Author

bn3t commented Mar 16, 2019

Hi @yodatak, no I didn't make any progress on this. In the meanwhile, I still use a small tool I've wrttten in Go with Unidoc : pdfmerge

@edulix
Copy link

edulix commented Sep 17, 2019

@J-F-Liu is this easy to do? can you provide some tips or some sample code?

@J-F-Liu
Copy link
Owner

J-F-Liu commented Sep 18, 2019

I use pdfunite to do the job.

@edulix
Copy link

edulix commented Sep 18, 2019

I meant if it is easy to do with lopdf library, although thanks for the recommendation.

@J-F-Liu
Copy link
Owner

J-F-Liu commented Sep 18, 2019

It is possible, but need to sort out a detailed algorithm.

@bn3t
Copy link
Author

bn3t commented Sep 19, 2019

It seemed far fetched for me to do it with lopdf. I still use the tool I wrote in go and does exactly what I needed: /~https://github.com/bn3t/pdfmerge.

@Emulator000
Copy link
Contributor

Emulator000 commented Sep 25, 2020

@bn3t @edulix actually I did this.

I created a PR #117 with all necessary code.

Once @J-F-Liu will merge it, you'll able to this with this Rust library.

@robyoung
Copy link

Can this issue be closed now? There is an example for merging PDFs in the docs now.

@bn3t
Copy link
Author

bn3t commented Dec 5, 2023

Yes thanks a lot.

@bn3t bn3t closed this as completed Dec 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants