Printing 2 Invoices on 1 page?

I really hope someone has an answer to this as I have searched far and wide and come up with nothing, so thanks in advance to all your help.

I used to have my invoices take up an entire page which I'd then print twice. I wanted to save my company some money and our environment some trees by printing an invoice twice on one sheet, with half the sheet going to the customer and the other to myself. I went and scaled everything back and resized the invoice to a half page so that two would cleanly fit on one sheet when I print, but for the life of me I can't figure out how to actually print the thing and get two copies to show on a single page. I literally just want to take whats on one half of the page and have it cloned to the other half when it prints. I hope this is pretty clear to anyone reading this, but I'm going crazy trying to figure this out so it may not be explained as well as I'd like. Thanks Again.

MacBook Pro 17" i7, Mac OS X (10.6.3)

Posted on May 29, 2010 1:52 PM

Reply
13 replies

May 29, 2010 2:43 PM in response to PeterBreis0807

PeterBreis0807 wrote:
Hi jayare1

Welcome to the forum.

+Menu > File > Print > Layout > Pages per Sheet > 2 > Print+



Hi peter,
what you describe will print a reduced invoice using half of a page but will not print it twice.

The OP will have to do the task twice.

Print once
turn the sheet to insert its bottom in the printer
print again.

The alternate soluce would be to create a document embedding the invoice twice but it's a perfect soluce to get erroneous documents.

My preferred tip (not a perfect one) would be to print once (in full size) in a PDF then paste the PDF in the document which will become a two pages one then print with the setting : two pages on a sheet.

Yvan KOENIG (VALLAURIS, France) samedi 29 mai 2010 23:43:32

May 30, 2010 6:34 AM in response to PeterBreis0807

PeterBreis0807 wrote:
True.

I tried the obvious printing 2 copies with 2 pages per sheet but that didn't work.


It's not obvious.
You tried to print twice a single page document which isn't the same thing than printing once a two pages one.

In mathematics, some operations aren't affected by the order of operands, sometimes they are.

a+b = b+a
but
a/b isn't the same than b/a

What you tried was analog to the secong case 😉

I'm trying to write a script printing once in a PDF, duplicating it then join both in a single one which we would be able to print as wanted.

Yvan KOENIG (VALLAURIS, France) dimanche 30 mai 2010 15:34:04

May 30, 2010 1:28 PM in response to PeterBreis0807

The script is here :

--

--[SCRIPT saveTwoPdfsAndMergeThem]
(*
Enregistrer le script en tant que Script : saveTwoPdfsAndMergeThem.scpt
déplacer le fichier ainsi créé dans le dossier
<VolumeDeDémarrage>:Users:<votreCompte>:Library:Scripts:Applications:Pages:
Il vous faudra peut-être créer le dossier Pages et peut-être même le dossier Applications.
menu Scripts > Pages > saveTwoPdfsAndMergeThem
Le script exporte en PDF le document Pages au premier plan,
il duplique le fichier créé puis assemble ces deux copies.
Enfin, il ouvre le fichier résultant.
--=====
L'aide ** Finder explique:
L'Utilitaire AppleScript permet d'activer le Menu des scripts :
Ouvrez l'Utilitaire AppleScript situé dans le dossier Applications/AppleScript.
Cochez la case "Afficher le menu des scripts dans la barre de menus".
--=====
Save the script as a Script: saveTwoPdfsAndMergeThem.scpt
Move the newly created file into the folder:
<startup Volume>:Users:<yourAccount>:Library:Scripts:Applications:Pages:
Maybe you would have to create the folder Pages and even the folder Applications by yourself.
menu Scripts > Numbers > saveTwoPdfsAndMergeThem
The script export as PDF the frontmost Pages document,
it duplicates it and merge these two PDFs.
At last, it opens the final file.
--=====
The Finder's Help explains:
To make the Script menu appear:
Open the AppleScript utility located in Applications/AppleScript.
Select the "Show Script Menu in menu bar" checkbox.
--=====
Yvan KOENIG (VALLAURIS, France)
2010/05/30
*)
--=====
property theApp : "Pages"
--=====
on run
if theApp is not in {"Numbers", "Pages"} then
error "Accept only “Pages” & “Numbers” !"
end if
set aPath to quoted form of "/System/Library/Automator/Combine PDF Pages.action/Contents/Resources/join.py"
try
do shell script "ln -s " & aPath & " joinPDF.py"
end try

