Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Monday, February 18, 2019 8:16:30 AM(UTC)
PradeepDone

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);
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Monday, February 18, 2019 3:01:26 PM(UTC)
Anthony Northrup

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.html

If 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.html

Please 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.

LEAD Logo
 
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.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.082 seconds.