PDF generation in orbeon - java

I have an orbeon form and when someone has fill out the form, I want it to create a pdf and sent it to my webservice.
Right now, when the form is fill out and you press sent, the document id, app name and form name are sent to the webservice.
Can anyone help me with a guide or an example ?
The webservice is in grails (JAVA).
Best regard
Martin

You have to customize a process for your send/save button.
Have a look a this:
http://doc.orbeon.com/form-runner/advanced/buttons-and-processes/index.html
Scroll to 'Customizing processes'. You can find here an example of the process for the send button:
<property
as="xs:string"
name="oxf.fr.detail.process.send.acme.hr"
value='require-valid
then pdf
then email
then send("http://example.org/")
then navigate("/success")
recover navigate("/failure")'/>
The 'pdf' action should generate a pdf document.
To get an url of the document you can customize the 'send' action: go to
'Core Form Runner actions' at http://doc.orbeon.com/form-runner/advanced/buttons-and-processes/index.html and find 'send'. In the 'content' property you can specify 'pdf-url' to get the pdf url. The 'uri' property should point to your webservice.
Once your web service receives a pdf url, you can issue a request using the url to download document.

Related

how can we store a web page form html template along with the user entered data in any server?

I have and html template where i want to store whole html template along with user data in some directory?
Please let me know if there is any way?. Html template is as shown here.
in principle the HTTP request (from the HTML form) delivers the data entered by the user. I would save that separately (common practise is obviously a DB, but you can also save as JSON file in a directory).
You can always load the HTML and fill the data you need on-the-fly.
If you really want to save the HTML with the data, on your backend you need to get the actual HTML source and manipulate it to add the user data in each field.

HTML mail is get manipulated by <wbr> tag

I'm working on a logic which sends a mail according to the form submission. In that form I have a rich text editor which is created using summernote.
now when I submit the form, it submit the base64 encoded image to server side correctly. Please find the part of the submitted content below,
<p>test</p><p><img src="data:image/jpeg;base64,/9j/4AAQSkZJRg...
However, After receiving the mail renders in gmail as a byte array like below,
when I inspect the element I can see a tags like below,
I try to fix the issue by unescapeHtml the body in the server-side but no luck on that. Whats I'm doing wrong here? how can I fix this please help?

Servlets: sending 2 requests to JSP

I have a form with drop-down box on JSP page. User chose what kind of documentation he would like to get. Post is send to servlet. Then servlet is getting data from different files combines them and add to arrayList. Send it back to JSP:
rules = vp.getProperyRules();//ArrayList<RuleObject>
request.setAttribute("rules", rules);
request.getRequestDispatcher("rulesDocumentation.jsp").forward(request, response);
Then JSP is printing them out in nice table. But I was asked to give an user opportunity to download an excel file as well. When he clicks "Get Documentation" button I want to add a link that will allow him to get a report as well as printing out table with documentation.
So I have couple of questions:
Now I am sending back Arraylist of all rules contained in documentation. Should I modify it to send excel file as well?
Or I should just create link that will point to temp file on server(report) when user will click on that link he will download a file. How to do it? Modify response that it will send arraylist and fileName of temp report stored on server side?
I would really appreciate your help

Send email html form

I want an HTML form to send email.
In it I have dropdown list(course).On selecting course,i want checkboxes with labels that are branches of the course selected.
How to create add attachment button(i mean backend coding that will insert a new file tag onto the page)
Waiting for ur replies.
I dont know AJAX,Jquery etc.
I know Java(jsp,servlet),html,javascript.
Simple answer for pure HTML: you can't.
When you don't want to send emails like so Send Mail, which would open the user's email client to send it manually. You will need an php server in the back which is able to send emails.
If you want to do it with JSP
http://www.java-samples.com/showtutorial.php?tutorialid=675
This tutorial also provides file upload, or better for you it provides finished code:
http://www.oop-reserch.com/scheduler_example_1.html
http://www.java-tips.org/java-ee-tips/javaserver-pages/how-to-send-e-mail-through-jsp.html
HTML forms don't do much other than, when submitted, send the inputs they contain back to the server in the for of an HTTP POST.
In order to display the checkboxes in response to the select input (dropdown list) changing you've got two options:
make an AJAX call that gets the values for the checkboxes from the server, modifying the DOM when the response is received (this will be by far the better user experience).
submit the form and generate a new page based on the value of the select input (dropdown list).
Once the form contains the inputs required to send the mail it can be submitted, resulting in an HTTP POST at the server. You'll need to read the input values and send the mail using JavaMail.
With regards to the attachment, you need to first get the uploaded file (Apache Commons can help you there) then attach the file to the mail as explained here.

GWT attached pdf document in post response

I have an issue with http response.
I send some data and in response I get attached pdf document, and I need to open it document in a new browser tab.
I can't do it using Window.Open(String url, String title, String... parameters) because I dont have this url.
if I open it with right click on and tell firebug "Open in a new Tab" I got an url
In order to display pdf in your page you should have Content-Type: application/pdf in your response header. So, You should set in response header in your servlet which is responsible that given url.
After that you can put your pdf inside one of these html tags embed, object or iframe. I think gwt's Frame is a good way to do it. See this tutorial as well: 4 Ways To Stream Pdf and Some Tips

Categories