pgs2xtg


Usage

If for some reason you want to take articles from PageStream and put them into a QuarkXPress document, this script will assist in that process. Although it could be adapted to go through a document's chapters iteratively and export every article and the contents of every text frame, as it stands the process is manual.

Export from PageStream
Put the text cursor in the article and select all. From the menu, select File > Export. The default format is CTXT, change that to ASCII. Leave the encoding at UTF-8 and check the box to use PageStream text codes.
Convert Text File
Run the script from the commandline, passing the text file name as a single parameter. If the file is MyFile.TXT then a file named MyFile.xtg will be created — if the file already exists it will be silently overwritten.
Import into Quark
Put the text cursor into the desired text frame. From the menu, select File > Import and select the file. It will be automatically recognized as UTF-8 and having QuarkXPress tags.

What Does This Do?

Handles Unicode

Even with UTF-8 selected as the encoding many, possibly all, non-ASCII characters will be converted to PageStream's Unicode tag format. Any character so encoded will be converted into UTF-8.

Handles PageStream Style Tags

PageStream style tags are converted into Quark tag notation. On import, if the tag does not exist then an entry is created for it (just like in PageStream). In cases where PageStream has numerous style tags piled up at the beginning of a paragraph, only the last one is retained. This will nearly always be the correct way to handle it — and if it isn't you're better off recreating the formatting in Quark.

Handled Direct Formatting

Some directly formatted text is converted — in particular applied bold, italic and underline.

Cleans File

Some tags need no conversion. For example, both PageStream and Quark use <\n> to represent a new line. After considering style tags and other handled or equivalent tags, the remaining tags are stripped from the file.


How Good Is The Conversion?

That really depends on how the original document was formatted. You will probably get much better results if no character styles are used. Bold, italic, etc. will work just fine if PageStream exports them correctly (there is, or at least has been, a bug in this regard: no guarantees are made).

No attempt is made to handle directly formatted line height, character width, word spacing, etc. The article will display differently in Quark anyway (even the same font will give different results, and that's before considering differences in hyphenation) so tweaks wouldn't make much sense anyway. If the text is all formatted directly rather than using paragraph styles you're probably just better off with a plain text export/import, no text codes involved at all.

But What About Tabs?

In principle, tabs could be converted and I wrote code to do so. Regrettably, the implementation is problematic and the effort to make it work was too much to be worth it.

What About Embedded Objects?

If you actually manage to embed an object in a text frame it will not survive an export. This is a limitation of PageStream, but even if it weren't the script wouldn't support it.

Why Not Handle All Tags?

Because it isn't worth the effort. And comparing the default tags present at the beginning of an exported article shows that tags don't always match the documentation and there are undocumented tags.


Why Did You Write This?

Although nothing compares to PageStream for entering text or handling chapters, PageStream has its share of missing features and bugs. For example, its implementation of OpenType features is incomplete and partially incorrect. These and other issues are a fact of life with PageStream so there are some documents that cannot be reasonably constructed in it. This script facilitates moving some or all of a project from PageStream to Quark.

Why Quark? Why not InDesign?

Basically because, even though Quark sucks, Adobe sucks worse. They both have modern font support, but surprisingly poor handling of chapters. Neither appear to acknowledge bugs or shortcomings, but at least Quark is still selling their software rather than renting it on a monthly basis.