How to automatically open PDF output file using other formatter than Apache FOP?

Having trouble installing Oxygen? Got a bug to report? Post it all here.
ckabstein
Posts: 142
Joined: Fri Apr 24, 2015 12:28 pm

How to automatically open PDF output file using other formatter than Apache FOP?

Post by ckabstein »

Hello,

Normally, I would think that the PDFs created by the transformation open automatically as configured when using Apache FOP.
Now that we're switching to Antenna House, this no longer seems to work.

I just know this setting in the transformation scenario Output tab:
Output file: Activated Open in Browser/System Application and Output file.

Is there any other option that needs to be set to automatically open the PDF in Acrobat?

Thanks,
Christina
oXygen XML Editor 25.0 build 2023013006
DITA OT 3.7.3
adrian
Posts: 2850
Joined: Tue May 17, 2005 4:01 pm

Re: How to automatically open PDF output file using other formatter than Apache FOP?

Post by adrian »

Hi

What type of transformation is this (generic XML with XSLT) or DITA-OT/ANT ?
It seems it's DITA-OT from what you're describing, which means Oxygen expects the output file to have a certain name (the name of the map with the extension pdf) and it expects it to be located in the specified Output directory. Other than that the PDF file extension has to be associated with Acrobat in the OS file association settings.

Have you also tested the default DITA Map PDF transformation? Does that still open the PDF in Acrobat?

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
ckabstein
Posts: 142
Joined: Fri Apr 24, 2015 12:28 pm

Re: How to automatically open PDF output file using other formatter than Apache FOP?

Post by ckabstein »

Hi Adrian,

Thanks for pointing me towards checking the default DITA Map to PDF transformation. This opens the PDF in Acrobat.

I've found that setting the outputFile.base parameter seems to cause the issue, because if I unset this parameter, the PDF is opened. The following value of this parameter creates the file name:

Code: Select all

