We are trying to convert PDF’s to TIff’s, that part is working without any problems. The problem we’re having is when we apply LZW compression the Tiff’s stay the same size. My expectation would be that the files should reduce in size. Below is a selection of our C#:
Document pdfDocument = new Document(pdfPath);
// Create Resolution object
Resolution resolution = new Resolution(dpi);
// Create TiffSettings object
TiffSettings tiffSettings = new TiffSettings();
//tiffSettings.Compression = CompressionType.LZW;
tiffSettings.Depth = ColorDepth.Default;
tiffSettings.Shape = ShapeType.None;
tiffSettings.SkipBlankPages = false;
//tiffSettings.Brightness = 0.5f;
// Create TIFF device
TiffDevice tiffDevice = new TiffDevice(resolution, tiffSettings);
// Convert a particular page and save the image to stream
Kindly send us your source PDF document. We will investigate and share our findings with you.
Would it be possible to get an example of the recommended code in C#? I’m not allowed to upload a PDF for security reasons.
Just to be clear this is a problem with any PDF we try.
Kindly let us know the resolution value which you are using. With the low resolution, we can decrease the size of a final TIFF image and we need to know about the acceptable resolution range.
When you say the value, are you saying there is a setting for the amount of compression?
We are asking for the value stored in the dpi variable. The resolution of image defines the number of pixels.
We set up the DPI to be 200 for this. The file size of the TIff’s does change when we change the DPI but not when we add or remove the LZW compression.
We managed to replicate the problem of same file size with or without LZW compression. We have logged an investigation under the ticket ID PDFNET-43830 in our issue tracking system. We have linked your post to this ticket and will keep you informed regarding any available updates.
Any update on this request please?
The linked ticket ID PDFNET-43830 is pending for the analysis and not resolved yet. Our product team will investigate as per their development schedules. We will let you know once a significant progress has been made in this regard.
Thanks for your patience.
Please note that the LZW compression type is default value. So in case of omitting the compression property LWS will still be used. Therefore, you have to change compression explicitly in order to change output document size.