Re: reading text rom Pages doc
Re: reading text rom Pages doc
- Subject: Re: reading text rom Pages doc
- From: Charles Srstka <email@hidden>
- Date: Mon, 8 Mar 2010 10:35:50 -0600
On Mar 8, 2010, at 5:43 AM, Keith Blount wrote:
> Hi,
>
> As others have pointed out, there is no way to read .pages documents as the .pages format is proprietary and unpublished. Some of the specs were published here:
>
> http://developer.apple.com/mac/library/documentation/AppleApplications/Conceptual/iWork2-0_XML/Chapter02/02Pages.html
>
> But the Pages section hasn't been updated since 2005 and the .pages format has changed since then - and moreover the above makes it very clear that the XML scheme is unlikely to be published properly and that you shouldn't rely on it for writing your own importers.
>
> So the only way is to tell your users to export to RTF or Word format, or, as Paul suggests, try using AppleScript. There is one other possibility, but it's an ugly hack and could break if the Pages format changes. Depending on whether the user chooses "Include preview in document" or not, .pages files will either have a PDF file containing all their documents inside the QuickLook folder in the project package (recent .pages files are zip archives), or QuickLook will generate HTML to show the preview. So you could try extracting the PDF file from the .pages QuickLook folder and loading the text from that. If that doesn't work (because the user hasn't chosen "Include preview" for that document), you could (on 10.6) use QuickLook to load a preview and try to navigate down the view hierarchy to find the WebView and extract the HTML. But this is fragile and if Pages '10 changes the way the QuickLook preview is generated, it will break - and it will be
> different for past versions of the format too.
>
> (I get a lot of outraged e-mails from new users demanding to know why my text app doesn't support the .pages format, which is why I considered the above. But it's pretty nasty so I'm just resigned to telling them to export to RTF.)
I am somewhat surprised that Cocoa includes support for Microsoft’s competing file formats, but not Apple’s own. I’ve just filed a bug report on this - anyone else who also finds this odd should perhaps do the same. It certainly seems to be in Apple’s best interest for the Pages format to be more accessible, in order to make Pages more useful as a word processor.
Charles_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden