-
-
Notifications
You must be signed in to change notification settings - Fork 452
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reduce the file size after embedding a CJKV watermark with a custom font. #724
Comments
Reusing embedded user fonts is missing during stamping/watermarking. |
With the latest commit you can enforce that the stamp/watermark command will NOT embed your user font. On the CLI you can now set You can do: Any user font name with the suffix GB2312 will be recognized using script HANA and therefore not embedded, As far as 2) KaiTi_GB2312.ttf supports latin numbers, so that's a non issue. Reusing a userfont for stamping/watermarking remains open. |
Thank you very much for this great project, which was very helpful.
The problem I am encountering now is that after adding a Chinese watermark with a custom font(KaiTi_GB2312), the file size has increased significantly. On the contrary, when using Adobe Acrobat to add watermarks with the same settings, the file size did not increase much.
Files as attached.
KaiTi_GB2312.zip : The Font File, size: 3.94MB
sample.pdf : The original PDF document, size: 62.3KB
sample-adobe-1.pdf : Using Acrobat add 1 mark , size: 66.8KB
sample-adobe-3.pdf : Using Acrobat add 3 marks, size: 68.7KB
pdfcpu font install .\KaiTi_GB2312.ttf
pdfcpu watermark add -m text -- "测试中文字体水印增加的文件大小\n2023-10-16" "font: KaiTi_GB2312, points: 36, scale: 1 abs, color: #ff0000, op: 0.3, ro: 30" .\sample.pdf .\sample_cpu.pdf
sample_cpu.pdf, size: 1.11MB
.\pdfcpu.exe watermark add -m text -- "测试中文字体水印增加的文件大小\n2023-10-16" "font: KaiTi_GB2312, points: 36, scale: 1 abs, color: #ff0000, op: 0.3, ro: 30, offset: 0 220" .\sample_cpu.pdf .\sample_cpu2.pdf
sample_cpu2.pdf, size: 2.16MB
.\pdfcpu.exe watermark add -m text -- "测试中文字体水印增加的文件大小\n2023-10-16" "font: KaiTi_GB2312, points: 36, scale: 1 abs, color: #ff0000, op: 0.3, ro: 30, offset: 0 -220" .\sample_cpu2.pdf .\sample_cpu3.pdf
sample_cpu3.pdf, size: 3.22MB
From [Font] tab in [document property] with Adobe Acrobat, could find out file [-adobe-3.pdf] has only one KaiTi_GB2312 items and no [subset embedded] sign, and file [_cpu3.pdf] have three KaiTi_GB2312 items and has [subset embedded] sign on each one.
Suggestion
Thank you very much!
Document properties of sample-adobe-3.pdf, not embedded, size is small
Document properties of sample_cpu3.pdf, embedded 3 times, size increased significantly
The text was updated successfully, but these errors were encountered: