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.92k stars 1.1k forks source link

PDF generated by OnlyOffice is extremely large when third-party CJK fonts are used #2934

Open mon-jai opened 1 month ago

mon-jai commented 1 month ago

PDFs generated by OnlyOffice are extremely large when third-party CJK fonts are used.

Please see the following demo document containing two lines of Chinese text: Demo Document.docx

The PDF generated by OnlyOffice is a massive 13MB: Demo Document.pdf

However, the same PDF is only 15.25KB when opened in LibreOffice Draw and re-exported: Demo Document - Libreoffice.pdf

The font used in the file is Source Han Sans TC v2.004 (https://github.com/adobe-fonts/source-han-sans/releases/download/2.004R/SourceHanSansHWTC.zip).

TatianaKirillova commented 1 month ago

Hello @mon-jai Thank you for contacting us! This issue has already been discussed in the post #2739

mon-jai commented 1 month ago

@TatianaKirillova @Rita-Bubnova It doesn't seem like a duplication.

In my demo document, there are no form fields—just two lines of text. Yet, the entire font is included.

TatianaKirillova commented 1 month ago

@mon-jai Yes, but you can always add them - at any time. Therefore, we are forced to save the font. If you do not plan to add form fields, then you can simply save docx->pdf

mon-jai commented 1 month ago

@TatianaKirillova

Yes, but you can always add them - at any time.

I found a PDF without form fields to be more like a non-editable format. In most cases, no one will attempt to edit it.

If you do not plan to add form fields, then you can simply save docx->pdf

Yeah, I just did that (either by "Save As" or "Print as PDF"), and in both cases, the resulting PDF is 13MB.

There is no known way to export a smaller PDF in OnlyOffice with only the used glyphs embedded (that's the whole point).

TatianaKirillova commented 1 month ago

@mon-jai I save your document in pdf format in the ONLYOFFICE editor and it weighs 49 KB Demo.Document (1).pdf

mon-jai commented 1 month ago

The font used in the file is Source Han Sans TC v2.004 (https://github.com/adobe-fonts/source-han-sans/releases/download/2.004R/SourceHanSansHWTC.zip).

@TatianaKirillova Can you try again with Source Han Sans TC v2.004 installed?

This issue only occurs with third-party CJK fonts. Since you don’t have that font installed, OnlyOffice falls back to the system font, which may not be embedded in the generated PDF.

TatianaKirillova commented 1 month ago

@mon-jai Yes, you're right. We try to save the file with text, not pictures (like other editors), which results in increased weight. I created a proposal # 71235 so that it would be possible to choose in which format to save the file - lighter weight or it is important that it be saved as text.

mon-jai commented 1 month ago

@TatianaKirillova Thank you! Could you reopen the issue?

Also, what happens if a user chooses the "lighter weight" option once it’s implemented? Will the font be subsetted?