PDF print resource: how to set PDF file name

Post any questions you have about using the Verj.io Studio, including client and server-side programming with Javascript or FPL, and integration with databases, web services etc.

Moderators: Jon, Steve, Ian, Dave

xren
Ebase User
Posts: 272
Joined: Fri Dec 14, 2012 2:55 pm
Location: Ottawa

PDF print resource: how to set PDF file name

#1

Postby xren » Mon Aug 22, 2016 10:00 pm

Hi,

I would like to use PDF print resource to print pdf file based on form fields.

How can I set a specific file name to this being generated PDF file based on my PDF form?

Thanks,
Xiaoli
0 x

Jon
Moderator
Moderator
Posts: 1342
Joined: Wed Sep 12, 2007 12:49 pm

#2

Postby Jon » Tue Aug 23, 2016 8:09 am

I don't think you can influence the generated file name for the saved PDF, but you should be able to rename it once it's been generated. The system variable $FILE_NAME should contain the name of the generated file. You can access this using:

system.variables.$FILE_NAME.value;

Then you should be able to rename the file with:

services.file.moveFile(oldname, newname);
0 x

xren
Ebase User
Posts: 272
Joined: Fri Dec 14, 2012 2:55 pm
Location: Ottawa

How to use PDF print resources from workflow system activity

#3

Postby xren » Tue Aug 23, 2016 7:37 pm

OK.

When I try to use print resources from a workflow system activity.

It gave exception:
ERROR Error occurred executing command PRINT for resource SSA_ScrubEx - com.ebasetech.ufs.workflow.server.enactment.Job cannot be cast to com.ebasetech.ufs.runtime.FormUserState

How can I use PDF print resources from workflow system activity?

Thanks,
0 x

Jon
Moderator
Moderator
Posts: 1342
Joined: Wed Sep 12, 2007 12:49 pm

#4

Postby Jon » Wed Aug 24, 2016 7:43 am

This looks like a bug to me. Do you have the full stack trace please - should be in the server log. Then we'll fix it.
0 x

xren
Ebase User
Posts: 272
Joined: Fri Dec 14, 2012 2:55 pm
Location: Ottawa

PRINT resources: error log from the log file.

#5

Postby xren » Wed Aug 24, 2016 2:24 pm

Hi Jon,

Please see the error log below. I hope it can be fixed very soon.

Thanks,
Xiaoli

