Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Modify Pages files by changing package contents Apps
Unlike most word processor documents, Pages' (part of iWork) files are actually packages. In the Finder, control-click on a Pages document you've saved and choose 'Show Package Contents.' A new window will open and show the guts of your Pages document. Inside, you'll find a 'thumbs' folder, 'Contents' folder, index.xml.gz file, and any media files you've placed in your document.

The thumbs folder holds a small image of what your whole document looks like. index.xml.gz is the markup file, which holds the actual text and defines the layout of your document.

This means that you can edit the media files in your Pages document without replacing them. Just modify the version that's inside the Pages document package. You can also replace actual media files in your document with symbolic links. This might be useful if you use your company logo in many different kinds of documents, and then make changes to your logo. If these documents use symbolic links to your logo file, you can simply modify your logo file, and you'll see the change the next time you open a Pages document that uses it.

As far as I can tell, Pages keeps your whole document in memory. Therefore, if you change something inside the the document package, you'll either have to close and reopen your document, or choose 'Revert to Saved' from the File menu, to see your changes.

[robg adds: If you're going to try modifying your documents in this manner, I strongly recommend a backup -- while it should work fine, I can see some strange results if, for instance, you replace a masked image with another. Also, if you share Pages' documents with others, the symbolic links will probably break when they try to open the actual file (not an issue with a PDF, obviously).]
    •    
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
 
[6,738 views]  

Modify Pages files by changing package contents | 10 comments | Create New Account
Click here to return to the 'Modify Pages files by changing package contents' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Modify Pages files by changing package contents - Bibliography Example
Authored by: tamc on Mar 09, '05 11:08:11AM

As an example of this, I've hacked together a quick script at http://www2.eng.cam.ac.uk/~tamc2/Pages-Bibtex-0-0-1.zip that allows you to use bibtex citations (e.g. \citep{counsell03}) in Pages, and then have them turned into a proper bibliography at the end.

It works, but only just. If anyone gets anywhere at figuring out the Pages xml format I would appreciate a pointer.



[ Reply to This | # ]
Modify Pages files by changing package contents - Bibliography Example
Authored by: adrianm on Mar 09, '05 12:55:57PM

Doesn't the pages xml format reference a DTD or schema at the top?



[ Reply to This | # ]
Modify Pages files by changing package contents - Bibliography Example
Authored by: wombat on Mar 09, '05 02:25:29PM
Yes, but the schema hasn't been published yet. The referenced URLs
http://developer.apple.com/namespaces/sfa

http://developer.apple.com/namespaces/sf

http://developer.apple.com/namespaces/sl
are currently invalid.

[ Reply to This | # ]
Modify Pages files by changing package contents - Bibliography Example
Authored by: adrianm on Mar 10, '05 01:43:41PM

That's a shame.

I didn't really expect them to be real reachable URLs, they rarely are, but I did expect them to be in the Pages.app bundle.

Sadly not. But they are mentioned in the SFArchiving framework, maybe the parser is hardcoded, or has the dtd/schema compressed in the app code somewhere.



[ Reply to This | # ]
Modify Pages files by changing package contents - Bibliography Example
Authored by: jgh23 on Mar 11, '05 05:14:49AM

Dear tamc,

I *love* this. I've been trying to work towards a BibTeX solution, cos then my PhD students could move to macs and be able to write research papers...Word-free. But I don't have the ruby (perl, python) expertise you clearly have.

Here's my problem. It's often the case that journals/conferences want the [1] citation style...that that you would get from using unsrt.bst, for instance...or they want the [KRT99] style. I don't see how to easily extend your scheme to do this for two reasons:
* the citations could be ordered incorrectly, given that the bibtex sort of the bibliography could be slightly different to the ruby sort;
* the citation keys (the [1], [KRT99]) are more difficult(?) to generate.

My idea, although I have no idea how this could be done in ruby, is to run bibtex , i.e., to create a .aux file (your citations variable contains the right sort of information, although a \bibliography style would need to appear in the document and the \cite{foo} would need some transformation), use bibtex to generate a .bbl file from it that contains the bibtex generated keys and the order for the citations, and from which your bibliography variable can be sorted

Is this feasible?

Perhaps in time, I can adapt a .bst file to pump out Pages XML instead of latex...roll on the schema definition.

Best wishes, and many thanks, Jon



[ Reply to This | # ]
Modify Pages files by changing package contents
Authored by: peragrin on Mar 09, '05 02:12:19PM

Unlike most word processor documents, Pages' (part of iWork) files are actually packages.

.Doc files, MSFT Word
.Sxw files, Open office

I don't know the format for .doc's but .sxw files from open Office are zip files.

just take any open office document add .zip to the end, and open it.

---
I thought once I was found but it was only a dream

[ Reply to This | # ]

Modify Pages files by changing package contents
Authored by: adrianm on Mar 10, '05 01:45:04PM

And .doc files are an abomination in anyone's eyes :-)



[ Reply to This | # ]
I Stand Corrected :-)
Authored by: n8_sl8er on Mar 12, '05 01:34:36PM

Cool! I didn't know you could do that with Open Office files. Still, are there any other word processors that use the Macintosh file packaging scheme (i.e. can you ctrl-click on the file and view its contents)?



[ Reply to This | # ]
Modify Pages files by changing package contents
Authored by: PeteVerdon on Mar 12, '05 01:47:58PM

I discovered this a montth or so ago, and found it really useful. The XML is a little hairy (or indeed scary) but I was able to successfully generate a nice-looking beer guide in Pages with 100 beers (with 5 differently-formatted elements each) that I really didn't want to manually assemble. I used Perl to generate the XML - I love the way Apple are integrating with all the Unix stuff rather than just building on top of it and then ignoring it.

Pete



[ Reply to This | # ]
Modify Pages files by changing package contents
Authored by: Hannu Rajaniemi on Jul 14, '05 06:42:19AM

This sounds like a brilliant concept!

I write a lot of fiction and I prefer to do it in a text editor, using a minimal markup, typically Markdown. I was wondering if it would be possible to have a script that converted a plaintext file into a Pages file with a pre-specified formatting. Given the interesting hacks people here have come up with, this should be possible...

(I can, of course, convert Markdown to HTML and then import it to Pages, but it would be nice to have something that automagically formats things the right way.)

Any ideas?



[ Reply to This | # ]