Is it possible to create and write on a .pages
document file via Terminal.app?
I have tried it as explained below but it didn't work. As I understand, I was able to create a .pages
file but the binary format wasn't correct.
touch file.pages #CREATE THE FILE
open -a Pages file.pages #OPEN THE FILE WITH PAGES (Pages can not open file.pages)
I have had the same result with following:
ls -l >> file.pages
open -a Pages file.page
I have also tried using different extensions:no extension, txt, rtf, doc, but Pages.app cannot open the file.
How do I do it?
Best Answer
A Pages document is not a simple file, but a Zip archive.
A Pages document contains much more than just plain text. A blank document is still based on a template, with a set page size and other metadata.
Creating a blank document in Pages creates this structure:
To create a Pages document programatically, use AppleScript to tell Pages to do it for you.
To run AppleScript from the command line, use osascript.