How to convert XDP to PDF in Adobe LiveCycle ES3 via HTTP REST request - pdf

I have: LiveCycle server (ES3, JBOSS), Workbench, Designer.
Using LC Desginer I convert PDF to XDP - it's template now.
Now I need to convert that XDP file to PDF.
So, I guess I should somehow call LiveCycle server by HTTP request, in body of this request I can send body of XDP document. All what I need from LC is just PDF.
Looks like simple task, but I can't find ANY information how to do this. I see a lot of examples how to do this in Java, but I don't need Java, I need to do it via HTTP (REST endpoint or SOAP if it's not possible).
Maybe I need to create some "application" in Workbench? If so, is there any step-by-step documentation? Or maybe somebody can explain me, how to do this. Maybe there is already build-in application in ES3 Server - I think it's very common and simple case.
UPD: I've opened job at Odesk for this issue, I promise to post solution here to share knowledge with community

As was promised, here is how to solve this issue:
It's not enough just put PDF into LiveCycle Designer. You exactly need to design form in LC Designer. You can use your PDF as template, but for all things which you want to fulfil by your custom data, you need to add objects in LC Designer (take a look at the "Insert" menu, try Table or Text Field) and add Data Connection in the "Data View" tab. I think it's pretty easy step for professionals, but it can take some time to get by beginners. Save results of your work as, for instance, Template.xdp file.
Also you now have the example of XML file - source of the data. Let's name it DataSource.xml
Now we can install LiveCycle Server. Best for LC ES3 is RHEL 5.5 (we spent around 2 days just to find correct combination of OS and settings). You'll need a clever system-administrator (or just experienced in Adobe LiveCycle :))
Server is working now, you can see web-interface, so let's create application in Adobe LiveCycle Workbench ES3. Add an application with new name and add a process to that application. It will take to many words to describe all steps of process, just take a look at screenshots of result (and notice variables also):
Now most easy part - call this app by the HTTP request. But we can't just send usual POST request to Adobe LiveCycle :) We have to send content of 2 files (Template.xdp and DataSource.xml) as multipart/form-data and names of the parts are the names of input variables (in my example is xmlTemplate and xmlData). And don't forget Authorization header with Basic authorization credentials.
In the Response you'll receive base64-encoded body of the PDF document.
Thanks to Thierry Stortenbeker for this application and for help and patience.

Yes, you have to create an LC application using workbench. Here is how to do it:
Create a new application in workbench using File -> New -> Application.
Create a new Process using the right click menu at the application.
Drop in renderPDF form activity from the activity and name it "renderPDFForm".
Select renderPDF form activity to add variables using the bottom pane of variables.
Add a variable of "Document" type and name it "inputXDP". We will use this to pass xdp file. Mark it to be "input" variable.
Add a variable of "Document" type and name it "outPDF". Mark it to be "output" variable.
Now double click renderPDFForm activity, this will open a property editor on the left side.
Expand "Input" section if not expanded already. Make sure "Form" to be picked up from variable. Then choose "inputXDP" from the dropdown.
Expand "Output" section if not expanded already. Make sure "Rendered Form" to be picked up from variable. Then choose "outPDF" variable from the dropdown.
Now deploy your application by right click menu on application.
That is it. You are ready to go. Now save the process and double click "default start point" to get the rest url where this service would be exposed. The rest url should look like http://localhost:8080/rest/services/RestFormRender/renderForm:1.0. Here RestFormRender is name of the application and renderForm is name of the process. Now make a GET/POST call to this REST url and specify XDP bytes in "inputXDP" request parameter.

Related

Let a PDF prompt for an input and insert it

I would like a PDF for some support workers, which should be easily editable.
I need it to ask on first open for a kind of Customer ID. This should be inserted into the document. Is this possible?
Thanks for help!
This requires either a smart PDF viewer (such as Adobe Acrobat (Reader) on computers, PDFExpert on iDevices, qPDF on Android) OR serverside support.
In the first case, you would use the app.response() method to let the user enter that identifier and then set the result to the according field's value. That could be placed in the PageOpen event of the page the document opens.
Also doing its purpose would be setting the focus to that field when the page opens.
With server support, you could set up a HTML page where the user enters the identifier, submit that to the server, and have the server prefilling the form, using either a ready application like FDFMerge by Appligent, or using one of the PDF creating libraries floating around (such as iText, pdflib, etc.).

Sensenet upload files to a document library - fields fill

It is possible in the moment of upload a content to a document library show the fields defined (of the document library)? At the moment, the only way that the user have to fill the fields is uploading the document first and then click edit to fill the fields.
Unfortunately there is no out-of-the box solution for this scenario. I agree that this would be useful, but currently you have to create a custom solution.
You will have to create a UI that displays the upload control (you can use the built-in Sense/Net plugin) and also the form fields. In the click event of a button, you have to first start and finish the upload, retrieve the new content id and than update the metadata fields - all this in JavaScript. This way users would not see the difference, for them this would be a single operation.
(in mid-term we plan to offer a built-in control that will make this possible, but we do not have a timeline for this feature)

Self-Hosted Document Editor (like Google Docs) - to print

I am looking to facilitate the users of my website with a google-doc like text editor, where the user can write and format text in the context of an A4-page rather than a HTML textbox, which can be saved on server later on.
The idea is that, later I can proceed to print the file on server-side, without asking the user to go through the File->Print from his browser and then re-upload the locally saved PDF, instead I would generate a printable format of the input.
A simple WYSIWIG editor won't do I believe, as it will not be able to edit address fields inside it, but feel free to prove me wrong!
Thanks!

PDF Form data Submission Via REST API / Web Services

I am having a PDF form that saves the data and validate the data entered by user e.g. a client information PDF document that takes client data and when user click on send button, it must post the data to the web service that further process it or saves to database.
I am using Acrobat Professional for this. Can anyone help in this?
Acrobat and Adobe Reader can submit form data to any URL using a button on the document and the "Submit a Form" action or via Acrobat JavaScript (probably unnecessary). You just need something on the server to interpret the data. If you submit as HTML, the submission will look just like query parameters where the key names are the same as the names of the fields and the values, same as the field values without the formatting. To the server, it looks like it was submitted from a standard HTML form so just about anything you have will be able to work with the submission.
You need to use Acrobat Pro to add this button to the document but then Standard and Reader can use it.
See https://helpx.adobe.com/acrobat/using/setting-action-buttons-pdf-forms.html
You can also submit as FDF or XFDF, an XML(ish) expression of FDF, in which case you'll want to use something like the FDF Toolkit to read it but based on your question, I don't think you need to do that.
3rd party edit
Information from the linked page
FDF
Returns the user input without sending back the underlying PDF file.
You can select options to include Field Data, Comments, and
Incremental Changes To The PDF.
XFDF
Returns the user input as an XML file. You can include Comments with
the field data or just the field data.

How to create switchable multi-language pdf form?

I want to create a pdf form for two language (Chinese/English) UI, and there's a button(s) or somethings on the form for language switch, is there anyway can make it? and how to do?
thanks!
Thanks for all reply!
Actually I got a sample like this,
PDF Sample
there're two checkbox on the top-left of the form, one is for English UI, the other is Chinese, I just want to know how to make PDF like that sample? (and I don't see any layers on the sample...)
thx
mkl's comment (which he should turn into a full answer, really) already hinted at the option to use different page templates residing in the same file.
Another option you could explore is this:
put the two language versions into 2 different layers (or 'optional content groups' in PDF parlance)
make the visibility of the two layers toggeable
let the user activate that layer which he/she needs.
Layer activation can be handled through normal Acrobat Reader user interface elements.
The layer switching can be made accessible via a "button" on the PDF page too -- but that requires additional JavaScript to be embedded in the PDF (something many people are not particularly keen about).
As Kurt proposed, I make my comment on Frank's answer an answer in its own right:
Actually there is a pdf feature seldomly used nowerdays, page
templates. Thus, those two forms can reside in the same file in
different page templates, and based on some initially present buttons
("English version", ...) the desired form is spawned.
Unfortunately I don't know how to create page templates using some easy-to-use tool, I only came a cross them in the context of integrated PDF signatures (depending on the signature type, page template instantiation is a document change not breaking the signature) and tested them with low-level tools.
Essentially page templates are PDF objects just like page dictionaries of the normal pages, they are not XFA stuff. They merely are not referenced in the pages tree but instead in the name tree.
There is a JavaScript command which creates a visible page based on such a template --- I don't know which anymore; I may be able to find out when I'm back in office next week. This command would have to be bound to the inital language selection button in the file.
The problem will be in switching the static text - PDF does not allow this.
If I were you, I would split the document into two identical forms in the respective languages. You can use bookmarks and links on the first page to navigate to the right part of the document.
Note that it is possible to assign the same field names to the Enlgish/Chinese versions of your fields. This will make it easier to process the submitted form data because the process path would be independent of the chosen language. It will also simplify any JavaScript (validation, summing, etc.) you plan to add.