From fcf1f0457eaa431bd807d26a3b5c988f055cd927 Mon Sep 17 00:00:00 2001 From: kellem negasi Date: Mon, 31 Jul 2023 11:19:02 +0300 Subject: [PATCH] updated README content and unipdf version --- compress/README.md | 3 +++ compress/pdf_optimize.go | 1 + compress/pdf_remove_unused_resources.go | 1 + go.mod | 2 +- go.sum | 4 ++-- 5 files changed, 8 insertions(+), 3 deletions(-) diff --git a/compress/README.md b/compress/README.md index e085d185..6f428612 100644 --- a/compress/README.md +++ b/compress/README.md @@ -14,11 +14,14 @@ type Options struct { CleanFonts bool SubsetFonts bool CleanContentstream bool + CleanUnusedResources bool } ``` +From the available filters `CleanFonts`, `CleanUnusedResources`, `CombineDuplicateStreams`, `CombineDuplicateDirectObjects`,`CombineDuplicateDirectObjects`, `CleanFonts` and `CompressStreams` enable lossless compressions. ## Examples - [pdf_optimize.go](pdf_optimize.go) compresses a PDF file with some typical options. - [pdf_font_subsetting.go](pdf_font_subsetting.go) illustrates how to reduce a PDF file size by subsetting all fonts used in the document using `SubsetFonts` Optimizer option. +- [pdf_remove_unused_resources.go](pdf_remove_unused_resources.go) reduces file size by removing unused resources such as Images, Xforms, fonts and external graphics state dictionaries. diff --git a/compress/pdf_optimize.go b/compress/pdf_optimize.go index 7eafb2fc..0eb47e9b 100644 --- a/compress/pdf_optimize.go +++ b/compress/pdf_optimize.go @@ -71,6 +71,7 @@ func main() { UseObjectStreams: true, ImageQuality: 80, ImageUpperPPI: 100, + CleanUnusedResources: true, })) // Create output file. diff --git a/compress/pdf_remove_unused_resources.go b/compress/pdf_remove_unused_resources.go index 91ce175a..80a10d07 100644 --- a/compress/pdf_remove_unused_resources.go +++ b/compress/pdf_remove_unused_resources.go @@ -1,5 +1,6 @@ /* * This example shows how to use remove unused resources optimization example. + * The compression accomplished using this filter is lossless. * * Run as: go run pdf_remove_unused_resources.go */ diff --git a/go.mod b/go.mod index 1c2cfc35..f271061a 100644 --- a/go.mod +++ b/go.mod @@ -16,7 +16,7 @@ require ( github.com/unidoc/globalsign-dss v0.0.0-20220330092912-b69d85b63736 github.com/unidoc/pkcs7 v0.1.1-0.20220329190817-dd59b9eba14c github.com/unidoc/unichart v0.1.0 - github.com/unidoc/unipdf/v3 v3.46.0 + github.com/unidoc/unipdf/v3 v3.48.0 github.com/wcharczuk/go-chart/v2 v2.1.0 go.opencensus.io v0.24.0 // indirect golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa diff --git a/go.sum b/go.sum index 98e05e75..aaf41918 100644 --- a/go.sum +++ b/go.sum @@ -403,8 +403,8 @@ github.com/unidoc/timestamp v0.0.0-20200412005513-91597fd3793a h1:RLtvUhe4DsUDl6 github.com/unidoc/timestamp v0.0.0-20200412005513-91597fd3793a/go.mod h1:j+qMWZVpZFTvDey3zxUkSgPJZEX33tDgU/QIA0IzCUw= github.com/unidoc/unichart v0.1.0 h1:GoJ/rxSoOYZsqlG3yOJpKkwgfsIQgb9hHX7bILZHcCg= github.com/unidoc/unichart v0.1.0/go.mod h1:9sJXeqxIIsU2D07tmhpDMoND0mBFRGfKBJnXZMsJnzk= -github.com/unidoc/unipdf/v3 v3.46.0 h1:FjYaPgHPt2Guk7KeRsFnxbR9Ftp0qZsVaif0+lu8/f0= -github.com/unidoc/unipdf/v3 v3.46.0/go.mod h1:g42g9gaGCT2hLoNK+r/RZdNVnvhF1X6qx6wpTKJwg2E= +github.com/unidoc/unipdf/v3 v3.48.0 h1:aI/7HAvZApdpT5zJ7GlCbaNwrqhM9R1oRbNQOVrjsYI= +github.com/unidoc/unipdf/v3 v3.48.0/go.mod h1:g42g9gaGCT2hLoNK+r/RZdNVnvhF1X6qx6wpTKJwg2E= github.com/unidoc/unitype v0.2.1 h1:x0jMn7pB/tNrjEVjy3Ukpxo++HOBQaTCXcTYFA6BH3w= github.com/unidoc/unitype v0.2.1/go.mod h1:mafyug7zYmDOusqa7G0dJV45qp4b6TDAN+pHN7ZUIBU= github.com/wcharczuk/go-chart/v2 v2.1.0 h1:tY2slqVQ6bN+yHSnDYwZebLQFkphK4WNrVwnt7CJZ2I=