set p2d to path to startup disk as text

set pdfName1 to "pdf_fdp1.pdf"
set pdfName2 to "pdf_fdp2.pdf"
set pdfPath1 to p2d & pdfName1
set pdfpath2 to p2d & pdfName2
set both to "both.pdf"
set bothPath to p2d & both

tell application "System Events"
if exists disk item pdfPath1 then delete disk item pdfPath1
make new file at end of folder p2d with properties {name:pdfName1}
if exists disk item bothPath then delete disk item bothPath
make new file at end of folder p2d with properties {name:both}
end tell

if theApp is "Pages" then
tell application theApp to save document 1 as "SLDocumentTypePDF" in (pdfPath1 as alias)
else
tell application theApp to save document 1 as "LSDocumentTypePDF" in (pdfPath1 as alias)
end if

tell application "System Events"
repeat until exists disk item (pdfPath1)
delay 0.1
end repeat
end tell

set pdf1 to quoted form of POSIX path of pdfPath1
set pdf2 to quoted form of POSIX path of pdfpath2
set both to quoted form of POSIX path of bothPath

do shell script "cp -f " & pdf1 & space & pdf2

do shell script "./joinPDF.py -o " & both & space & pdfName1 & space & pdfName2 --final.pdf input1.pdf input2.pdf
tell application "System Events"
delete disk item pdfPath1
delete disk item pdfpath2
open disk item bothPath
end tell

end run
--=====
--


Yvan KOENIG (VALLAURIS, France) dimanche 30 mai 2010 22:28:04

May 30, 2010 9:46 PM in response to KOENIG Yvan

KOENIG,

thanks so much for your custom script. I followed the instructions and got it loaded up in the scripts menu. When I open my Pages document and select the script it seems like something happens but no new files pops up and nothing really changes. I'm sure I'm just missing something here...are the files getting saved somewhere or are they supposed to just pop up and be ready to print? If it would help out I can send you my invoice so you can try it yourself.

Thanks again everyone who has responded...more than I could have hoped for!

May 31, 2010 8:39 AM in response to jayare1

The script is supposed to open the merged PDF.

Here, under 10.4.11, it behaves flawlessly.

I no longer have access to a machine running 10.6.3 so I can't test with this system.

May you look at the root of you Macintosh HD volume ?

User uploaded file

You are supposed to see the "joinPDF.py" icon.

May you also try to run :

--

tell application "Finder" to open folder "Macintosh HD:System:Library:Automator:Combine PDF Pages.action:Contents:Resources:"
--


You are supposed to see the file "join.py"

Yvan KOENIG (VALLAURIS, France) lundi 31 mai 2010 17:32:59

May 31, 2010 8:53 AM in response to KOENIG Yvan

Just an other question.

When you tested, was it with an already saved once document or with one which was just created ?

As is, the script fails if the document was never saved before.

Good new : there is no real need to build a duplicate.
The joinPDF.py python script is able to join several times a single file.

I will edit the script so that it saves the doc before calling the python tool.

Yvan KOENIG (VALLAURIS, France) lundi 31 mai 2010 17:53:24

May 31, 2010 12:22 PM in response to KOENIG Yvan

New version available :

(1) Save the doc as a native one so export to PDF will behave correctly with newly created documents.
(2) the PDF is no longer saved at the root of the HD but in the user's Documents folder.
(3) no longer create two copies to join them. A single one is sufficient.
(4) added a property allowing us to choose de name of the final PDF :
(a) use twice.pdf as the old version did
(b) use a dateStamped name : yyyymmdd_hhmmss.pdf

The choice (a) spare HD space.
The choice (b) give us different files .

(5) cleaned a bit the code.

(6) of course, added the ability to display error message in French 😉

--

