Skip to content
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

How to compress PDF files? #73

Open
KevenDev opened this issue Oct 19, 2024 · 2 comments
Open

How to compress PDF files? #73

KevenDev opened this issue Oct 19, 2024 · 2 comments

Comments

@KevenDev
Copy link

Describe your idea

How to compress PDF files?I’m using PDFLib to manipulate PDF files in my project, and I’m wondering if there’s any functionality within the library to reduce the file size of the PDFs. Specifically, I’m looking for ways to compress or optimize the PDFs (e.g., images, fonts, etc.) without compromising too much on quality

How could this be implemented?

To reduce the size of PDFs using PDFLib, you would typically focus on optimizing various elements within the PDF, such as images, fonts, and metadata. However, PDFLib does not natively provide a built-in function to compress or reduce the file size directly. But you can take some steps manually to optimize a PDF's structure.

What problem are you trying to solve?

I'm currently working on a project where I manipulate PDFs using PDFLib, but I'm encountering an issue with the size of the resulting PDF files. The generated PDFs tend to be larger than expected, even after removing metadata and disabling object streams. My goal is to reduce the file size, making it more efficient for storage and sharing.

Why does this matter to you?

This is important for me because reducing the size of PDFs directly impacts the performance and usability of the application I'm developing. Large PDFs can slow down loading times, increase storage costs, and make it difficult for users to share files, especially in environments with limited bandwidth. By optimizing PDF file sizes, I can provide a better user experience, improve efficiency, and reduce resource consumption. Having a built-in solution within PDFLib would streamline this process, avoiding the need for external tools or complex workarounds.

Would others find this helpful?

yes, exists open issues in Hopding/pdf-lib

Are you interested in implementing your proposal?

Yes

Why are you submitting a proposal?

I'm submitting this proposal because I believe that adding native support for PDF compression or optimization in PDFLib would be highly beneficial for developers who rely on the library for PDF generation and manipulation. Currently, file sizes can become an issue, especially when dealing with documents that include images or embedded fonts. A built-in feature for reducing PDF size would improve both performance and user experience, and would eliminate the need for integrating external libraries or applying manual workarounds.

Additional Notes

No response

@KevenDev
Copy link
Author

@Sharcoux

@Sharcoux
Copy link
Collaborator

I'm not sure we'll have time to handle this. If someone wants to propose a PR that would be awesome. We will review and merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants