Bug 469829 - PDF file size increases exponentially after typing in text using the Typewriter tool and Highlighter
Summary: PDF file size increases exponentially after typing in text using the Typewrit...
Status: RESOLVED UPSTREAM
Alias: None
Product: okular
Classification: Applications
Component: PDF backend (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-05-16 01:51 UTC by echua.ac
Modified: 2023-06-28 15:03 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description echua.ac 2023-05-16 01:51:10 UTC
SUMMARY
***
NOTE: If you are reporting a crash, please try to attach a backtrace with debug symbols.
See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***
When I type in text into a PDF file using Okular, or highlight text, the file size goes up exponentially. A 800kB file will go up to 9MB with just one Typewriter note. At its worst, I have had a small 3 page file go up to 91 MB after I typed in notes and highlighted text.
The problem is so bad that I have looked for alternative PDF readers to use, and am about to delete Okular from my system.
I am not a programmer so I have no idea what you need me to report here or what "component" I'm supposed to be reporting, only that Okular has become unusable for me.

STEPS TO REPRODUCE
1. Typing in text using Typewriter tool or highlighting text using Highlighter
2. File size increases exponentially
3. 

OBSERVED RESULT


EXPECTED RESULT


SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
Comment 1 alstjr7375 2023-06-10 06:50:45 UTC
 I use okular 23.04.1 version in Endeavour OS and have the same symptoms.
Comment 2 Sune Vuorela 2023-06-12 06:30:14 UTC
What versions of poppler is involved. There had been some bugs, but fixed by 23.06 version of poppler that make it grow extremely much (By wrongly embedding the same fonts over and over again).
Comment 3 alstjr7375 2023-06-12 12:43:56 UTC
To be a little more specific, I'm using version 23.04.2 and even putting a little text in a 3kb file increases it significantly to 15.7mb, like this.
- Original: https://www.africau.edu/images/default/sample.pdf
- Large File: https://drive.google.com/file/d/1zJg2fm5N5SgKJbNEjuMbMMJEPkskHd5h/view?usp=sharing

If you need to reproduce it, is there anything I can do to help?
Comment 4 Sune Vuorela 2023-06-12 13:45:23 UTC
Poppler is the underlying library that Okular uses for rendering pdf's and for writing annotations into pdf's.

What version  of poppler are you using ? 

The version `alstjr7375` is using has a bug that was fixed recently where the same font gets embedded multiple times. In your "large file" example, the same font is embedded 6 times; a bug that was fixed probably in poppler 23.06. So please update to a newer poppler.
Comment 5 alstjr7375 2023-06-12 14:01:58 UTC
Thanks for the quick reply. I checked the package and `poppler` hasn't been updated yet.
(I thought the `poppler` library was described as pop-up note, a function of okular)
```
poppler 23.05.0-1
poppler-data 0.4.12-1
poppler-glib 23.05.0-1
poppler-qt5 23.05.0-1
```

Then, I'll wait for an update on Arch Linux!!!
https://archlinux.org/packages/extra/x86_64/poppler/
Comment 6 alstjr7375 2023-06-16 05:29:54 UTC
Thank you!! It seems that the font is only embedded once. (Keep in 2MB)
I think it has been solved now.

After the update, the package version is as follows:
```
poppler 23.06.0-1
poppler-data 0.4.12-1
poppler-glib 23.06.0-1
poppler-qt5 23.06.0-1
```
Comment 7 Sune Vuorela 2023-06-16 06:41:25 UTC
thanks for confirming. Marking as fixed upstream (Poppler)
Comment 8 orionbelt2 2023-06-28 15:03:20 UTC
Thanks for the response.

Can you recommend a way to get rid of these superfluous embedded fonts from PDF files that were already affected by this bug?

I made dozens of time-consuming annotations to a PDF file, saving it dozens of times in between, before i realized (because okular became very unresponsive!) that the file size had grown from 6.4 MB to... 220 MB (!). It would be very time-consuming to redo all annotations with the fixed poppler version... but it is also be very unpleasant having to deal with such a huge file! Thanks.