#1
Posted
:
Monday, February 18, 2019 8:16:30 AM(UTC)
Groups: Registered
Posts: 4
Hello,
I have used the below code for converting a image to pdf but after converting a 250kb file the converted pdf file is of 25mb. Is there any to reduce the size of it or compress it.
var codecs = new RasterCodecs();
var image = codecs.Load(@"C:\path\to\file");
codecs.Save(image, @"C:\path\to\outPutFile.pdf", RasterImageFormat.RasPdf, 0);
#2
Posted
:
Monday, February 18, 2019 3:01:26 PM(UTC)
Groups: Registered, Tech Support, Administrators
Posts: 199
Was thanked: 28 time(s) in 28 post(s)
Hello,
Since you're generating a raster PDF, the easiest way to reduce the file size is to enable the use of image compression. Currently you are saving to RasPdf, which is an uncompressed format. For a list of all compressions available to our raster PDF output, please refer to the following:
https://www.leadtools.com/help/leadtools/v20/dh/to/file-format-pdf.htmlIf you wanted to generate a searchable PDF, which will typically have a much smaller file size than a raster PDF due to storing vector information, you can use something like our DocumentConverter:
https://www.leadtools.com/help/leadtools/v20/dh/doxc/documentconverter.htmlPlease note, that if the original document isn't searchable (such as TIF or JPEG) conversion to a searchable PDF will require the use of OCR and may produce a different output than expected depending on the quality of the input. I'd recommend just using raster conversion (with compression enabled) as you've been doing if searching is not required as the content will be preserved.
If you want to take advantage of more advanced features of LEADTOOLS, such as OCR and image processing, while converting from multiple formats to PDF I'd recommend checking out this blog post:
https://www.leadtools.com/blog/document-imaging/convert-and-merge-to-pdf/The post includes example code that uses the LEADTOOLS Document Converter to merge multiple files into one text-searchable PDF file. It links to other posts that perform some more advanced image processing to clean up photos of documents.
Thanks,
Edited by user Monday, February 25, 2019 9:06:40 AM(UTC)
| Reason: Not specified
Anthony Northrup
Developer Support Engineer
LEAD Technologies, Inc.
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.