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 : Wednesday, June 18, 2008 11:58:57 PM(UTC)

pvatkar  
pvatkar

Groups: Registered
Posts: 4


The code use for conversion is --

RasterSupport.Unlock(RasterSupportType.PdfRead, leadToolsKey);
   RasterCodecs.Startup();
   RasterCodecs codecs = new RasterCodecs();
   try
   {
    //RasterImage srcImage = codecs.Load(sourceFileName, 200, 300, 1 /* 1bit/pixel */, RasterSizeFlags.None, CodecsLoadByteOrder.BgrOrGray, 1, -1);
    codecs.Options.Pdf.Load.XResolution = 200;
    codecs.Options.Pdf.Load.YResolution = 300;
    codecs.Options.Load.Compressed = true;    
    RasterImage srcImage = codecs.Load(sourceFileName);    
    //codecs.Options.Save.OptimizedPalette = true;
    codecs.Save(srcImage, destinationFileName, RasterImageFormat.TifxFaxG4, 1, 1, -1, 1, CodecsSavePageMode.Overwrite);
    //codecs.Save(srcImage, destinationFileName, RasterImageFormat.Tif, 1, 1, -1, 1, CodecsSavePageMode.Overwrite);
    return true;
   }
   catch (Exception ex)
   {
    
    return false;
   }
   finally
   {
    codecs.Dispose();
    RasterCodecs.Shutdown();
   }

Then also the image quality is not proper. Please guide me.

 

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 : Thursday, June 19, 2008 6:30:08 AM(UTC)

Adam Boulad  
Guest

Groups: Guests
Posts: 3,022

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

I checked your code and it seems to be correct, can you please send me the source image and the image save by our toolkits and attach them here in a ZIP or RAR file.
When you attach files here do not use the 'Preview' feature.

 
#3 Posted : Thursday, June 19, 2008 6:44:29 AM(UTC)

pvatkar  
pvatkar

Groups: Registered
Posts: 4


Hi,

Please find attached PDF document along with the output.

 

Regards,

Prashant Vatkar

 

File Attachment(s):
ISMS.zip (219kb) downloaded 33 time(s).
 
#4 Posted : Thursday, June 19, 2008 6:58:28 AM(UTC)

pvatkar  
pvatkar

Groups: Registered
Posts: 4


Hi,

We are planning to change the code to -

RasterSupport.Unlock(RasterSupportType.PdfRead, leadToolsKey);

RasterCodecs.Startup();

RasterCodecs codecs = new RasterCodecs();

try

{

codecs.ThrowExceptionsOnInvalidImages = true;

//codecs.Options.Load.Compressed = true;

CodecsImageInfo info = codecs.GetInformation(sourceFileName, true);

int pageCount = info.TotalPages;

for (int i = 1; info.TotalPages >= i; i++)

{

RasterImage image = codecs.Load(sourceFileName, info.Width, info.Height, 0, RasterSizeFlags.FavorBlack, CodecsLoadByteOrder.Bgr, i, i);

codecs.Save(image, destinationFileName, RasterImageFormat.Tif, 1, 1, -1, i, CodecsSavePageMode.Append);

}

return true;

}

catch (Exception ex)

{

//BPOpenBaseException bpEx = new BPOpenBaseException(ex.Message, ex);

//ExceptionManager.Publish(ServiceName, ServiceInstance, bpEx);

return false;

}

finally

{

codecs.Dispose();

RasterCodecs.Shutdown();

}

 

But we are getting the error at "RasterImage image = codecs.Load(sourceFileName, info.Width, info.Height, 0, RasterSizeFlags.FavorBlack, CodecsLoadByteOrder.Bgr, i, i);" as Invalid parameter passed.

Your help would appreciated.And does this change is better than the previous one.

Regards,

Prashant Vatkar

 
#5 Posted : Sunday, June 22, 2008 6:12:48 AM(UTC)

Adam Boulad  
Guest

Groups: Guests
Posts: 3,022

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

Prashant,
The RasterSizeFlags.FavorBlack is only supported in Document/Medical only, so you will need to unlock Document/Medical features to use it.
Also this flag affects only 1-bit, black-and-white images and you are loading the file using the default BitsPerPixel. If you apply this flag to an image that has more than 1 bit per pixel, then the behavior is undefined and will give you an error message. If you try other flags, does it work with you?

 
#6 Posted : Monday, June 23, 2008 3:57:54 AM(UTC)

pvatkar  
pvatkar

Groups: Registered
Posts: 4


Hi,

Thanks for the reply and the code is finalized.

But we are still having issue with the quality of conversation of PDF document to TIFF. So it we are again and again changing the resolution. The quality has improved but it has increase the size. And secondly the viewer which we are using it is not viewing it properly due to the higher resolution. Please suggest us to have quality output with lesser size and proper resolution.

RasterSupport.Unlock(RasterSupportType.PdfRead, leadToolsKey);
RasterCodecs.Startup();
RasterCodecs codecs = new RasterCodecs();
try
{
codecs.ThrowExceptionsOnInvalidImages = true;
codecs.Options.Pdf.Load.XResolution = 600;
codecs.Options.Pdf.Load.YResolution = 600;
RasterImage image = codecs.Load(sourceFileName, 1, CodecsLoadByteOrder.Bgr, 1, -1);
codecs.Save(image, destinationFileName, RasterImageFormat.CcittGroup4, 1, 1, -1, 1, CodecsSavePageMode.Overwrite);    
return true;
}
catch (Exception ex)
{
 return false;
}
finally
{
codecs.Dispose();
RasterCodecs.Shutdown();
}

 
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.114 seconds.