Page 1 of 2

Copy a page from document to another

Posted: Mon Oct 12, 2020 10:50 pm
by amiga23
Is it possible to load a page from one PDF and safe it in another? Simple use case would be to split PDFs into single pages, or merge several pages into one document.

I did not find anything in the documentation how to do this.

addPage and insertPage only create empty pages.

Any hints?

Re: Copy a page from document to another

Posted: Wed Oct 14, 2020 10:37 pm
by airsoftsoftwair
I'm afraid that's not possible currently. But some editing capabilities are planned for the future.

Re: Copy a page from document to another

Posted: Sun Oct 18, 2020 2:30 pm
by amiga23
Thank you for the answer. In python I have also not found a framework so I am combining pypdf2 and pdfminer to achieve that feature.

An alternative could be to remove the unwanted pages. If that would be possible in future, would be great. Then I could simply create a copy of the document and remove pages to implement the split functionality. But no hurry if you have other priorities, I have a solution with python3 now.

Thank you for the many updates you provide.

Re: Copy a page from document to another

Posted: Sun Jun 19, 2022 2:16 am
by evil
Hiho!

Is there any progress in this part??

I need to copy pages of a pdf-file, too.

I tried to get pages with pdf.GetBrushfFromPage() and insert them with doc.CreateImageFromBrush().
pdf.GetBrushFromPage() creates VecotrBrushes, but doc.CreateImageFromBrush() seems to need Rasterised Brushes.

Of course, as workaround I could convert the Vectorbrush. But this needs some upscaling, as the target-file should be printed on paper, and though leads to heavy systemslowdown.

Is there any other solution, or am I totally wrong (again)??

Best regards

George

Re: Copy a page from document to another

Posted: Sun Jun 19, 2022 9:20 am
by plouf
The progress so far is that now you can copy-extract text from pages
Otherwise transofrm it to image is the only solution afaik

Some "workaround" is to use free external command line tools that give posibility to move-merge-exteaxt text and images and in rurn work with "extracted images"

Some of these tools are PDFtk. And ghostscript

Re: Copy a page from document to another

Posted: Sun Jun 19, 2022 1:52 pm
by evil
Well, PDFtk is not available for AmigaOS, and GhostScript does not have the corresponding features (afaik).
GhostScript can Create single pages from a larger PDF-File, but I want to create pages with more than one page on it, eg. brochures.
So far, it seems for me to use the workaround mentioned above...

Best regards

George

Re: Copy a page from document to another

Posted: Sun Jun 19, 2022 2:04 pm
by plouf
Yes ghostscript has merge pdf's ability and many more

E.g. gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=out.pdf in1.pdf in2.pdf

Re: Copy a page from document to another

Posted: Sun Jun 19, 2022 11:28 pm
by evil
But this only merges them one after another, doesn't it? I want to Create brochures, which have to print 2 pages on one paper (on one side...) for example...
Also i'd like to print more pages on one side of a paper than 2... For example 4 or eight pages on one page.

Re: Copy a page from document to another

Posted: Mon Jun 20, 2022 9:47 pm
by evil
On Whoosh777.com I found some interesting descriptions for GhostScript870.
Also Printing books and brochures seems to be possible with them. But It uses outdatet techniques...
You have to print a paper two times on the same side, to get two pages on it...

Would be great, If some pdf.CopyPage(), pdf.InsertPage() would get alive... At least inserting Vectorimages would help a lot..

Best regards

George

Re: Copy a page from document to another

Posted: Mon Jun 20, 2022 10:58 pm
by airsoftsoftwair
evil wrote: Mon Jun 20, 2022 9:47 pm Would be great, If some pdf.CopyPage(), pdf.InsertPage() would get alive... At least inserting Vectorimages would help a lot..
It's still planned but no work has been done so far so don't expect anything soon about this.