I was thinking of using the Publish addon to incorporate results from a web 
form in a PDF document but ran into the following error when trying to run 
publish from the Jconsole.

If the Publish addon is run in an environment where PDFREADER_j_ is not set 
(e.g. from Jconsole) then there is a control error:

   load 'format/publish'
   publish jpath '~addons/format/publish/demo/master.txt'
|control error: view
|       view''

In fact the PDF document is created fine, the error occurs when the script is 
deciding to display the PDF or not. The relevant parts of the publish.ijs 
script are:
======publish.ijs OLD=======
...

PDFreader=: PDFREADER_j_

...

view=: 3 : 0
if. #PDFreader do.
...
)

...
======================

If the noun PDFREADER_j_ does not exist then #PDFreader doesn't produce an 
integer result and thus the control error.

The global noun "PDFreader" is only used in the verb "view" so the following
should fix the bug:

======publish.ijs NEW================
...

getPDFreader=: 3 : 0
if. 0~: 4!:0 <'PDFREADER_j_' do.
  ''
else.
  PDFREADER_j_
end.
)

...

view=: 3 : 0
if. #PDFreader=. getPDFreader'' do.
...
)

...
======================

Any better solutions?
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to