${cfn}_${xpath_eval(substring(//@xml:lang,1,2))}
I suspect that something in this value is causing the issue - I presume the latter part - but I don't know what's wrong with it, especially since it worked for Apache FOP.

Christina
oXygen XML Editor 25.0 build 2023013006
DITA OT 3.7.3
adrian
Posts: 2850
Joined: Tue May 17, 2005 4:01 pm

Re: How to automatically open PDF output file using other formatter than Apache FOP?

Post by adrian »

Hi,

What version of Oxygen are you using?

I've tested in v20 and it works with a custom outputFile.base set.
I believe it may not work in some older versions of Oxygen, which did not account for the change of output file when setting outputFile.base.
If that's the case, edit the scenario and in the Output tab select Open in Browser/System Application > Other location and use there the same output directory specified just above (in Output directory) followed by '/' and the value you used for the outputFile.base, followed by '.pdf'. e.g.

Code: Select all

${cfd}/out/pdf/${cfn}_${xpath_eval(substring(//@xml:lang,1,2))}.pdf
Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
ckabstein
Posts: 142
Joined: Fri Apr 24, 2015 12:28 pm

Re: How to automatically open PDF output file using other formatter than Apache FOP?

Post by ckabstein »

Hi Adrian,

I am using <oXygen/> XML Editor 20.0, build 2018032903.

I've also tried using Other Location, in version 20 and 19, but to no avail.

Christina
oXygen XML Editor 25.0 build 2023013006
DITA OT 3.7.3
adrian
Posts: 2850
Joined: Tue May 17, 2005 4:01 pm

Re: How to automatically open PDF output file using other formatter than Apache FOP?

Post by adrian »

Hi,
Please test if just switching the Apache FOP processor resolves the issue. I suspect the problem lies elsewhere, but I'd like to rule this one out.
Duplicate the scenario you are currently using (with Output file selected) and in the duplicate change the FO Processor to Apache FOP. Does it work like that?

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
ckabstein
Posts: 142
Joined: Fri Apr 24, 2015 12:28 pm

Re: How to automatically open PDF output file using other formatter than Apache FOP?

Post by ckabstein »

Hi Adrian,

Yes, switching to Apache FOP as processor solves the issue (I had to import the root.processing_fop.xsl and the index_fop.xsl files to the custom.xsl though to make it work again. ;-)).

Christina
oXygen XML Editor 25.0 build 2023013006
DITA OT 3.7.3
adrian
Posts: 2850
Joined: Tue May 17, 2005 4:01 pm

Re: How to automatically open PDF output file using other formatter than Apache FOP?

Post by adrian »

Hi,

No, the idea was to do this without any other changes. If you made changes to the stylesheets you could affect the output filename.
So it's not just the FO Processor that you changed...

What is the output PDF filename anyway, what are you finding in the output folder?
Perhaps the stylesheets change the name slightly and thus make it different from what outputFile.base specifies.

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
ckabstein
Posts: 142
Joined: Fri Apr 24, 2015 12:28 pm

Re: How to automatically open PDF output file using other formatter than Apache FOP?

Post by ckabstein »

Hi Adrian,

Unfortunately, I had to make changes to the root-processing and the index, because otherwise the Antenna House output wouldn't work as expected re. the layout and for Apache, I had to revert them, because the index creation wouldn't work and cause errors.
I have now checked with our "old" framework that's normally using Apache FOP and switched to Antenna House without configuring anything for it. Same thing happens. Apache FOP: PDF opens, AH: PDF doesn't open. So this could, of course, also be an issue in our old framwork.

The PDF file name is generated using the XPath as already mentioned in this thread and it looks like this: _sample_project_en.pdf. The parameter is transferred as "-DoutputFile.base=_sample_project_en"

Thanks,
Christina
oXygen XML Editor 25.0 build 2023013006
DITA OT 3.7.3
adrian
Posts: 2850
Joined: Tue May 17, 2005 4:01 pm

Re: How to automatically open PDF output file using other formatter than Apache FOP?

Post by adrian »

Hi,

I have tested with Oxygen v20.0 (2018042410) and AHF v6.5 and it worked fine for me (PDF got opened in Acrobat Reader). I tested on the Oxygen\samples\dita\flowers\flowers.ditamap sample and used a duplicate of the default DITA Map PDF transformation scenario (only changed the processor to Antenna House).

Could you please also check in Options > Preferences, XML > XSLT-FO-XQuery > FO Processors, External FO processors, if the "Antenna House" processor has the correct command line arguments?
Mine, (default) has this command line (generated when you click the Browse button for Add 'Antenna House' FO Processor and pick AHFCmd.exe):

Code: Select all

"C:\Program Files\Antenna House\AHFormatterV65\AHFCmd.exe" -d ${fo} -p ${ah_method} -o ${out} -extlevel 4
If all that is correct and the PDF still doesn't get opened, please provide the full DITA-OT output log from the results panel. It is named "DITA-OT [<transformation scenario name>]". If you don't see it, go to Options > Preferences, DITA > Logging, set Show console output to Always and run the scenario again.

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
ckabstein
Posts: 142
Joined: Fri Apr 24, 2015 12:28 pm

Re: How to automatically open PDF output file using other formatter than Apache FOP?

Post by ckabstein »

Hi Adrian,

I'm sending you the console output via the support contact form.

Christina
oXygen XML Editor 25.0 build 2023013006
DITA OT 3.7.3
adrian
Posts: 2850
Joined: Tue May 17, 2005 4:01 pm

Re: How to automatically open PDF output file using other formatter than Apache FOP?

Post by adrian »

To clarify, in case someone else encounters this,

When using AHF in combination with setting a custom outputFile.base, there is indeed an issue in that the Open in Browser/System Application > Output file is not opening the correct file. It tries to open the file as determined by the ditamap name, not the outputFile.base. I've logged an issue to address this in a future release.

However, this can be avoided by using the workaround I proposed above. Make sure the correct output directory is used.
In this case the Output directory was set to

Code: Select all

${cfd}/out/pdf-A4 
and the outputFile.base was set to:

Code: Select all

${cfn}_${xpath_eval(substring(//@xml:lang,1,2))}
so, to avoid the issue, the Open in Browser/System Application > Other location should be set to:

Code: Select all

${cfd}/out/pdf-A4/${cfn}_${xpath_eval(substring(//@xml:lang,1,2))}.pdf
Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
ckabstein
Posts: 142
Joined: Fri Apr 24, 2015 12:28 pm

Re: How to automatically open PDF output file using other formatter than Apache FOP?

Post by ckabstein »

Tried it and it works.

Thanks a lot,
Adrian
oXygen XML Editor 25.0 build 2023013006
DITA OT 3.7.3
ckabstein
Posts: 142
Joined: Fri Apr 24, 2015 12:28 pm

Re: How to automatically open PDF output file using other formatter than Apache FOP?

Post by ckabstein »

I meant:
Thanks a lot, Adrian!

Christina :D
oXygen XML Editor 25.0 build 2023013006
DITA OT 3.7.3
sorin_carbunaru
Posts: 398
Joined: Mon May 09, 2016 9:37 am

Re: How to automatically open PDF output file using other formatter than Apache FOP?

Post by sorin_carbunaru »

Hello,

Just wanted to update this thread and say that the issue that Adrian logged has been fixed in version 21 of oXygen.

Thank you for using oXygen!

All the best wishes,
Sorin Carbunaru
oXygen XML
Post Reply