2

How does one convert a .pages file to a .doc or .pdf file using Python? My use case is basically:

  1. User uploads a .pages file to my service
  2. My service converts the .pages to a .pdf`
  3. The .pdf is rendered in browser using a browser-based .pdf viewer
Some programmer dude
  • 400,186
  • 35
  • 402
  • 621
seanrose
  • 8,185
  • 3
  • 20
  • 21

2 Answers2

2

I've never done it, but it appears the .pages file already contains a pdf version if you unzip the file: http://blog.cleverly.com/

stormCloud
  • 983
  • 1
  • 9
  • 24
  • This does work, but is not always reliable because the file sometimes contains only the thumbnail.jpg and not the preview.pdf. Maybe consider something like this instead? http://stackoverflow.com/questions/10014807/batch-convert-mac-iwork-files-to-pdf-on-the-command-line – tufelkinder May 14 '13 at 18:07
1

A complete native solution in python will be difficult.

Appropriate solution would be to look at how you can automate pages to export the file in pdf or ms word.

For that, there seems to be an available solution:

  1. pyobjc

Three is an example that automates pages using pyobjc: http://www.mugginsoft.com/kosmictask/help/automation-python

pyfunc
  • 65,343
  • 15
  • 148
  • 136
  • 1
    I'll add this to my original question, but my use case is: => User uploads a .pages file to my service => My service converts the .pages to a .pdf => The converted .pdf is rendered in-browser using a browser based pdf previewer – seanrose Jun 24 '12 at 23:15