--[SCRIPT saveAsPdfAndMergeTwoCopies]
(*
Enregistrer le script en tant que Script : saveAsPdfAndMergeTwoCopies.scpt
déplacer le fichier ainsi créé dans le dossier
<VolumeDeDémarrage>:Users:<votreCompte>:Library:Scripts:Applications:Pages:
Il vous faudra peut-être créer le dossier Pages et peut-être même le dossier Applications.
menu Scripts > Pages > saveAsPdfAndMergeTwoCopies
Le script exporte en PDF le document Pages au premier plan,
il duplique le fichier créé puis assemble ces deux copies.
Enfin, il ouvre le fichier résultant.
--=====
L'aide ** Finder explique:
L'Utilitaire AppleScript permet d'activer le Menu des scripts :
Ouvrez l'Utilitaire AppleScript situé dans le dossier Applications/AppleScript.
Cochez la case "Afficher le menu des scripts dans la barre de menus".
--=====
Save the script as a Script: saveAsPdfAndMergeTwoCopies.scpt
Move the newly created file into the folder:
<startup Volume>:Users:<yourAccount>:Library:Scripts:Applications:Pages:
Maybe you would have to create the folder Pages and even the folder Applications by yourself.
menu Scripts > Numbers > saveAsPdfAndMergeTwoCopies
The script export as PDF the frontmost Pages document,
it duplicates it and merge these two PDFs.
At last, it opens the final file.
--=====
The Finder's Help explains:
To make the Script menu appear:
Open the AppleScript utility located in Applications/AppleScript.
Select the "Show Script Menu in menu bar" checkbox.
--=====
Yvan KOENIG (VALLAURIS, France)
2010/05/30
2010/05/31 -- Now saves the original document and no longer duplicates the first PDF
*)
--=====
property theApp : "Pages"
property useDateStampedPDF : true
(*
true = save as yyyymmddhhmmss.pdf
false = save as twice.pdf
*)
--=====
on run
if theApp is not in {"Numbers", "Pages"} then
if my parleAnglais() then
error "Accept only “Pages” & “Numbers” !"
else
error "Résevé à “Pages” & “Numbers” !"
end if
end if

try
set aPath to quoted form of "/System/Library/Automator/Combine PDF Pages.action/Contents/Resources/join.py"
do shell script "ln -s " & aPath & " joinPDF.py"
end try

set p2d to path to documents folder as text

set pdfName to "pdf@_@fdp.pdf"
set pdfPath to p2d & pdfName

if useDateStampedPDF then
set twice to (do shell script "date +_%Y%m%d-%H%M%S") & ".pdf"
else
set twice to "twice.pdf"
end if -- useDateStampedPDF

set twicePath to p2d & twice

tell application "System Events"
if exists disk item pdfPath then delete disk item pdfPath
make new file at end of folder p2d with properties {name:pdfName}
if not useDateStampedPDF then
if exists disk item twicePath then delete disk item twicePath
make new file at end of folder p2d with properties {name:twice}
end if -- not useDateStampedPDF
end tell

if theApp is "Pages" then
set PDFtype to "SLDocumentTypePDF"
else
set PDFtype to "LSDocumentTypePDF"
end if -- theApp

tell application theApp
try
set nativePath to path of document 1
nativePath as text (* issue an error if the document was never saved before *)
save document 1
on error
(*
we are here if the document was never saved before.
Save it with a date_time name.
*)
set nativeName to (do shell script "date +_%Y%m%d-%H%M%S") & "." & theApp
set nativePath to p2d & nativeName
tell application "System Events" to make new file at end of folder p2d with properties {name:nativeName}
save document 1 in nativePath (* So that the document will be saved in its current state *)
end try
save document 1 as PDFtype in (pdfPath as alias)
end tell -- theApp

tell application "System Events"
repeat until exists disk item (pdfPath)
delay 0.1
end repeat
end tell -- System Events

do shell script "./joinPDF.py -o " & quoted form of POSIX path of twicePath & space & quoted form of POSIX path of pdfPath & space & quoted form of POSIX path of pdfPath

tell application "System Events"
delete disk item pdfPath
open disk item twicePath
end tell -- System Events

end run
--=====
on parleAnglais()
local z
try
tell application "Numbers" to set z to localized string "Cancel"
on error
set z to "Cancel"
end try
return (z is not "Annuler")
end parleAnglais
--=====
--


Yvan KOENIG (VALLAURIS, France) lundi 31 mai 2010 21:21:18

Jun 1, 2010 1:07 PM in response to jayare1

Thanks

(1) the script python which is used is delivered by Apple.
I was just informed of the fact that there is a join PDF python script embedded in an Automator action.

(2) May I know which setting you are really using ?

the one which I coded as default : the PDF is named as yyyymmddhhmmss.pdf
or the alternate one : the PDF is named twice.pdf

Yvan KOENIG (VALLAURIS, France) Mardi, 1 juin 2010 22:07:05

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Printing 2 Invoices on 1 page?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.