Posts

Showing posts with the label PdfSharpCore

Donate

Insufficient Data For An Image Error - Printing PDF Books Using ImageSharp And PdfSharpCore In C#

Image
Hello and Good Day! As we continue to optimize our catalog software specifically printing of pdf books module, some of our catalogs were printed smoothly and other were not which specifically throws an Insufficient Data For An Image error when opening those books. I tried different solutions in .NET but none of them seem to resolve the problem. After investigating the images, we discovered that these photos which happens to be the templates for our books, were created using different types of graphics and CAD software. What we did was to open these images in Adobe Photoshop and save those files so that these photos program property is consistent. Since the error still persists, the next step I did was to change the image property in Photoshop specifically the Color Representation that has a value of Uncalibrated. In Photoshop, Uncalibrated is equivalent to Grayscale. Changing the image's Grayscale/Uncalibrated to RGB Color in Photoshop solved the Insufficient Data For A

PdfSharpCore And ImageSharp - Memory Keeps Increasing Or Memory Leak When Adding Hundreds Of Images To Create PDF Book

Image
Good day everyone! We are currently upgrading our WPF Cataloging application that has a feature to generate pdf books with multiple pages on the fly and each book may contain thirty or more images and may reach even a hundred from .NET Framework to .NET 7. Upon printing of a book,we discovered that it consume lots of memory even reaching to 5GB per book. Because our logic in generating a catalog involves adding texts and loading several images in memory and then print those details on a single pdf file, it may have caused to memory usage to skyrocket at a tremendous result. The code below shows how we load images using PdfSharpCore and ImageSharp. private ImageSource.IImageSource GetImageFromList<TPixel>( string key, string which, string name) where TPixel : unmanaged, IPixel<TPixel> { ImageSource.IImageSource rtn; int width; int height; width = 0; height = 0; if (ImageList.ContainsKey(key)) { rtn = ImageList[key]; } else { if (Ima

Donate