Hi everyone,
I'm currently using LiveCycle ES 8.0 and am receiving a TIFF image as an input document (Document variable). I need to take this document, get it's content (the image itself), and convert it to a String variable that I can store into a database. Once it is in the database, a webservice call will get that image byte code and put it into a form's image field.
Does anyone know of a way to accomplish this in ES 8.0? Thanks in advance, and if I need to be more specific, please let me know.
Alex
Solved! Go to Solution.
Views
Replies
Total Likes
Yes. You can do it in an Execute Script.
In fact I've posted the code to do something similar a while ago.
Check the following post: http://forums.adobe.com/message/1366379#1366379
In there is say that it's not possible to pass a document object to the jdbc service, but that's not true. You can do it if you use the parametrized query option.
The code you see there was run within the Execute Script.
However I still think you should be able to do all that using the out of the box operation within the JDBC service. But both ways should work.
Jasmin
Views
Replies
Total Likes
You could use the xPath function getDocContentBase64 to convert your document into a base 64 encoded string.
The insert it into the database using the JDBC service.
Your xpath would look something like /process_data/@myString = getDocContentBase64(/process_data/@myDoc)
Jasmin
Views
Replies
Total Likes
Hi Jasmin,
Thanks for your response. I actually couldn't find that function in 8.0. I know it is present in 8.2 and I was using it, but had to import my process to an 8.0 environment and this functionality seemed to stop working. I searched every function for each data type but couldn't find it.
Thanks,
Alex
Views
Replies
Total Likes
Sorry...That works only in 8.2!
Do you have to convert it to a string before storing in the database.
You could use the Execute SQL Statement and use the parameterized query option to store the document variable into a BLOB in the database.
Jasmin
Views
Replies
Total Likes
...or you could write a custom component to do it in 8.0.
Jasmin
Views
Replies
Total Likes
The way the stored procedure is set up, yes I do have to have it converted to a string. if I just pass in the document variable itself, it doesn't put the byte code in. I was thinking of just doing a custom script, but wasn't sure because after looking at the API for com.adobe.idp.Document, I tried reading everything in, but it only showed 3 characters in the output (II*) but it said the byte[] i was using had a size of 45015, which is correct, but the data didn't reflect this.
Views
Replies
Total Likes
You need to get the input stream from the document variable (InputStream inputStream = DocVar.getInputStream())
and then do a search on the web to convert InputStream to String and that should do it.
Jasmin
Views
Replies
Total Likes
Hi Jasmin,
Thanks for your response. Here is the code I am attempting:
Unfortunately, it is still putting out just II* as the image byte code. I'm wondering if my ISR's character set could be not getting one of the characters? Any further advice you have would be greatly appreciated.
edit: Here is a screenshot of the image in a text editor:
The black boxed codes are the problem-causing elements I think.
Thanks,
Alex
Views
Replies
Total Likes
Jasmin,
My requirements have changed a bit. I now have a BLOB field that I need to put the byte[] data in.
I believe I am successfully retreiving the byte[] data from the document now, but I just have a quick question of: Does LiveCycle ES come with the oracle.sql packages?
Thanks,
Alex
Views
Replies
Total Likes
When you install, you need to have the proper database driver so we can create our data source. I believe for Oracle the driver is ojdbc6.jar.
That file does contain an oracle.sql package.
As per the installation instruction it should be copied to the following folder:
Copy the ojdbc6.jar file from the [LiveCycleES2 root]/lib/db/oracle directory to the
[jboss bam root]/server/all/lib directory.
Jasmin
Hi Jasmin,
I cannot begin to express my gratitude to you for being so patient with me
I'm wondering if I can write the following in an Execute Script, or if I will need a Custom Component:
1. Call a stored procedure passing in an Empty_Blob with other parameters (setting the BLOB field to null)
2. Do a select statement on the row created by the stored procedure (SELECT BLOB_FIELD FROM TABLE WHERE ID = XXXX FOR UPDATE)
3. Get the BLOB from the ResultSet (rs.getBlob(1))
4. stored the byte[] from the Document object to the BLOB and then call a connection.commit()
Is this possible/allowed in an ExecuteScript?
Thanks again,
Alex
Views
Replies
Total Likes
Yes. You can do it in an Execute Script.
In fact I've posted the code to do something similar a while ago.
Check the following post: http://forums.adobe.com/message/1366379#1366379
In there is say that it's not possible to pass a document object to the jdbc service, but that's not true. You can do it if you use the parametrized query option.
The code you see there was run within the Execute Script.
However I still think you should be able to do all that using the out of the box operation within the JDBC service. But both ways should work.
Jasmin
Views
Replies
Total Likes
You mean I should be able to just use the Execute Query from JDBC to do something like:
{call sp(?,?,?,?,?)}
set up the parameters for something like: int, int, int, int, clob and then get an output string from the Execute Query?
I couldn't get it to work like that when I tried it a while back.
I'll give the execute script a try and see what I can make of it.
Thanks,
Alex
Views
Replies
Total Likes
Thank You! It worked like a charm!
Views
Replies
Total Likes
Well, if it's a stored procedure, you should use the Call Stored Procedure from the JDBC service.
But yes, you should be able to use the call sp(?,?,?) notation.
I'm glad you got it to work.
Jasmin
Views
Replies
Total Likes
Couldn't have gotten it working and look so clean if it weren't for you, so YOU got it working
Views
Replies
Total Likes
Views
Likes
Replies