Hi Thomas, 

maybe you want to have a look at my modification. It converts the XML-file
with saxon (that's the "sc.bat" shell command) and passes the result of that
transformation to fop. 

I had some difficulties with automatically viewing the resulting PDF: The
only way I found was to rely on Windows? ability to launch the application
associated with a file type. so <shell platform="Windows" command="%R.pdf"
/> should launch your default PDF-Reader (Acrobat maybe). XMLMinds message
window stays open until you close Acrobat. 

* The copyProcessResources elements rely on some XML entities, you might
want to change that behaviour according to your needs.
* there is an environment variable envolved (%ICONDOC%), you might want to
change that one too ...

This modification works fine for me though it might not be a "clean"
solution. Maybe it suits your needs.

Cheers
Patrick


<command name="icon.genPDF">

    <process>
    <!-- until the upload takes place, all actions are done inside a
temporary directory. -->
        <mkdir dir="resources" />
        <mkdir dir="callouts" />
        <mkdir dir="images" />
    
    <!-- add attribute selection="true" to copyDocument if you want to be
able to process explicitely selected element -->

        <copyDocument to="__doc.xml">
            <resources match="(https|http|ftp)://.*" />
            <resources match=".+" copyTo="resources" />
        </copyDocument>

        <copyProcessResources resources="@&calloutlists;/gif_callouts.list"
to="callouts" />
        <copyProcessResources resources="@&imageslists;/images.list"
to="images" />            
        <copyProcessResources resources="&layoutimages_png;" to="images" />
        <copyProcessResources resources="&layoutimages_gif;" to="images" />
    
    <!-- escape any percent-sign if its not a xxe-variable! -->
        <shell platform="Windows" command='sc.bat -o %R.fo __doc.xml
%%ICONDOC%%\docbook\xsl-icon\icon.xsl' />
        <shell platform="Windows" command="fop.bat -c
%ICONDOC%\tools\fop-0.20.5\conf\userconfig.xml %R.fo %R.pdf" />
    <!-- calling acrobat from this location is easier than anything else -->
        <shell platform="Windows" command="%R.pdf" />

        <upload base="%2"> -->
        <copyFile file="%R.pdf" to="%2" />            
        <copyFile file="%R.fo" to="%R.fo" />            
        </upload>

    </process>
</command>


To actually start the process, you might use this command. It opens a file
chooser dialog.

<command name="icon.convertToPDF">
    <macro>
        <sequence>
        <!-- use saveFileURL instead of saveFileDir to have the user enter a
filename -->
            <command name="selectFile" parameter="saveFileURL" />
            <set variable="view:FILENAME" expression='"%_"' />
            <get expression="$view:FILENAME" />
            <command name="icon.genPDF" parameter='"%0" "%1" "%_"' />
            <get expression="$view:FILENAME" />
            <command name="alert" parameter="PDF in %_ erstellt." />
        </sequence>
    </macro>
</command>




> --- Urspr?ngliche Nachricht ---
> Von: Thomas K?bler <t.kuebler at variex.de>
> An: xmleditor-support at xmlmind.com
> Betreff: [XXE] run an external process for generate pdf
> Datum: Thu, 14 Jul 2005 08:58:51 +0200
> 
> hallo,
> 
> i have to start a external process to generate the pdf files.
> so, i use the
> 
> <command name="docb.toPS">
>      <process>
>        <mkdir dir="resources"/>
>        <mkdir dir="raw"/>
>        <copyDocument to="__doc.xml">
>          <resources match="(https|http|ftp)://.*"/>
>          <resources match="(?:.+/)?(.+)\.(png|jpg|jpeg|gif|svg|svgz%1)"  
> copyTo="resources"
>            referenceAs="%w/resources/$1.$2"/>
>          <resources match="(?:.+/)?(.+)\.tex" copyTo="raw"  
> referenceAs="%w/resources/$1.%0"/>
>          <resources match="(?:.+/)?(.+)\.(\w+)" copyTo="raw"  
> referenceAs="%w/resources/$1.png"/>
>          <resources match="(?:.+/)?(.+)" copyTo="resources"  
> referenceAs="%w/resources/$1"/>
>        </copyDocument>
>        <convertImage from="raw" to="resources" format="%0 png"/>
>        <mkdir dir="images/callouts"/>
>        <!--      <copyProcessResources resources="xsl/images/draft.png"  
> to="images"/>
>        <copyProcessResources  
> resources="@xsl/images/callouts/png_callouts.list"  
> to="images/callouts"/>-->
>        <transform stylesheet="xsl-compart/compart.xsl" file="__doc.xml"  
> to="d:\temp\_doc.fo">
>          <parameter name="use.extensions">1</parameter>
>          <!-- Cannot work and generates a lot of error messages. -->
>          <parameter name="graphicsize.extension">0</parameter>
>          <parameter name="paper.type">A4</parameter>
>          <parameter name="generate.toc">%2</parameter>
>          <parameter name="toc.section.depth">3</parameter>
>          <parameter name="section.autolabel">%3</parameter>
>          <parameter name="callout.graphics">1</parameter>
>          <parameter name="shade.verbatim">1</parameter>
>          <parameter name="ulink.show">0</parameter>
>          <parameterGroup name="docb.toPS.transformParameters"/>
>        </transform>
> 
>     ...
>     here i want to start the process with the _doc.fo document
>     ...
> 
>     </process>
> </command>
> 
> how can i start the external process in the <process> tag.
> 
> 
> with regards
> 
> thomas k?bler
> 
> 
> 
> -- 
> 
> Dynamic Document Solution variex
> Alt-Marienfelde 25
> 12277 Berlin
> 
> t. + 49 (0)30.723.23.183
> f. + 49 (0)30.723.23.185
> mobil +49 (0)163 633 36 96
> 
> www.variex.de
> 
> Ansprechpartner
> t.kuebler at variex.de
> 
>  
> --
> XMLmind XML Editor Support List
> xmleditor-support at xmlmind.com
> http://www.xmlmind.com/mailman/listinfo/xmleditor-support
> 


-- 
GMX DSL = Maximale Leistung zum minimalen Preis!
2000 MB nur 2,99, Flatrate ab 4,99 Euro/Monat: http://www.gmx.net/de/go/dsl

-- 
5 GB Mailbox, 50 FreeSMS http://www.gmx.net/de/go/promail
+++ GMX - die erste Adresse f???r Mail, Message, More +++

Reply via email to