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: 58

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

Wed May 09, 2018 4:34 pm

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
adrian
Posts: 2445

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

Wed May 09, 2018 5:33 pm

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: 58

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

Fri May 11, 2018 11:22 am

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
adrian
Posts: 2445

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

Fri May 11, 2018 3:54 pm

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: 58

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

Fri May 11, 2018 4:52 pm

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
adrian
Posts: 2445

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

Fri May 11, 2018 5:03 pm

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: 58

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

Fri May 11, 2018 5:36 pm

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
adrian
Posts: 2445

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

Fri May 11, 2018 6:09 pm

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: 58

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

Mon May 14, 2018 12:29 pm

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
adrian
Posts: 2445

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

Tue May 15, 2018 12:04 pm

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: 58

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

Fri May 18, 2018 5:16 pm

Hi Adrian,

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

Christina
adrian
Posts: 2445

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

Fri May 25, 2018 4:46 pm

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: 58

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

Mon May 28, 2018 4:28 pm

Tried it and it works.

Thanks a lot,
Adrian
ckabstein
Posts: 58

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

Mon May 28, 2018 4:29 pm

I meant:
Thanks a lot, Adrian!

Christina :D

Return to “Common Problems”

Who is online

Users browsing this forum: Bing [Bot] and 6 guests