Mon Aug 22 20:50:50: INFO Running On Click event for Control But3E1pY
Mon Aug 22 20:50:50: INFO Executing Javascript script test
Mon Aug 22 20:50:50: ERROR Error occurred executing command PRINT for resource SSA_ACK - see server log
Mon Aug 22 20:50:50: ERROR Wrapped com.ebasetech.xi.exceptions.FormRuntimeException: Error occurred executing command PRINT for resource SSA_ACK - see server log (test#8)
com.ebasetech.ufs.runtime.events.rhinojavascript.RhinoScriptException: Wrapped com.ebasetech.xi.exceptions.FormRuntimeException: Error occurred executing command PRINT for resource SSA_ACK - see server log (test#8)
at com.ebasetech.ufs.runtime.events.rhinojavascript.JavascriptExecutionHandler.handleExecutionErrors(JavascriptExecutionHandler.java:355)
at com.ebasetech.ufs.runtime.events.rhinojavascript.JavascriptExecutionHandler.execute(JavascriptExecutionHandler.java:280)
at com.ebasetech.ufs.runtime.events.JVMScriptNode.execute_(JVMScriptNode.java:133)
at com.ebasetech.ufs.runtime.events.JVMScriptNode.execute(JVMScriptNode.java:99)
at com.ebasetech.ufs.runtime.events.RunnableContext.execute(RunnableContext.java:69)
at com.ebasetech.ufs.runtime.events.SuspendableExecutable.execute(SuspendableExecutable.java:47)
at com.ebasetech.ufs.runtime.events.SuspendableContainerExecutable.execute(SuspendableContainerExecutable.java:26)
at com.ebasetech.ufs.runtime.events.BaseEventNode.execute(BaseEventNode.java:32)
at com.ebasetech.ufs.runtime.events.RunnableContext.execute(RunnableContext.java:69)
at com.ebasetech.ufs.runtime.events.SuspendableExecutable.execute(SuspendableExecutable.java:47)
at com.ebasetech.ufs.runtime.events.SuspendableContainerExecutable.execute(SuspendableContainerExecutable.java:26)
at com.ebasetech.ufs.runtime.events.RunnableContext.execute(RunnableContext.java:69)
at com.ebasetech.ufs.runtime.events.SuspendableExecutable.execute(SuspendableExecutable.java:47)
at com.ebasetech.ufs.runtime.events.SuspendableContainerExecutable.execute(SuspendableContainerExecutable.java:26)
at com.ebasetech.ufs.runtime.events.RunnableContext.execute(RunnableContext.java:69)
at com.ebasetech.ufs.runtime.Request.execute(Request.java:448)
at com.ebasetech.ufs.runtime.Request.execute(Request.java:417)
at com.ebasetech.ufs.runtime.Request._execute(Request.java:352)
at com.ebasetech.ufs.runtime.Request.execute(Request.java:317)
at formservlets.FormProcessingUtil.executeRequest(FormProcessingUtil.java:503)
at formservlets.EbaseAjaxServlet.process(EbaseAjaxServlet.java:69)
at formservlets.EbaseAjaxServlet.doPost(EbaseAjaxServlet.java:38)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at formservlets.EbaseFilter.processRequest(EbaseFilter.java:253)
at formservlets.EbaseFilter.performFilter(EbaseFilter.java:180)
at formservlets.EbaseFilter.doFilter(EbaseFilter.java:100)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:198)
at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:176)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:203)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:673)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1526)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1482)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
Caused by: com.ebasetech.xi.exceptions.FormRuntimeException: Error occurred executing command PRINT for resource SSA_ACK - see server log
at com.ebasetech.ufs.runtime.external.api.impl.Exceptions.makeFormRuntimeException(Exceptions.java:23)
at com.ebasetech.ufs.runtime.external.api.impl.PrintResourceWrapper.print(PrintResourceWrapper.java:34)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:126)
at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:225)
at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:1479)
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:815)
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:109)
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:393)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3280)
at org.mozilla.javascript.Context.callFunctionWithContinuations(Context.java:1284)
at org.mozilla.javascript.Context.executeScriptWithContinuations(Context.java:1251)
at com.ebasetech.ufs.runtime.events.rhinojavascript.JavascriptExecutionHandler.execute(JavascriptExecutionHandler.java:270)
... 51 more
Mon Aug 22 20:50:50: INFO Transaction rolled back
Mon Aug 22 20:50:50: ERROR com.ebasetech.xi.exceptions.FormRuntimeException: com.ebasetech.ufs.runtime.events.rhinojavascript.RhinoScriptException: Wrapped com.ebasetech.xi.exceptions.FormRuntimeException: Error occurred executing command PRINT for resource SSA_ACK - see server log (test#8)
Mon Aug 22 20:50:50: Unexpected error occurred - see server log
Mon Aug 22 20:50:50: ERROR Unexpected error occurred
com.ebasetech.xi.exceptions.FormRuntimeException: com.ebasetech.ufs.runtime.events.rhinojavascript.RhinoScriptException: Wrapped com.ebasetech.xi.exceptions.FormRuntimeException: Error occurred executing command PRINT for resource SSA_ACK - see server log (test#8)
at com.ebasetech.ufs.runtime.events.JVMScriptNode.handleExecutionErrors(JVMScriptNode.java:213)
at com.ebasetech.ufs.runtime.events.JVMScriptNode.execute(JVMScriptNode.java:114)
at com.ebasetech.ufs.runtime.events.RunnableContext.execute(RunnableContext.java:69)
at com.ebasetech.ufs.runtime.events.SuspendableExecutable.execute(SuspendableExecutable.java:47)
at com.ebasetech.ufs.runtime.events.SuspendableContainerExecutable.execute(SuspendableContainerExecutable.java:26)
at com.ebasetech.ufs.runtime.events.BaseEventNode.execute(BaseEventNode.java:32)
at com.ebasetech.ufs.runtime.events.RunnableContext.execute(RunnableContext.java:69)
at com.ebasetech.ufs.runtime.events.SuspendableExecutable.execute(SuspendableExecutable.java:47)
at com.ebasetech.ufs.runtime.events.SuspendableContainerExecutable.execute(SuspendableContainerExecutable.java:26)
at com.ebasetech.ufs.runtime.events.RunnableContext.execute(RunnableContext.java:69)
at com.ebasetech.ufs.runtime.events.SuspendableExecutable.execute(SuspendableExecutable.java:47)
at com.ebasetech.ufs.runtime.events.SuspendableContainerExecutable.execute(SuspendableContainerExecutable.java:26)
at com.ebasetech.ufs.runtime.events.RunnableContext.execute(RunnableContext.java:69)
at com.ebasetech.ufs.runtime.Request.execute(Request.java:448)
at com.ebasetech.ufs.runtime.Request.execute(Request.java:417)
at com.ebasetech.ufs.runtime.Request._execute(Request.java:352)
at com.ebasetech.ufs.runtime.Request.execute(Request.java:317)
at formservlets.FormProcessingUtil.executeRequest(FormProcessingUtil.java:503)
at formservlets.EbaseAjaxServlet.process(EbaseAjaxServlet.java:69)
at formservlets.EbaseAjaxServlet.doPost(EbaseAjaxServlet.java:38)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at formservlets.EbaseFilter.processRequest(EbaseFilter.java:253)
at formservlets.EbaseFilter.performFilter(EbaseFilter.java:180)
at formservlets.EbaseFilter.doFilter(EbaseFilter.java:100)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:198)
at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:176)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:203)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:673)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1526)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1482)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
Caused by: com.ebasetech.ufs.runtime.events.rhinojavascript.RhinoScriptException: Wrapped com.ebasetech.xi.exceptions.FormRuntimeException: Error occurred executing command PRINT for resource SSA_ACK - see server log (test#8)
at com.ebasetech.ufs.runtime.events.rhinojavascript.JavascriptExecutionHandler.handleExecutionErrors(JavascriptExecutionHandler.java:355)
at com.ebasetech.ufs.runtime.events.rhinojavascript.JavascriptExecutionHandler.execute(JavascriptExecutionHandler.java:280)
at com.ebasetech.ufs.runtime.events.JVMScriptNode.execute_(JVMScriptNode.java:133)
at com.ebasetech.ufs.runtime.events.JVMScriptNode.execute(JVMScriptNode.java:99)
... 49 more
Caused by: com.ebasetech.xi.exceptions.FormRuntimeException: Error occurred executing command PRINT for resource SSA_ACK - see server log
at com.ebasetech.ufs.runtime.external.api.impl.Exceptions.makeFormRuntimeException(Exceptions.java:23)
at com.ebasetech.ufs.runtime.external.api.impl.PrintResourceWrapper.print(PrintResourceWrapper.java:34)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:126)
at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:225)
at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:1479)
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:815)
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:109)
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:393)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3280)
at org.mozilla.javascript.Context.callFunctionWithContinuations(Context.java:1284)
at org.mozilla.javascript.Context.executeScriptWithContinuations(Context.java:1251)
at com.ebasetech.ufs.runtime.events.rhinojavascript.JavascriptExecutionHandler.execute(JavascriptExecutionHandler.java:270)
... 51 more
0 x

Jon
Moderator
Moderator
Posts: 1342
Joined: Wed Sep 12, 2007 12:49 pm

#6

Postby Jon » Wed Aug 24, 2016 2:36 pm

We should be able to include this fix in V5.2.
0 x

xren
Ebase User
Posts: 272
Joined: Fri Dec 14, 2012 2:55 pm
Location: Ottawa

#7

Postby xren » Wed Aug 24, 2016 3:25 pm

Do you have a time line for v5.2 release?
0 x

Jon
Moderator
Moderator
Posts: 1342
Joined: Wed Sep 12, 2007 12:49 pm

#8

Postby Jon » Wed Aug 24, 2016 4:09 pm

Should be next week.
0 x

Segi
Ebase User
Posts: 649
Joined: Mon Dec 09, 2013 6:37 pm

#9

Postby Segi » Wed Aug 24, 2016 4:40 pm

Jon,

Are you be able to share what new features we can expect in 5.2 ?
0 x

Jon
Moderator
Moderator
Posts: 1342
Joined: Wed Sep 12, 2007 12:49 pm

#10

Postby Jon » Wed Aug 24, 2016 4:46 pm

0 x


Who is online

Users browsing this forum: No registered users and 8 guests