ONLYOFFICE / DocumentServer

ONLYOFFICE Docs is a free collaborative online office suite comprising viewers and editors for texts, spreadsheets and presentations, forms and PDF, fully compatible with Office Open XML formats: .docx, .xlsx, .pptx and enabling collaborative editing in real time.
https://www.onlyoffice.com
GNU Affero General Public License v3.0
4.82k stars 1.08k forks source link

PDF figure is displayed incorrectly #874

Open szhorvat opened 4 years ago

szhorvat commented 4 years ago

Do you want to request a feature or report a bug?

A bug in the display of PDF figures in the word processor.

Here I include one example, but I encountered many cases of misrendered figures.

What is the current behavior?

Many PDF figures do not display correctly. PDFs can be inserted in a .docx file using MS Word for macOS.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.

I attached a .docx file which has a badly displayed PDF. Notice: the vertical frame label is missing and the grid lines are missing. I also attached the PDF on its own.

testfig.pdf

Test file.docx

Comparison screenshot of how the PDF is rendered by Mac Preview vs OnlyOffice:

image

This is a simple figure created with Wolfram Mathematica (a software popular for preparing scientific figures), using the code

SeedRandom[76768676]
fig = ListPlot[
  AssociationThread[
   RandomWord[3],
   RandomVariate[
    MultinormalDistribution[IdentityMatrix[2]], {3, 100}]
   ],
  Frame -> True,
  FrameLabel -> {"foo (\!\(\*SuperscriptBox[\(\[Mu]m\), \(2\)]\))", 
    "bar (\!\(\*SuperscriptBox[\(nm\), \(2\)]\))"},
  GridLines -> Automatic,
  ImageSize -> 400
  ]
Export["testfig.pdf", fig]

What is the expected behavior?

Figure should render the same as in a PDF reader, and as it renders in MS Word itself.

Did this work in previous versions of DocumentServer?

I do not know (new user).

DocumentServer version:

5.4.2 in the browser, 5.5.1 macOS desktop app.

Operating System:

macOS 10.14

Browser version:

Reproducible with:

Chrome Version 81.0.4044.138 Firefox version 77.0b4 (beta) macOS desktop app version 5.5.1

Rita-Bubnova commented 4 years ago

Hello, @szhorvat . I can confirm that the name of the vertical axis is not displayed - this is bug, issue 45372 in our internal issue tracker.

But in both MS Word and ONLYOFFICE there are no horizontal and vertical additional lines (see screenshot). Image1

Could you attach a DOCX file, which you open it in MS Word and all horizontal and vertical lines are displayed? How do you inserted PDF to DOCX file using MS Word?

szhorvat commented 4 years ago

I do see the grid lines in MS Word:

image

My MS Word version is "Microsoft Word for Mac 16.16.4 (181110)"

I inserted the figure by simply dragging the PDF file into the Word window.

It's possible that Word is just not reliable with PDFs. But then what vector format can one use when one is forced to use the DOCX format? Maybe I should experiment with SVG ... Here's the same in SVG format.

testfig.svg.zip

Rita-Bubnova commented 4 years ago

@szhorvat, so problem in render of EMF file, which is included in your DOCX file (you can extract it and see by yourself).

We did a little investigation and found out that some programs render those lines and some not. I opened the DOCX file in the LibreOffice 6.3.4.2 on the macOS there are no horizontal and vertical additional lines (see screenshot).

Screenshot LO macOS

But I can confirm that in MS Word 2016 on macOS these lines are displayed. For now we do not know that is correct for this EMF - to render lines or to not. So we need to figure out which behavior is right. I create new issue 45412 in our private issue tracker.

szhorvat commented 4 years ago

Thank you for the investigation. You made it clear that to me that regardless of whether OnlyOffice displays those grid lines or not, it is simply not safe to use this figure in a .docx document because the display is inconsistent across various software. I checked in Pages.app on macOS and it also does not display the grid lines. Even if you fix this in OnlyOffice, there will be problems with other software.

It would seem that the only reasonable solution is not to use PDF format figures.

Feel free to close this issue.

szhorvat commented 4 years ago

Do you happen to know if DOCX supports any vector format (other than EMF) natively? Or will everything get converted to EMF internally?

For now I gave up on vector formats and started using PNGs ...

Rita-Bubnova commented 4 years ago

Format DOCX allows you to work with the image format SVG. But ONLYOFFICE does not yet fully support the SVG format (opening only) - this is know issue 37564 in out private issue tracker.

notpushkin commented 1 year ago

@Rita-Bubnova sorry for bumping this – is there any progress on issue 37564? As I see, currently you can't add neither SVG nor EMF (using desktop version 7.0 (530) on Apple Silicon).

Rita-Bubnova commented 1 year ago

@notpushkin, Sorry, no news.