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, August 14, 2017 12:44:48 PM(UTC)
Viral Patel

Groups: Registered
Posts: 3


Hello,

I have a requirement of converting the image files like jpg, jpeg, png bmp etc.. to a single pdf file. Will i be able to use Lead tools for same? If yes can you please guide me to some examples?

Thanks!
 

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 : Tuesday, August 15, 2017 2:57:01 PM(UTC)
Duncan Quirk

Groups: Registered, Tech Support, Administrators
Posts: 70

Was thanked: 4 time(s) in 4 post(s)

Hello,

Thank you for posting your question on the LEADTOOLS Technical Forums.

Yes, using LEADTOOLS you can convert from the formats that you mentioned to PDF. A full list of the file formats that LEADTOOLS supports can be found here: https://www.leadtools.com/sdk/formats

If you have not yet downloaded the evaluation version of LEADTOOLS, it can be downloaded from here: https://www.leadtools.com/downloads
The evaluation will unlock all functionality of the SDK for sixty days. Included in the download are sample projects that you can use as a reference.
Specifically, I would recommend that you look at the Main Demo, which can be found in the following installation directory:
C:\LEADTOOLS 19\Examples\DotNet\CS\MainDemo

Converting from one file format to another can be done with as little as three lines of code. For example, this code snippet will allow you to convert an input file to PDF in C#
Code:

            var codecs = new RasterCodecs();
            var image = codecs.Load(@"C:\path\to\file");
            codecs.Save(image, @"C:\path\to\outPutFile.pdf", RasterImageFormat.RasPdf, 0);


Our documentation about the RasterCodecs class can be found here: https://www.leadtools.co.../dh/co/rastercodecs.html

Thanks,
Duncan Quirk
Developer Support Engineer
LEAD Technologies, Inc.

LEAD Logo
 
#3 Posted : Tuesday, August 15, 2017 3:23:39 PM(UTC)
Viral Patel

Groups: Registered
Posts: 3


Hello,

I am using this code and i get Error as "CMP Codec is needed to use this feature"

RasterCodecs codecs = new RasterCodecs();
var stopWatch = new Stopwatch();
stopWatch.Start();
RasterImage image = codecs.Load(@"C:\Viral\.NET Projects\Code\MergePDFDocument\MergePDFDocument\MergePDFDocument\bin\Debug\PDF_Documents\T05_JB70722.jpg");
codecs.Save(image, @"C:\Viral\.NET Projects\Code\MergePDFDocument\MergePDFDocument\MergePDFDocument\bin\Debug\OutputFiles\LeadoutPutFile.pdf", RasterImageFormat.RasPdf, 0);
stopWatch.Stop();
MessageBox.Show("Successfully Merged,TimeTaken :" + stopWatch.Elapsed.Milliseconds.ToString() + " seconds");

I have referenced these 3 dlls is there any other dll that i might need to reference?

using Leadtools;
using Leadtools.Codecs;
using Leadtools.Codecs.Cmp;

Also Will i be able to load multiple images at one time, lets say an array of images and then convert same to pdf?

Thanks for your help!
 
#4 Posted : Tuesday, August 15, 2017 3:38:25 PM(UTC)
Duncan Quirk

Groups: Registered, Tech Support, Administrators
Posts: 70

Was thanked: 4 time(s) in 4 post(s)

Hello,

The error you are getting indicates that you are missing one or more codecs filter. Information about what codecs filters are needed for what file format can be referenced in our documentation here: https://www.leadtools.co...n.html#fileformatsupport

For instance, if you are writing to RasPdf, you will need the following DLLs referenced:
Leadtools.Pdf.dll*
Leadtools.ColorConversion.dll
Leadtools.Codecs.Fax.dll

You can also set the build path for your project to the LEADTOOLS bin directory you are referencing the DLLs from. This will allow the codecs to automatically pull in what codecs filters are needed without having to reference each one. I would suggest that you try this and see if you are able to convert the file.
Duncan Quirk
Developer Support Engineer
LEAD Technologies, Inc.

LEAD Logo
 
#5 Posted : Tuesday, August 15, 2017 3:55:02 PM(UTC)
Viral Patel

Groups: Registered
Posts: 3


Hello,

Thanks for your prompt reply. I added the references you mentioned and still i get the same issue. ""CMP Codec is needed to use this feature"

I am using all this references:

using Leadtools;
using Leadtools.Pdf;
using Leadtools.Codecs;
using Leadtools.Codecs.Cmp;
using Leadtools.ColorConversion;
using Leadtools.Codecs.Fax;

Error seems on the line RasterImage image = codecs.Load(@"C:\Viral\.NET Projects\Code\MergePDFDocument\MergePDFDocument\MergePDFDocument\bin\Debug\PDF_Documents\T05_JB70722.jpg");

Thanks!

 
#6 Posted : Wednesday, August 16, 2017 12:39:16 PM(UTC)
Duncan Quirk

Groups: Registered, Tech Support, Administrators
Posts: 70

Was thanked: 4 time(s) in 4 post(s)

Hello,

Have you tried setting the build path for your project to the LEADTOOLS bin directory that you are referencing the dlls from? Setting this path will allow the codecs to automatically pull in the filters it needs. If after do this you project is able to run without issue, then that would indicate that there is an additional DLL that needs to be referenced.

Also, make sure that you are setting your license in your application. This can be done in C# as follows:
RasterSupport.SetLicense(@"C:\LEADTOOLS 19\Common\License\LEADTOOLS.LIC", System.IO.File.ReadAllText(@"C:\LEADTOOLS 19\Common\License\LEADTOOLS.LIC.KEY"));

Thanks,
Duncan Quirk
Developer Support Engineer
LEAD Technologies, Inc.

LEAD Logo
 
#7 Posted : Monday, February 18, 2019 7:23:32 AM(UTC)
PradeepDone

Groups: Registered
Posts: 4


var codecs = new RasterCodecs();
var image = codecs.Load(@"C:\path\to\file");
codecs.Save(image, @"C:\path\to\outPutFile.pdf", RasterImageFormat.RasPdf, 0);

After using the above code if i convert the 250kb image file the converted pdf file is of 25mb. Is there any way i can compress or reduce the size.
 
#8 Posted : Monday, February 18, 2019 8:54:41 AM(UTC)

Hadi  
Hadi

Groups: Manager, Tech Support, Administrators
Posts: 218

Was thanked: 12 time(s) in 12 post(s)

When you choose RasterImageFormat.RasPdf, that is uncompressed raster PDF. Depending on the input file, I would suggest using RasJpeg411 (for color images) or RasPdfG4 (for 1 BPP):

https://www.leadtools.co.../to/file-format-pdf.html

pdf compressions
Hadi Chami
Developer Support Manager
LEAD Technologies, Inc.

LEAD Logo
 
#9 Posted : Friday, February 22, 2019 5:06:40 PM(UTC)
BonzoFestoon

Groups: Administrators
Posts: 27

Was thanked: 1 time(s) in 1 post(s)

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, check out this blog post:

Convert and Merge Files into a 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.
Gabriel Smith
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.132 seconds.