Convert word document into PDF via Adobe Livecycle Enterprise service
Currently I am working on a customer project regarding the usage of SAP document builder. Document builder is an ABAP webdynpro application which could allow you to main template part with various document type ( html, txt, pdf, docx etc ) into a final document with again various document type. You can find more information of it via SCN wiki here.
You can play with it by starting WebDynpro application /IPRO/WD_DOCB. In preview tab there are several output types. 1 means the default docx format and 11 means PDF format ( via LiveCycle ES).
By default only docx output is supported by SAP, the PDF output is just provided via consulting note “1154999 – Using Adobe/LiveCycle ES to Render Docb Document to PDF“. As the PDF output is fundamental for customer, I have to make it work. Unfortunately the consulting note itself just contains the common development steps like how to create ABAP consumer proxy class, how to maintain logical point and RFC destination, but not for Adobe Livecycle Server configuration and deployment etc. If you are interested with this topic, please continue to read.
Although this blog is talking about document builder but actually the idea could be used generically in other case: as long as you have a binary content of a word document, you can consume Adobe LC ES to convert it to PDF in your application.
You might ask that you can google “PDF conversion” and there are plenty of open source solutions and free web services to do the job. However, the customer I am working for is the Top one in its area in China with government background. Take security into consideration, can you imagine they can accept their highly confidential document is sent to a public server which is not deployed within their landscape? You can also googled many undocumented command usage regarding Acrobat Pro which can silently do several operations like print without UI. I didn’t try that since the undocumented means if I have any issues, I could not get any official support from Adobe.
1. Of course the Adobe Livecyle ES is not for free. You must buy license from Adobe. This blog is written based on a trial version called “JBoss (window version)”, which you can download freely from Adobe website below.
2. You can find detail installation steps from http://helpx.adobe.com/livecycle.html:
The installation took about twenty minutes in my laptop with 4G memory, Inter(R) Core(TM) i5 CPU 2.53GHz, Win7 64bit OS.
1. 3. Once installation done, log on with administration console with http://localhost:8080/adminui. The default user/password : administrator/password.
For security reasons please change default password immediately.
If you can see the following screen, it means your installation is successful.
If you encounter any errors please check the installation logs. The path is:
“C:\Adobe\Adobe LiveCycle ES4\Adobe_LiveCycle_ES4_InstallLog.log” in my laptop.
1. 4. Configure JBoss server as a service in OS. You can find how to do this in document in path “C:\Adobe\Adobe LiveCycle ES4\jboss\bin\README-service.txt”. If you are installing the trial version on your laptop, it is recommended to set the service startup type as “Manual”. Or else every morning when you launch your laptop, you must have a cup of coffee because you can really use it.
The server consumes 1.9G memory in my laptop:
1. 5. Do some health check on server. Click home->services->LiveCycle PDF Generator ES4:
Click “Create PDF”:
Load any document with type other than PDF to try:
You may meet with following error messages:
In fact the JBoss server uses Adobe Acrobat XI Pro to convert the document into PDF format.
The error message prompts you that either Acrobat XI Pro is not installed or there is something wrong with environment variable set up. Don’t mix Acrobat XI Pro with Acrobat Reader XI!
Acrobat has far more powerful functionalities than the latter:
You can also download Acrobat XI Pro trial version from here:
Install and maintain the environment variable:
Also never forget to set the printer ADOBE PDF as default printer:
Then retry PDF creation and you should see the following screen:
And you can also see successful information in server.log:
It is always a good practice to analyze server.log (“C:\Adobe\Adobe LiveCycle ES4\jboss\server\lc_turnkey\log\server.log” ) if you encounter any issues.
1. 6. Import the docb_assmwml.lca attached in the note.
In admin console Home->Services->Applications and Services, ensure the status of docb_assemwml is running:
1. 7. Create the consumer proxy class in ABAP system as usual. Implement the BAdI by copying the code from note attachment. The code could not be directly activated since the generated data proxy used in the code does not exist in your own system. You must manually replace them with your own data proxy.
You can find your own data type via SE80, expand Data Types:
Find the type ends up with BLOB, that’s it.
Replace all “zasmblog” in sample code with it. After that you can activate the code.
1. 8. Test the application.
The lo_srv is instance of your consumer proxy class.
The request variable ls_invoke_request contains the binary content of original document in docx format, the response variable contains the converted binary content of PDF format, if successful. In case the conversion fails, you can again check the server.log to find root cause. Alternatively you can also use tcode SRT_UTIL to check.
ICM_HTTP_CONNECTION_FAILED: please firstly check whether your server is available, secondly check whether your RFC destination to server works or not:
ICM_HTTP_TIMEOUT: this error occurs occasionally in my testing since I install the server in my laptop and it took the server a huge time to try to convert a complex docx file into PDF format. If you also meet with this error, try to enlarge the time out threshold setting in admin console.
HTTP Code: 500 ( Internal Server Error ): it indicates some exception raised from server side when doing the conversion job.
For example: the below detail explanation gives you a hint that the environment for Acrobat XI pro is not set properly.
And this error information demonstrates that the requested service “docb_assemwml” could not be found in server side. Either check in server side whether the status of it is running or check the name of service is correct.
If everything runs well you will see final PDF displayed.
You can also save the file locally and open it with any PDF reader. If the PDF is converted via trial version of Adobe Livecycle ES, you will see the corresponding water mark on it.
Summary: if you reach here I really appreciate your reading on this blog. Adobe LC ES has far more powerful functionalities and the feature in this blog is just a tip of iceberg. You can explore more in Adobe website. My team is responsible for Document builder in SAP. If you have any questions regarding it, just feel free to contact me.