Discussion:
[Skim-app-users] Copying and pasting pages between PDF documents
Jean-Denis Muys
2008-04-21 09:03:10 UTC
Permalink
Hi,

I wasn't able to copy and paste a page from a PDF document into another with
Skim. Is there a way?

I *can* copy any *single* page from a document, and then use the "new from
clipboard" menu item, but:

1- I cannot copy *several* pages in the first step. Is there a way?
2- I cannot do it one page at a time because I cannot paste a page into an
existing document. Is there a way?

To give you some background:

I started to use Skim just a few days ago, mainly because of its Applescript
support. I need to be able to split very large PDF files (over 4000 pages)
into smaller pieces. Each piece may have a variable number of pages,
depending on the context (text) of the specific pages.

My script is sucessful in identifying the starting page and the ending page
of each segment.

However, I am stuck, as I cannot manage to extract those pages into a new
document.

I tried things like:

tell application "Skim"
make new document with data (pages 3 thru 5 of document 1)
end tell

But it failed with error message "Skim got an error: Applescript handler
failed".

Note that "make new document" works fine: Skim creates an empty document,
but then I cannot populate it, as I seem to misunderstand the "join"
statement, as in:

join pages 1 thru 4 of document "source.pdf" to document "dest.pdf"

Which fails with "can't get document "dest.pdf""

I am still not finished exploring, but I can't really see a promising track
a this point. I hope I don't have (for performance reasons), to fall down to
an algorithm along the lines of:

For each page subrange
duplicate source document
remove from duplicate all pages not belonging to current segment
rename and save duplicate document

I'd welcome some help.

Thanks,

Jean-Denis
Christiaan Hofman
2008-04-21 09:54:06 UTC
Permalink
Post by Jean-Denis Muys
Hi,
I wasn't able to copy and paste a page from a PDF document into another with
Skim. Is there a way?
I *can* copy any *single* page from a document, and then use the "new from
1- I cannot copy *several* pages in the first step. Is there a way?
2- I cannot do it one page at a time because I cannot paste a page into an
existing document. Is there a way?
No, not using Skim.
Post by Jean-Denis Muys
I started to use Skim just a few days ago, mainly because of its Applescript
support. I need to be able to split very large PDF files (over 4000 pages)
into smaller pieces. Each piece may have a variable number of pages,
depending on the context (text) of the specific pages.
My script is sucessful in identifying the starting page and the ending page
of each segment.
However, I am stuck, as I cannot manage to extract those pages into a new
document.
tell application "Skim"
make new document with data (pages 3 thru 5 of document 1)
end tell
But it failed with error message "Skim got an error: Applescript handler
failed".
Note that "make new document" works fine: Skim creates an empty document,
but then I cannot populate it,
This is not supported. The empty document is created by the system, it
shouldn't even happen.
Post by Jean-Denis Muys
as I seem to misunderstand the "join"
join pages 1 thru 4 of document "source.pdf" to document "dest.pdf"
The "join" command is used to join selections, not pages.
Post by Jean-Denis Muys
Which fails with "can't get document "dest.pdf""
I am still not finished exploring, but I can't really see a
promising track
a this point. I hope I don't have (for performance reasons), to fall down to
For each page subrange
duplicate source document
remove from duplicate all pages not belonging to current segment
rename and save duplicate document
I'd welcome some help.
Thanks,
Jean-Denis
In short: Skim does not support adding/removing/reordering pages in
any way.

Christiaan
Claus Atzenbeck
2008-04-21 11:37:58 UTC
Permalink
Post by Jean-Denis Muys
I started to use Skim just a few days ago, mainly because of its Applescript
support. I need to be able to split very large PDF files (over 4000 pages)
into smaller pieces. Each piece may have a variable number of pages,
depending on the context (text) of the specific pages.
My script is sucessful in identifying the starting page and the ending page
of each segment.
However, I am stuck, as I cannot manage to extract those pages into a new
document.
I would use a command line tool like pdftk. If your AppleScript works
for identifying the pages you need to extract, why don't you use it for
producing a shell script that calls pdftk with appropriate parameters?

Just for your information:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pdftk-1.41-1: Handy tool for manipulating PDF
If PDF is electronic paper, then pdftk is an electronic
staple-remover, hole-punch, binder, secret-decoder-ring,
and X-Ray-glasses. Pdftk is a simple tool for doing
everyday things with PDF documents. Use it to:
.
* Merge PDF Documents
* Split PDF Pages into a New Document
* Decrypt Input as Necessary (Password Required)
* Encrypt Output as Desired
* Fill PDF Forms with FDF Data and/or Flatten Forms
* Apply a Background Watermark
* Report PDF Metrics such as Metadata and Bookmarks
* Update PDF Metadata
* Attach Files to PDF Pages or the PDF Document
* Unpack PDF Attachments
* Burst a PDF Document into Single Pages
* Uncompress and Re-Compress Page Streams
* Repair Corrupted PDF (Where Possible)
.
Web site: http://www.accesspdf.com/pdftk
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

pdftk is available as Fink package. I am sure there are also other tools
that could do that.

Cheers,
Claus
Jean-Denis Muys
2008-04-21 12:12:57 UTC
Permalink
Post by Claus Atzenbeck
I would use a command line tool like pdftk. If your AppleScript works
for identifying the pages you need to extract, why don't you use it for
producing a shell script that calls pdftk with appropriate parameters?
Thanks for that. Yes it does look like pdftk will help.

That being said, I am still interested in understanding whether Skim could
be scripted to split/merge PDF files, if only to know whether I failed to
use it correctly, or whether it has limitation.

Is skim supposed to be able to paste PDF pages into a PDF document? Or to
copy more than one page at one time?

If it turns out that this is a Skim limitation, would there be an interest
for me to dive in the code and try to fix it? Or is this beyond its scope?

Regards,

JD
Claus Atzenbeck
2008-04-21 12:26:49 UTC
Permalink
Post by Jean-Denis Muys
Is skim supposed to be able to paste PDF pages into a PDF document? Or to
copy more than one page at one time?
See Christiaan's e-mail sent earlier.

Cheers,
Claus
Christiaan Hofman
2008-04-21 12:31:11 UTC
Permalink
Post by Jean-Denis Muys
Post by Claus Atzenbeck
I would use a command line tool like pdftk. If your AppleScript works
for identifying the pages you need to extract, why don't you use it for
producing a shell script that calls pdftk with appropriate
parameters?
Thanks for that. Yes it does look like pdftk will help.
That being said, I am still interested in understanding whether Skim could
be scripted to split/merge PDF files, if only to know whether I failed to
use it correctly, or whether it has limitation.
Is skim supposed to be able to paste PDF pages into a PDF document? Or to
copy more than one page at one time?
I answered that question: Skim does not support this. You may search
this list form a recent discussion about the reasons.
Post by Jean-Denis Muys
If it turns out that this is a Skim limitation, would there be an interest
for me to dive in the code and try to fix it? Or is this beyond its scope?
Regards,
JD
No, as noted in the earlier thread it's incompatible with some
fundamental features of Skim. So it's beyond it's scope.

Christiaan

Continue reading on narkive:
Loading...