Values of fillable form in PDF are only saved and not visible in the content of the Alfresco Node

Hi,
I have OnlyOffice Version: 8.0.1. Build: 31 installed in docker with the Alfresco connector.
But i’m integrating Document Server with my own application.
In this application i want to edit the previously created pdf forms (stored in alfresco) and when i click the “complete and submit” button (visible thanks to the flag submitForms of the customization object) i want this action to overwrite the content of the alfresco node of the document that i’m filling.
If i only save the doc i will see the values that the user entered in the form of the document (this works fine, i can see the values) but if i go to the content of the alfresco node these values are not “written” in the pdf.
If i press the “complete and submit” button in my application an error occur:
nodeJS - Empty Callback=undefined or baseUrl=http://XXX or userLastChangeId=admin commandSfcCallback.

Hello @Ghug

This message states that there is no Callback Handler to send data to. All data in form fields is sent to the Callback Handler when a user clicks Complete & Submit button as formsdataurl in JSON format:

After receiving forms data you can generally implement your own scenario to process it. In general, it is not supposed that after pressing Complete & Submit button all content will be saved back to the storage with filled fields even with fully implemented Callback Handler, you need to process data separately.

Thank you for the help. I will try this approach.

I have another question. I’m looking in the documentation but i can’t figure out how i can download the pdf filled by the user through api call.

If i click in the onlyoffice view “download as” pdf the file have the correct form filled. But if i try

http://blabla/ConvertService.ashx
With “filetype”:“pdf”,“outputtype”:“pdf”
And i correctly download the pdf but this pdf downloaded is not filled with values of the form either if the values are correctly saved.

Indeed if i open in the editor the file i can see the form filled. But if i download with the convert service the file in pdf the enetered values are not in the pdf.

I’m trying the
http://blabla/api/2.0/files/file/fileid/presigneduri
but i don’t know what i have to insert as fileid value.
Can you help me please?
Thank you.

I have seen in the console of the browser that when i click “save as” onlyoffice make two calls:

1)the firs one is the post request to the url downloadas that I’m replicating in my java as this

//alfresco nodeid
String nodeId = “e541cc8f-c71c-4690-b69f-260318e5953b”;
String a = “http://blabla/8.1.1-26/downloadas/“+nodeId+”_1.0”;

    JSONObject joo = new JSONObject();
    joo.put("c", "save");
    joo.put("id", nodeId+"_1.0");
    joo.put("userid", "admin");
    joo.put("outputformat", "513");
    joo.put("title", "test.pdf");
    joo.put("nobase64", true);
    joo.put("isSaveAs", false);
    joo.put("lcid", 1040);
    joo.put("savetype", 3);
    joo.put("saveindex", 1);
    joo.put("userconnectionid", "admin7");

    HttpResponse<JsonNode> r = Unirest.post(a)
            .header("accept", "application/json")
            .queryString("cmd", joo)
            .queryString("shardkey", nodeId+"_1.0")
            .asJson();

and this works fine. The response that i get is
200
{“type”:“save”,“status”:“ok”,“data”:“e541cc8f-c71c-4690-b69f-260318e5953b_1.0_2726”}

2)the second call is the get call to cache/files/data call that i’m replicating with

//obj.getString(“data”) is the value in the previous response field “data”
String b = “http://blabla/cache/files/data/“+obj.getString(“data”)+”/output.pdf/test.pdf”;
HttpResponse<byte> rg = Unirest.get(b)
.header(“accept”, “application/json”)
.queryString(“md5”, “D-SZm769fMdYrD5ot8E47Q”)
.queryString(“expires”, “1722932318”)
.queryString(“shardkey”, nodeId+“_1.0”)
.queryString(“filename”, “test.pdf”).asBytes();

but this is not working (response 403 forbidden) i think that i’m send wrong md5 and expires values. How can i generate the right values for this? Because the md5 not seems the md5 of the file. Is it encrypted?
Can someone please help me with this problem?

Hello @Ghug
If you don’t mind, I will join this thread too.

I’m trying the
http://blabla/api/2.0/files/file/fileid/presigneduri
but i don’t know what i have to insert as fileid value.

You are trying to use this method, as far as I understand. Get file download link - ONLYOFFICE Api Documentation
However, this method is related to DocSpace installation, but you are using Alfresco and you own self-written app.

To be honest, I don’t completely understand your entire scenario. If you are integrating DS with your own app, why are you trying to perform Save process between your app and Alfresco through the Document server API? I mean that you have two separate DMS, so, from my point of view you should implement saving to your app first. And after that you can do with a file whatever you want (for example, passing it to Alfresco DMS).
If I misunderstood the entire scenario, please clarify it.

Hi Ghug,

I think I’m in a similar case to you.

I use onlyoffice document server to try to fill pdf. This part works, I can open the pdf, fill it, then click on Submit button.
The callback url is called, and my document storage server is inform and receive the document status.

I have the url of the pdf document, which is not filled :
http://192.168.0.5:8190/cache/files/data/b17a870b-3944-3462-acd5-7fb925beccca_3063/output.pdf/output.pdf?md5=56aDDl2rMyQbqCO2bs28Gw&expires=1727773304&shardkey=b17a870b-3944-3462-acd5-7fb925beccca&filename=output.pdf

I have the url of the json data :
http://192.168.0.5:8190/cache/files/data/b17a870b-3944-3462-acd5-7fb925beccca_3063/formsdata.json/formsdata.json?md5=xP9KRI0kGw_0nnJM5kAd8g&expires=1727773304&shardkey=b17a870b-3944-3462-acd5-7fb925beccca&filename=formsdata.json

But I wish to have the pdf with the form filled aka json data and pdf merged in one pdf file.
As I understand, you tried to do the same action.

Did you manage to download the pdf filled ?

@Alexandre perhaps it give you more information ?

Thanks

Hi,
i need this information too. I’m exactly in your situation.
I have already resolved this but i don’t remember how. And now i’m again in this situation with a fresh installation. I have my custom callback and i need to retrieve the doc filled from the document server.

I have resolved this toggle the autosave on true on the customization object. So the problem is that onlyoffice is showing us the latest version that it has. With the auto save option enabled when the user enter the value in the form the doc is saved on the document server and when the user push the complete botton the custom callback handler will retrieve the doc with the form filled.

Hi,
Your solution does not resolved my problem, the callback handler still send the pdf with empty form.

Hello @rdenarie and @Ghug
I believe I understand the desired scenario. Thank you for the provided details!
We are going to improve save process for the PDF editor in the next upcoming release (v.8.2). The release is planned in a few weeks. The improvement will provide the ability to save changes to the file smoothly in the PDF editor.
For now I recommend to wait for the release and get back to this scenario after the update.