ocis icon indicating copy to clipboard operation
ocis copied to clipboard

Support the fillable only mode pdf on an Onlyoffice

Open 2403905 opened this issue 9 months ago • 1 comments

Describe the bug

The docxf format has been deprecated since Oo v8.1 and replaced by the pdf form https://www.onlyoffice.com/blog/2022/01/how-to-create-fillable-forms Oo 8.1 changelog

We want to mimic the user flow from the oldest Oo version when the user was able to create and modify the form docxf file and after that, the user was able to save this document as a fillable form in an oform format to share it with the users. Another user who get access to oform document was able to fill it out, but not modify it.

The replies from Oo

I open a new pdf form in an editor. How can I save this pdf from as a regular pdf?

When creating PDF form in the ONLYOFFICE editor it adds metadata about forms to the PDF, so that it is recognized as PDF form when opened in our editor. If you are going to open this PDF form in third-party editor it will ignore metadata and open the file as regular PDF. ONLOFFICE editor will always open it as PDF form. If you need to fill in the form you need to open the editor with formsubmit action. This will be similar to fillForms permission available for API, you can see it in Try now section https://www.onlyoffice.com/see-it-in-action.aspx.

Expected behavior

A clear and concise description of what you expected to happen.

Actual behavior

A clear and concise description of what happened.

Setup

Please describe how you started the server and provide a list of relevant environment variables or configuration files.

OCIS_XXX=somevalue
OCIS_YYY=somevalue
PROXY_XXX=somevalue

Additional context

Add any other context about the problem here.

2403905 avatar Mar 28 '25 10:03 2403905

I think there are 2 different issues:

  • Creating the pdf form from within oCIS
  • Allow the pdf form to be filled.

When creating PDF form in the ONLYOFFICE editor it adds metadata about forms to the PDF, so that it is recognized as PDF form when opened in our editor

This is the issue I'm not sure how to solve. I'm pretty sure, at the moment, we're creating a 0-byte file and tell OnlyOffice to edit that file. A 0-byte "file.pdf" isn't a valid pdf file, and that's why OnlyOffice complains.

We can send the contents of a predefined pdf file instead of creating the 0-byte file. Then, opening such file shouldn't cause an error to OnlyOffice.

The additional problem is that sending a "regular" pdf form might not be enough for OnlyOffice. It might have limited capabilities because we need to include additional metadata for OnlyOffice.

In order to solve this problem, I think we need to copy the "new" template for pdfs from OnlyOffice, assuming it has the required metadata, so the editor is loaded with all the functionality. That pdf content is what would need to be stored instead of the 0-byte file. They have different templates for each language, so I'm not sure if this is a good approach. Currency and date formats might differ, and we'd provide the same generic template regardless of the language. Auto-generating the content based on the language might be better, but the content might be quite complex to be generated by the code.

If you need to fill in the form you need to open the editor with formsubmit action

Let's assume we have a pdf form with the required metadata already created. This could have been uploaded by the user from a different application.

That's doable as I've demoed. However, we might have a mismatch regarding permissions.

  • Users who will only read the document can use the view action.
  • Users who can edit the document are split:
    • The owner might want to edit the whole content, add some images, more forms, etc (edit action)
    • For others, you just need them to fill the form without touching anything else. (formsubmit action)

In the second case, we only have read/write or edit view mode (which is associated with the write/edit permission the user can have over the document). This is why I suggest to use the edit action only for the owner of the file (giving him full control) and use the formsubmit action for anyone else so they can only fill the form without changing anything else. This might need some changes in their workflow:

  1. user1 uploads/creates a pdf form
  2. user1 creates several copies (one per target user) and share one copy to each other user.
  3. user2 fills the shared form and saves it.
  4. user1 gets all the forms

That might work because each user will be able to access only to his own form. However there could be problems if the users make and send their own copies (which could have been edited) or if the users can edit forms directed to other people.

I think knowing and understanding how people will interact with this feature is very important in order to provide a successful implementation.

jvillafanez avatar Mar 28 '25 15:03 jvillafanez

The bug is fixed here: https://github.com/owncloud/ocis/pull/11165

Using the formsubmit action or any other improved mentioned in this ticket needs a feature request. Closing this here.

kobergj avatar May 13 '25 09:05 kobergj