Expand my Community achievements bar.

SOLVED

script to get byte stream of the PDF

Avatar

Level 2

Hi,

Is there any script that can get the byte stream of the current PDF document?

I am using an offline PDF form in the application. On click of a button the, an LC process is invoked via webservice for storing the PDF in server. Is there any script by which the PDF doc itself could be converted to its bytestream and then sent over the webservice so that the PDF could be reconstructed there?

Thanks,

Muniyaraj

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

Are you calling a LiveCycle orchestration? If so then you woudl define a string as your input parameter (make sure you make it so it has no length limitation). Then when you call the service the string will contain the base64 encoded contents of your PDF. You need to get this into a document variable so in a setValue operation you can assign it to a document var using this function:

getDocFromBase64

(java.lang.String)

Paul

View solution in original post

6 Replies

Avatar

Former Community Member

I created a field called TextField2 and made it hidden from the user. I then bound the input (string) in the web service to this field and executed this command before the web service call is made:

TextField2.rawValue =

SOAP.stringFromStream(SOAP.streamEncode(Collab.documentToStream(event.target), "base64"));

Paul

Avatar

Level 2

In process side how is the PDF document generated using the input binary stream? can u please explain this also?

Avatar

Correct answer by
Former Community Member

Are you calling a LiveCycle orchestration? If so then you woudl define a string as your input parameter (make sure you make it so it has no length limitation). Then when you call the service the string will contain the base64 encoded contents of your PDF. You need to get this into a document variable so in a setValue operation you can assign it to a document var using this function:

getDocFromBase64

(java.lang.String)

Paul

Avatar

Level 2

I am able to generate the PDf document in the LC proces with the byte  stream.Is there any way by which the data in this document can be  altered in the process? or is it possible to extract the formdata from  this document variable?

Avatar

Former Community Member

Yes you can extract the data from the document .....there are two ways.

1. The easy way - in the Common category there are two Form Data Integration services - one for import and one for export. The export one os what you want. It simpy takes a PDF document type as input and creates a data file (XML) inside of a document variable. You can cast the Doc variable to an XML variable in a setValue operation then perfom XPath statements on teh XML to manipulate it.

2. If you have the Forms module you can use the processFormSubmission service to extract the data as well. This is much more sophosticated. I woudl recommend using option 1.

Paul

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----