Aspose Imaging Evaluation Text/Large PNG file after conversion

Hi,

When I try to use Aspose to convert a pdf to a png, the file size is about 4-5x the size of the pdf, so I attempted to use the Aspose Imaging class to do a compression with PngOptions to make the file size smaller. However, the new image that is created has this text in the top left corner, “Evaluation Only. Created with Aspose.Imaging. Copyright, etc.”. I have an Aspose.Pdf license, so I assume this would be included in our package.

  1. Is there a more efficient way to use the compression when creating the png file initially?
  2. if not, how do i get this text to go away?

My code is below, mostly taken from the Aspose documentation.

using (var msSource = new MemoryStream(bytes))
using (var pdf = new Aspose.Pdf.Document(msSource))
{
var outputPath = filePath; // some file path

            // Create JPEG device with specified attributes
            // Width, Height, Resolution, Quality
            // Quality [0-100], 100 is Maximum
            // Create Resolution object
            var resolution = new Resolution(300);
            var pngDevice = new PngDevice(resolution);

            for (var pageCount = 1; pageCount <= pdf.Pages.Count; pageCount++)
            {
                var fileName = $"image_{idType}_{id}_{pageCount}.png";
                var filePath = Path.Combine(outputPath, fileName);
                
                using (var fileStream = new FileStream(filePath, FileMode.Create))
                {
                    pngDevice.Process(pdf.Pages[pageCount], fileStream);
                }

                var compressedName = $"image_{idType}_{id}_{pageCount}_compressed.png";
                var compressionPath = Path.Combine(outputPath, compressedName);

                using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(filePath))
                {
                    image.Save(compressionPath, new PngOptions { CompressionLevel = 9 });
                }
            }

@changus

Thanks for contacting support.

You got Evaluation mark on the output, generated by Aspose.Imaging, was because you were applying the license for Aspose.Pdf only. In order to get Evaluation mark go away, you need to apply Aspose.Imaging license as well.

Furthermore, please share your sample input document from which you are generating PNG image, so that we can test the scenario in our environment and address it accordingly.


Best Regards,
Asad Ali

@changus,

You can compress existing images inside the PDF file using OptimizeResources() method of Document class available under Aspose.Pdf namespace. Please refer to this help topic: Optimize PDF File Size. You may also send us your source PDF document. We will investigate and share our findings with you.

Please note, you need to apply license for each Aspose library by adding a couple of lines of code. Each Aspose library has a License class and you need to call its SetLicense method, so please call the SetLicense method of the Aspose.Imaging library and give the path of your same Aspose license. If the Aspose license is valid for Aspose.Imaging API, then it will work fine. Otherwise, you can get a temporary license for 30 days from the purchase portal: Get the temporary license

Best Regards,
Imran Rafique