PDF Editing with Odoo Integration

Hi,
Do you want to: Report a bug / Ask a how-to question

For bug reports, provide the steps to reproduce and if possible a minimal demo of the problem:

Bug 1: -

  1. Generate an Invoice with the sales module of Odoo.
  2. Open PDF with Onlyoffice docs.

  1. Click on the Edit PDF button.

  1. Click on the Edit text.

  1. Get the error: “An error occurred during the work with the document. Use the ‘Download as’ option to save the file backup copy to a drive.”

Error stack:

onlyoffice-documentserver  | [2024-10-10T14:50:03.850] [ERROR] [localhost] [46104e9787d7b824af00ae9d110802fade34474b2d1] [21] nodeJS - clientLog: changesError: Error: Uncaught TypeError: Cannot read properties of null (reading 're')
onlyoffice-documentserver  |  Script: http://172.19.0.7/8.1.3-4/sdkjs/word/sdk-all.js
onlyoffice-documentserver  |  Line: 2879:65
onlyoffice-documentserver  |  userAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36
onlyoffice-documentserver  |  platform: Linux x86_64
onlyoffice-documentserver  |  isLoadFullApi: true
onlyoffice-documentserver  |  isDocumentLoadComplete: true
onlyoffice-documentserver  |  DocumentInfo:
onlyoffice-documentserver  |  Selection: false
onlyoffice-documentserver  |  performance.memory: {"totalJSHeapSize":86469309,"usedJSHeapSize":82231401,"jsHeapSizeLimit":2172649472}
onlyoffice-documentserver  |  StackTrace: TypeError: Cannot read properties of null (reading 're')
onlyoffice-documentserver  |     at e.px (http://172.19.0.7/8.1.3-4/sdkjs/word/sdk-all.js:2879:65)
onlyoffice-documentserver  |     at a.<anonymous> (http://172.19.0.7/8.1.3-4/sdkjs/word/sdk-all.js:6720:247)
onlyoffice-documentserver  |     at Object.U [as ug] (http://172.19.0.7/8.1.3-4/sdkjs/word/sdk-all.js:1661:175)
onlyoffice-documentserver  |     at y.Wg (http://172.19.0.7/8.1.3-4/sdkjs/word/sdk-all.js:6720:36)
onlyoffice-documentserver  |     at a.tc (http://172.19.0.7/8.1.3-4/sdkjs/word/sdk-all.js:11993:311)
onlyoffice-documentserver  |     at a.oh (http://172.19.0.7/8.1.3-4/sdkjs/word/sdk-all.js:11984:452)
onlyoffice-documentserver  |     at http://172.19.0.7/8.1.3-4/sdkjs/word/sdk-all.js:11720:403
onlyoffice-documentserver  |     at Array.forEach (<anonymous>)
onlyoffice-documentserver  |     at e.mtd (http://172.19.0.7/8.1.3-4/sdkjs/word/sdk-all.js:11720:381)
onlyoffice-documentserver  |     at e.DDa (http://172.19.0.7/8.1.3-4/sdkjs/word/sdk-all.js:11698:402)

Got the same error using the Test Example provided by the document server, uploading the same PDF file.

Stack Error from the Test Example:

[2024-10-10T14:19:22.723] [ERROR] [localhost] [172.17.0.1INV_2024_testt.pdf1728568246067] [uid-15] nodeJS - clientLog: changesError: Error: TypeError: this.ja is null
 Script: http://localhost/8.1.3-4/sdkjs/word/sdk-all.js
 Line: 2879:57
 userAgent: Mozilla/5.0 (X11; Linux x86_64; rv:130.0) Gecko/20100101 Firefox/130.0
 platform: Linux x86_64
 isLoadFullApi: true
 isDocumentLoadComplete: true
 DocumentInfo:
 Selection: false
 StackTrace: e.prototype.px@http://localhost/8.1.3-4/sdkjs/word/sdk-all.js:2879:57
y.Wg/<@http://localhost/8.1.3-4/sdkjs/word/sdk-all.js:6720:247
U@http://localhost/8.1.3-4/sdkjs/word/sdk-all.js:1661:175
y.Wg@http://localhost/8.1.3-4/sdkjs/word/sdk-all.js:6720:36
a.prototype.tc@http://localhost/8.1.3-4/sdkjs/word/sdk-all.js:11993:311
a.prototype.oh@http://localhost/8.1.3-4/sdkjs/word/sdk-all.js:11984:452
e.prototype.mtd/<@http://localhost/8.1.3-4/sdkjs/word/sdk-all.js:11720:403
e.prototype.mtd@http://localhost/8.1.3-4/sdkjs/word/sdk-all.js:11720:381
e/this.DDa@http://localhost/8.1.3-4/sdkjs/word/sdk-all.js:11698:402
e/this.A6c@http://localhost/8.1.3-4/sdkjs/word/sdk-all.js:11650:50

Also tried generating a PDF file with onlyoffice and got the bug bellow.
Bug 2

  1. Generate a PDF document using a DOCX document using Onlyoffice Docs. (The DOCX was not uploaded to the Test Example. I’ve created it within the Text Example).

  2. Open the newly PDF created with OnlyOffice.

  3. Click on the “Edit PDF” button.

  4. Click on “Edit text” button.

  5. The document turn all blank.

Stack Error: None.

Document Server version: 8.1.3-4
Type of installation of the Document Server (docker, deb/rpm, exe, please point us to the installation guide that you used as well): Docker (Installation Guide: Running ONLYOFFICE Docs using Docker Compose - ONLYOFFICE)
Connector version: Downloaded from ONLYOFFICE | Odoo Apps Store
DMS (platform) version: Odoo 17
Browser version: Firefox and Google Chrome
Additional information:

I utilized the Docker Compose setup from the guide and also tested with a fresh Docker image from Docker Hub:

docker pull onlyoffice/documentserver:latest

Run command:

docker run -i -t -p 80:80 onlyoffice/documentserver:latest --network odoo-onlyoffice-network

I’m running both docker containers (from Odoo and OnlyOffice in a local environment.

I’ve also tested this in a fresh install of OnlyOffice and Odoo (The only modules installed are the Sales Module and the OnlyOffice Connector)

Hello @mrmikept

I wasn’t able to reproduce any of these issues - generating invoice, saving it to PDF to open with Document Server did not result in any errors, also creating DOCX, saving it as PDF and opening to edit did not give blank page.

Can you share those files for reference?

By the way, how do you save this sample DOCX into PDF - via Download As with further upload back to storage or directly via Save Copy As?

Hi @Constantine

That’s weird, did you use the same installation guides I provided? I made a fresh install for Onlyoffice as for Odoo. And I tried both running the image as using the docker compose provided.

The invoice example I used
INV_2024_testt.pdf (35.6 KB)

I saved directly via Save Copy As

Also, I get this on the firefox console:


I just tried again with a docker fresh install and I get the same problem.

Hi again,

I tried using a different laptop but encountered the same issue. I followed the installation steps as outlined in the guide I mentioned earlier (it’s just a simple git clone and compose up, so I’m not sure what could go wrong).

I also tried setting up a virtual machine with Ubuntu, but the problem persists.

The operating systems I’ve used are Fedora (from my initial post), Manjaro Gnome (on another machine), and Ubuntu (on the virtual machine).

This time I also tried with a completely random PDF and the blank page issue also persisted…

Do I need to do some additional setup for this to work?

Here is demo with opening of this file according to your scenario:

Am I doing something wrong?


I’m not quite sure where this problem comes from. However, in terms of test may I ask you to run Document Server per this guide instead of Compose?
https://helpcenter.onlyoffice.com/installation/docs-community-install-docker.aspx

By the way, did you use JWT in previous tests? From what I see, port 443 is not mounted so HTTPS hasn’t been enabled yet on either Odoo side or Document Server side.

I followed the same steps you did, but it didn’t work for me. I encountered the same error I mentioned in my initial post.

I attempted the following command:

sudo docker run -i -t -d -p 80:80 --restart=always -e JWT_SECRET=my_jwt_secret onlyoffice/documentserver

Unfortunately, it still didn’t work.

Regarding JWT, I see you asked if it was used in previous tests. In my Odoo integration setup, the JWT is required in the settings. However, I didn’t use JWT for other test scenarios, like with the test example server.

Also, I didn’t enable HTTPS for the Document Server because I’m running everything in a localhost environment. Could this be the cause of the issue?

This is less likely, as in my tests I was not using HTTPS too. I was just interested to know the environment of yours.

Can you reproduce the issue once again and share logs of Document Server? It’d be nice to enable debug level logging before test, for that you have to change production.json config in /etc/onlyoffice/documentserver/log4js/ by replacing WARN with DEBUG:

"level": "DEBUG"

Once changed, you need to restart Document Server services with supervisorctl restart all to apply this change. All these operations must be performed inside the container with Document Server.

Hello Constantine,

Attached are the logs generated from the document server. I copied the output from the Docker logs after running the supervisorctl restart all command:

document_server_logs.log (20.3 KB)

I’ve also included the out.log files for both the converter and docservice, located at /var/log/onlyoffice/documentserver:

converter_out.log (3.9 KB)

docservice_out.log (15.9 KB)

Thanks. Can you also provide step-by-step scenario on how did you create this invoice and export it?

Also, I’ve noted that it was the only file tested in integrated test example. Did you try editing any other PDF to see if the same behavior occurs? Also, please try reproducing the issue in Incognito mode.

Hello Constantine,

Yes I recorded a video as how I do it :slight_smile:

In the video I didn’t showed it, but I exported using the PDF Editor using File > Download As > PDF

I tested others, I also recorded a video showing me opening/creating different PDF files and editing them.

I just tried that and the problems persisted.

Also, can you please confirm which release are you using? And are you using the master branch from the github repository for the docker compose? (GitHub - ONLYOFFICE/Docker-DocumentServer: ONLYOFFICE Document Server is an online office suite comprising viewers and editors for texts, spreadsheets and presentations, fully compatible with Office Open XML formats: .docx, .xlsx, .pptx and enabling collaborative editing in real time.) or are you using another repository?

I’m using Document Server as per Docker installation guide that relies on official repository. I’m not using Docker Compose.

We have just released new version 8.2 of Document Server. Please update your instance and see if the same issue occurs.

Hi Constantine :blush:,

Before the new release, I tested several documents and discovered that bug 1 (mentioned in my first post) occurs only when the page you’re editing contains both text and an image, but in every other scenarios, bug 2 appears.

I created a small document with two pages: one with just text and the other with both text and an image, as shown in the video below:

The image was copied and pasted, but I also tried uploading it from storage and selecting a file from my computer.

I did that, but when opening a PDF in edit mode, the “Edit Text” button is missing, as shown below:

Was it removed or moved elsewhere? It wasn’t mentioned in the changelog for version 8.2.

I followed the Docker Installation Guide to set up a new instance for version 8.2.

So you are not using any other branch than the master from github?

Hello,

I tested the document server from the trial version of the developer edition, and it works just fine.
The edit PDF feature isn’t available in the community edition?

I will investigate that matter a bit more precisely and let you know.

I also encountered the same situation

Hello @mrmikept, @letgooo

I was informed that there is technical limitation that has been causing the issue with editor crash in the previous version and in the current version possibility to edit text was disabled for further investigation.

I will keep you posted on this case.