Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Splitting PDFs into single pages



At 12:07 PM +1100 1/25/07, Tim Mansour wrote:
I notice that by using BeginPDF I don't have to open a graphic window at all. I'm currently playing with something like this...

set original_pdf to (choose file of type "com.adobe.pdf" without invisibles)
set r to GetMediaBox(original_pdf)
set page to 1
BeginPDF(r)
DrawPDF(original_pdf, {0, 0}, "", page)
set pdata to EndPDF()
set the_name to "page " & page & ".pdf"
tell application "Finder" to set the_file to (make new file at desktop with properties {file type:fourzero, name:the_name}) as alias
write pdata to the_file


... and that seems to work. But I want this to be in a loop in order to make one PDF per page, so that raises two questions:

1. How do I determine the number of pages in original_pdf?

count pages theFile

2. How do I deal with situations where pages in original_pdf are of different sizes?

pdf boxes theFile page iPage

(all is in Smile's dictionary)

Emmanuel
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-users/email@hidden
Archives: http://lists.apple.com/mailman//archives/applescript-users

This email sent to email@hidden
References: 
 >Splitting PDFs into single pages (From: Tim Mansour <email@hidden>)
 >Re: Splitting PDFs into single pages (From: Emmanuel <email@hidden>)
 >Re: Splitting PDFs into single pages (From: Tim Mansour <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.