Copy a page from document to another

Discuss PDF file handling with the Polybios plugin here
amiga23
Posts: 23
Joined: Thu Jan 30, 2014 6:01 pm

Copy a page from document to another

Post 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?

User avatar
airsoftsoftwair
Posts: 5041
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Copy a page from document to another

Post by airsoftsoftwair »

I'm afraid that's not possible currently. But some editing capabilities are planned for the future.

amiga23
Posts: 23
Joined: Thu Jan 30, 2014 6:01 pm

Re: Copy a page from document to another

Post 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.

evil
Posts: 162
Joined: Mon Jun 14, 2010 1:38 pm

Re: Copy a page from document to another

Post 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

plouf
Posts: 272
Joined: Sun Feb 04, 2018 11:51 pm
Location: Athens,Greece

Re: Copy a page from document to another

Post 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
Christos

evil
Posts: 162
Joined: Mon Jun 14, 2010 1:38 pm

Re: Copy a page from document to another

Post 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

plouf
Posts: 272
Joined: Sun Feb 04, 2018 11:51 pm
Location: Athens,Greece

Re: Copy a page from document to another

Post 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
Christos

evil
Posts: 162
Joined: Mon Jun 14, 2010 1:38 pm

Re: Copy a page from document to another

Post 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.

evil
Posts: 162
Joined: Mon Jun 14, 2010 1:38 pm

Re: Copy a page from document to another

Post 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

User avatar
airsoftsoftwair
Posts: 5041
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Copy a page from document to another

Post 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.

Post Reply