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.