PDA

View Full Version : PagePacker print service


Schimmi
2007-12-30, 01:31 AM
Save the following as AppleScript in "Library/PDF Services". It will show up in the print dialog in the PDF popup:

on open these_items

try
set f to the item 1 of these_items

tell application "PagePacker"
set page size to A4
make new document
tell document 1
set file source of page 1 to f
end tell
tell application "System Events"
tell process "PagePacker"
activate
set frontmost to true
keystroke "p" using command down
end tell
end tell
end tell

on error error_message number error_number
if the error_number is not -128 then
tell application (path to frontmost application as string)
display dialog error_message buttons {"OK"} default button 1
end tell
end if
end try

end open

Stefan

RobTrew
2007-12-30, 02:59 AM
Wonderful. Thank you !

For those who have not downloaded the PagePacker print utility, it is at:

http://weblog.bignerdranch.com/?p=23

set page size to A4may not suit all.

I think that letter size is probably the Pagepacker default, but in any case the PagePacker Applescript dictionary allows for

set page size to letter

Schimmi
2007-12-30, 03:31 AM
To make the whole process perfect I want to open the print dialog for a "print" perspective automatically via AppleScript, and then run the "Print to PagePacker" service. But it seems this is not so easy. There are several threads on the web about scripting the printing dialog, but none has a clean solution.

Stefan

mdconrad
2008-01-08, 10:54 PM
When I try this all I get is an OF dialog reading "Print - Error while printing." Any idea about what I'm screwing up? I follow the instructions word-for-word and also tried A4 and Letter. I'm using OmniFocus/1.0/final-v77.1.2 on Leopard.

bcalloway
2008-01-11, 06:45 AM
I'm getting the same error. Would love to know if anyone has found a fix for this, as it seems like a great add-on.

Schimmi
2008-01-11, 07:32 AM
Hallo!

I have changed my process of printing with PagePacker now in the following way:

* I have created a PDF printer with the cups-pdf package. This is used to print the "Drucken" perspective from OmniFocus into the folder ~/Desktop/cups-pdf.
To create a perspective which always prints to the PDF printer, I think, the only way is to change the default printer to the PDF printer OSX wide, then recreate the "Printing" perspective. After that you can change the printer back to your normal printer. The perspective will remember the PDF printer though.
* Then I attached the following script to that folder as an folder action:

on pagepack(f)
tell application "PagePacker"
activate
set page size to A4
make new document
set doc to document 1
tell doc
delay 1
set file source of page 1 to f
delay 1
end tell
set win to window 1 where its document is doc
set winname to name of win as Unicode text
tell application "System Events"
tell process "PagePacker"
activate
set frontmost to true
set evwin to window 1 where its name is winname
keystroke "p" using command down
repeat until (count of sheets of evwin) is not 0
end repeat
repeat while (count of sheets of evwin) is not 0
end repeat
end tell
end tell
close win without saving
delay 2
quit
end tell
end pagepack

on adding folder items to this_folder after receiving added_items
try
set f to (first item of added_items)
pagepack(f)
tell application "Finder"
delete f
end tell
end try
end adding folder items to

on run
tell application "OmniFocus"
print (perspective "Drucken") without print dialog
end tell
end run


This code takes the PDF from the cups-pdf printer, puts it into PagePacker, calls the print dialog of PagePacker and after printing it deletes the pdf file and closes PagePacker. Works fine for me (most of the times, once in a while PagePacker does not get the pdf, no idea why. But only once out of 10 or so).

The trouble with the PDF printer is really needed I fear, because OSX has no way to call the "Export to PDF" action in the print dialog via AppleScript. There are plenty of threads on the web with half working solutions. But nothing reliable and easy.

Schimmi

jbursztyn
2008-01-24, 06:19 AM
Shimmi,

hi, I have tried to follow your instructions to get this to work, but I feel I am not that technical or there is something I am missing. Here is what I did.

I installed cups-pdf
I created a perspective for it to print.
I created an applescript with your code changing the Drunken for my perspective.
I attached that applescript to the cups-pdf folder as a folder action.

Now I dont know how or understand how to execute the print. I tried printing the perspective from OF using the cups-pdf and it does not work. Please explain how I should use this.

thanks

Jack

nrp
2008-08-19, 05:06 AM
Hi jbursztyn,

I had the same problem as you. I found Shimmi's script has to be saved in /Library/Scripts/Folder Script Actions. Once here you can run the script directly.

troybail
2010-06-26, 01:14 AM
Hallo!
This is used to print the "Drucken" perspective from OmniFocus ....


Sorry if a bit off topic ... but what is the "Drucken" perspective? I've been unsucessful at getting my OF output to have a readable font size when sent to Page Packer ... (except by toggling the "Change All Font Sizes" from Preferences>Style). Would be great if "Style" info could be saved into the Perspective itself.

troy

Brian
2010-06-26, 06:13 AM
Troy, "Drucken" is German for "Print". :-)

Pretty sure we have a feature request open on saving Page Setup info on a per-perspective basis; if you email the support ninjas (Omnifocus@omnigroup.com), they can vote that up on your behalf.