Use Adobe Distiller to Print PDFs
Contents
Description
WebWorks ePublisher products are installed with an application called GhostScript which is used for imaging and PDF printing processes. Some users don't have Adobe's Distiller (which is used by FrameMaker to create PDFs), so we use GhostScript by default. However, this often causes unexpected and unwanted effects when PDFs are generated with ePublisher output. Some GhostScript-related issues include:
- Wingdings bullets look different in PDF
- Other font-related issues
Since Distiller requires print-quality options that differ from GhostScript (and even between Distiller versions), it is not currently practical to implement a Distiller option in the ePublisher UI. However, we have developed a procedure which will allow you to force ePublisher to use Adobe Distiller to print PDFs using the appropriate options. It requires an override to either a Target, Format, or User Format.
We'll add a C# script block to the XSL file responsible for PDF printing and make a call to the function that will print a PDF using the PostScript files generated from your documents. If Distiller is not available on your machine, or if another error occurs, we'll fall back on the default GhostScript printer.
Adding the Script Block
Using methods described in this article, we'll add a block of C# script designed to convert a PostScript file to a PDF using the appropriate print options. Follow these steps:
Perform a Format Override on a file called pdf.xsl, located by default in the ePublisher Pro installation directory here:
- ePublisher Pro\Formats\Shared\pdf
Open the new copy of pdf.xsl in an XML or text editor, such as NotePad.
- At the top, add this line to the list of namespaces referenced by the stylesheet:
xmlns:wwdistpdf="urn:WebWorks-Distiller-PDF-Printer"
Add wwdistpdf to the list of exclude-result-prefixes.
At the bottom, above </xsl:stylesheet>, define the script with the code from this text file:
Save pdf.xsl
Calling the Function
Next, modify the XSL to call the new function, passing variables for the PostScript file, the destination PDF, and the Distiller print options.
In the override copy of pdf.xsl, find <xsl:variable name="VarIgnore5">.
- Beneath it, replace this line:
{{{ <xsl:value-of select="wwimaging:PostScriptToPDF($VarFile/@path, wwprojext:GetFormatSetting('pdf-job-settings', 'default'), $VarPDFSplitFile/@path)" />}}} with this block of XSL: {{{ <!-- Try with Distiller -->
<!-- --> <xsl:variable name="VarPDFWithDistiller" select="wwdistpdf:FileToPDF($VarFile/@path, $VarPDFSplitFile/@path, wwprojext:GetFormatSetting('pdf-job-settings', 'Standard'))" />
<xsl:if test="not($VarPDFWithDistiller)">
<!-- Try again --> <xsl:variable name="VarPDFWithDistiller2" select="wwdistpdf:FileToPDF($VarFile/@path, $VarPDFSplitFile/@path, wwprojext:GetFormatSetting('pdf-job-settings', 'Standard'))" /> <xsl:if test="not($VarPDFWithDistiller2)">
<!-- Use GhostScript --> <!-- --> <xsl:variable name="VarMsgGS" select="wwlog:Warning('Problem with Distiller; GhostScript used to generate ', $VarPDFSplitFile/@title)" /> <xsl:value-of select="wwimaging:PostScriptToPDF($VarFile/@path, 'default', $VarPDFSplitFile/@path)" />
</xsl:if>
</xsl:if>}}}
Note: Because of the FTI override below, GhostScript will use the "default" option if Distiller fails.
Save and close pdf.xsl.
Changing the Settings
Depending on the version of Distiller you are using, you will have a set of default print settings from which to choose. (Distiller 7.0 offers High Quality, PDFX1a, PDFX3, Press Quality, and Standard). You can determine the default options files available by opening the "Settings" folder in the Distiller application directory (typically C:\Program Files\Adobe\Acrobat X.x\Distillr\Settings). These are the settings you need to know to successfully use Distiller as your ePublisher PDF printer. You'll need to add the applicable options to the appropriate FTI so they are integrated into the PDF options in your project's Format Settings, which are referenced by the XSL call. Follow these steps:
Perform an override on pdf.fti, a file located in the same folder as pdf.xsl:
- ePublisher Pro\Formats\Shared\pdf
Open the new copy of pdf.fti and make the following changes:
Replace the item values for the "pdf-job-settings" class with those you'll use for your version of Distiller.
In the <Settings> section, replace default="default" with default="Standard"
Save and close pdf.fti.
Final Steps...
You're almost there. Save and close your ePublisher Pro project, and then reopen it to load the new FTI settings. Confirm the change by opening the Format Settings dialog and checking the PDF job settings for the new values. Choose the desired setting (don't forget to enable PDF generation), and regenerate your output to use Adobe Acrobat Distiller to create your project's PDFs.
Examples
With these handy examples, you don't even have to do any work! Below, you'll find the pdf.xsl and pdf.fti files referenced here, complete with overrides necessary to use Distiller instead of GhostScript for PDF production. Add them to the appropriate override directory, and you're good to go.
References
For more details and advanced options, here's a link to Adobe's Distiller API documentation:
--> -->
ValueError
list.remove(x): x not in list
If you want to report a bug, please save this page and attach it to your bug report.
Traceback
A problem occurred in a Python script. Here is the sequence of function calls leading up to the error, in the order they occurred.
/webworks/wiki/lib/python2.5/site-packages/MoinMoin/request/__init__.py in run (self=<MoinMoin.request.request_wsgi.Request object at 0x5e0e9d0>)
- 1309 self.page.send_page()
- 1310 else:
- 1311 handler(self.page.page_name, self)
- 1312
- 1313 # every action that didn't use to raise MoinMoinFinish must call this now:
- handler = <function do_show at 0x117a370>
- self = <MoinMoin.request.request_wsgi.Request object at 0x5e0e9d0>
- self.page = <MoinMoin.Page.Page object at 0x5e0ef10>
- self.page.page_name = u'HelpCenter/Tips/UseDistillerForPDF/ePublisher_9.2.2'
/webworks/wiki/lib/python2.5/site-packages/MoinMoin/action/__init__.py in do_show (pagename=u'HelpCenter/Tips/UseDistillerForPDF/ePublisher_9.2.2', request=<MoinMoin.request.request_wsgi.Request object at 0x5e0e9d0>, content_only=0, count_hit=1, cacheable=1, print_mode=0)
- 251 count_hit=count_hit,
- 252 print_mode=print_mode,
- 253 content_only=content_only,
- 254 )
- 255
- content_only = 0
/webworks/wiki/lib/python2.5/site-packages/MoinMoin/Page.py in send_page (self=<MoinMoin.Page.Page object at 0x5e0e030>, **keywords={'content_only': 0, 'count_hit': 1, 'print_mode': 0})
- 1199 format_args=pi['formatargs'],
- 1200 do_cache=do_cache,
- 1201 start_line=pi['lines'])
- 1202
- 1203 # check for pending footnotes
- start_line undefined
- pi = {'acl': <MoinMoin.security.AccessControlList instance at 0x7c71a08>, 'format': 'wiki', 'formatargs': '', 'language': 'en', 'lines': 3}
/webworks/wiki/lib/python2.5/site-packages/MoinMoin/Page.py in send_page_content (self=<MoinMoin.Page.Page object at 0x5e0e030>, request=<MoinMoin.request.request_wsgi.Request object at 0x5e0e9d0>, body=u'== Use Adobe Distiller to Print PDFs ==\n\n<<Table...s=80, articleview=1, tablewidth=500, notify=1)>>\n', format='wiki', format_args='', do_cache=1, **kw={'start_line': 3})
- 1283
- 1284 if not (do_cache and self.canUseCache(Parser)):
- 1285 self.format(parser)
- 1286 else:
- 1287 try:
- self = <MoinMoin.Page.Page object at 0x5e0e030>
- self.format = <bound method Page.format of <MoinMoin.Page.Page object at 0x5e0e030>>
- parser = <MoinMoin.parser.text_moin_wiki.Parser instance at 0x7ca8dc8>
/webworks/wiki/lib/python2.5/site-packages/MoinMoin/Page.py in format (self=<MoinMoin.Page.Page object at 0x5e0e030>, parser=<MoinMoin.parser.text_moin_wiki.Parser instance at 0x7ca8dc8>)
- 1304 def format(self, parser):
- 1305 """ Format and write page content without caching """
- 1306 parser.format(self.formatter)
- 1307
- 1308 def execute(self, request, parser, code):
- parser = <MoinMoin.parser.text_moin_wiki.Parser instance at 0x7ca8dc8>
- parser.format = <bound method Parser.format of <MoinMoin.parser.text_moin_wiki.Parser instance at 0x7ca8dc8>>
- self = <MoinMoin.Page.Page object at 0x5e0e030>
- self.formatter = <MoinMoin.formatter.text_html.Formatter instance at 0x7ca8328>
/webworks/wiki/lib/python2.5/site-packages/MoinMoin/parser/text_moin_wiki.py in format (self=<MoinMoin.parser.text_moin_wiki.Parser instance at 0x7ca8dc8>, formatter=<MoinMoin.formatter.text_html.Formatter instance at 0x7ca8328>, inhibit_p=False)
- 1544
- 1545 # Scan line, format and write
- 1546 formatted_line = self.scan(line, inhibit_p=inhibit_p)
- 1547 self.request.write(formatted_line)
- 1548
- formatted_line = u'<p class="line867"><hr /><p class="line874"> '
- self = <MoinMoin.parser.text_moin_wiki.Parser instance at 0x7ca8dc8>
- self.scan = <bound method Parser.scan of <MoinMoin.parser.text_moin_wiki.Parser instance at 0x7ca8dc8>>
- line = u'<<PageComment2(markup=1, newerfirst=1, rows=4, cols=80, articleview=1, tablewidth=500, notify=1)>> '
- inhibit_p = False
/webworks/wiki/lib/python2.5/site-packages/MoinMoin/parser/text_moin_wiki.py in scan (self=<MoinMoin.parser.text_moin_wiki.Parser instance at 0x7ca8dc8>, line=u'<<PageComment2(markup=1, newerfirst=1, rows=4, cols=80, articleview=1, tablewidth=500, notify=1)>> ', inhibit_p=False)
- 1358 self.in_table or self.in_list):
- 1359 result.append(self.formatter.paragraph(1, css_class="line867"))
- 1360 result.append(self.replace(match, inhibit_p))
- 1361 end = match.end()
- 1362 lastpos = end
- result = ['<p class="line867">']
- result.append = <built-in method append of list object at 0x7c91be8>
- self = <MoinMoin.parser.text_moin_wiki.Parser instance at 0x7ca8dc8>
- self.replace = <bound method Parser.replace of <MoinMoin.parser.text_moin_wiki.Parser instance at 0x7ca8dc8>>
- match = <_sre.SRE_Match object at 0x8071a00>
- inhibit_p = False
/webworks/wiki/lib/python2.5/site-packages/MoinMoin/parser/text_moin_wiki.py in replace (self=<MoinMoin.parser.text_moin_wiki.Parser instance at 0x7ca8dc8>, match=<_sre.SRE_Match object at 0x8071a00>, inhibit_p=False)
- 1402 # Get replace method and replace hit
- 1403 replace_func = getattr(self, '_%s_repl' % type)
- 1404 result.append(replace_func(hit, match.groupdict()))
- 1405 return ''.join(result)
- 1406 else:
- result = []
- result.append = <built-in method append of list object at 0x7c91dc8>
- replace_func = <bound method Parser._macro_repl of <MoinMoin.parser.text_moin_wiki.Parser instance at 0x7ca8dc8>>
- hit = u'markup=1, newerfirst=1, rows=4, cols=80, articleview=1, tablewidth=500, notify=1'
- match = <_sre.SRE_Match object at 0x8071a00>
- match.groupdict = <built-in method groupdict of _sre.SRE_Match object at 0x8071a00>
/webworks/wiki/lib/python2.5/site-packages/MoinMoin/parser/text_moin_wiki.py in _macro_repl (self=<MoinMoin.parser.text_moin_wiki.Parser instance at 0x7ca8dc8>, word=u'markup=1, newerfirst=1, rows=4, cols=80, articleview=1, tablewidth=500, notify=1', groups={u'big': None, u'big_off': None, u'big_on': None, u'comment': None, u'dl': None, u'email': None, u'emph': None, u'emph_ib_or_bi': None, u'emph_ibb': None, u'emph_ibi': None, ...})
- 1325 if self.macro is None:
- 1326 self.macro = macro.Macro(self)
- 1327 return self.formatter.macro(self.macro, macro_name, macro_args, markup=groups.get('macro'))
- 1328 _macro_name_repl = _macro_repl
- 1329 _macro_args_repl = _macro_repl
- self = <MoinMoin.parser.text_moin_wiki.Parser instance at 0x7ca8dc8>
- self.formatter = <MoinMoin.formatter.text_html.Formatter instance at 0x7ca8328>
- self.formatter.macro = <bound method Formatter.macro of <MoinMoin.formatter.text_html.Formatter instance at 0x7ca8328>>
- self.macro = <MoinMoin.macro.Macro instance at 0x7c91530>
- macro_name = u'PageComment2'
- macro_args = u'markup=1, newerfirst=1, rows=4, cols=80, articleview=1, tablewidth=500, notify=1'
- markup undefined
- groups = {u'big': None, u'big_off': None, u'big_on': None, u'comment': None, u'dl': None, u'email': None, u'emph': None, u'emph_ib_or_bi': None, u'emph_ibb': None, u'emph_ibi': None, ...}
- groups.get = <built-in method get of dict object at 0x5f16ae0>
/webworks/wiki/lib/python2.5/site-packages/MoinMoin/formatter/__init__.py in macro (self=<MoinMoin.formatter.text_html.Formatter instance at 0x7ca8328>, macro_obj=<MoinMoin.macro.Macro instance at 0x7c91530>, name=u'PageComment2', args=u'markup=1, newerfirst=1, rows=4, cols=80, articleview=1, tablewidth=500, notify=1', markup=u'<<PageComment2(markup=1, newerfirst=1, rows=4, cols=80, articleview=1, tablewidth=500, notify=1)>>')
- 308 # call the macro
- 309 try:
- 310 return macro_obj.execute(name, args)
- 311 except ImportError, err:
- 312 errmsg = unicode(err)
- macro_obj = <MoinMoin.macro.Macro instance at 0x7c91530>
- macro_obj.execute = <bound method Macro.execute of <MoinMoin.macro.Macro instance at 0x7c91530>>
- name = u'PageComment2'
- args = u'markup=1, newerfirst=1, rows=4, cols=80, articleview=1, tablewidth=500, notify=1'
/webworks/wiki/lib/python2.5/site-packages/MoinMoin/macro/__init__.py in execute (self=<MoinMoin.macro.Macro instance at 0x7c91530>, macro_name=u'PageComment2', args=u'markup=1, newerfirst=1, rows=4, cols=80, articleview=1, tablewidth=500, notify=1')
- 126 else:
- 127 raise ImportError("Cannot load macro %s" % macro_name)
- 128 return execute(self, args)
- 129
- 130 def _m_lang(self, text):
- execute = <function execute at 0x4777ab0>
- self = <MoinMoin.macro.Macro instance at 0x7c91530>
- args = u'markup=1, newerfirst=1, rows=4, cols=80, articleview=1, tablewidth=500, notify=1'
/Volumes/Projects-Wiki/wiki.wiki/data/plugin/macro/PageComment2.py in execute (macro=<MoinMoin.macro.Macro instance at 0x7c91530>, args=u'markup=1, newerfirst=1, rows=4, cols=80, articleview=1, tablewidth=500, notify=1')
/Volumes/Projects-Wiki/wiki.wiki/data/plugin/macro/PageComment2.py in setglobalvalues (macro=<MoinMoin.macro.Macro instance at 0x7c91530>)
ValueError
list.remove(x): x not in list
- args = ('list.remove(x): x not in list',)
- message = 'list.remove(x): x not in list'
System Details
- Date: Wed, 23 May 2012 18:06:40 +0000
- Platform: Darwin hulahut 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun 7 16:32:41 PDT 2011; root:xnu-1504.15.3~1/RELEASE_X86_64 x86_64
- Python: Python 2.5.4 (/webworks/wiki/bin/python)
- MoinMoin: Release 1.8.4 (release)
