PDF to Tiif conversion with CCITT compression

Hi,

I am trying to convert a pdf to tiff and it needs to be CCITT compressed. Can you please help ASAP? I need this done tonight.

Thanks,Swathi


This message was posted using Aspose.Live 2 Forum

Hi Swathi,

Thank you very much for considering Aspose.

I would like to inform you that this requirement is not supported by our current version of Aspose.Pdf.Kit. Can you please share whether you’re using Aspose.Pdf.Kit for .NET or Java, so I’ll be able to inform our team about this feature and they’ll be able consider it for our future versions.

Regards,

I am using pdf kit for .Net. I've found a partial workaround, but it doesn't entirely meet all requirements I need.

I need to set the tiff to have CCITT Group 4 Fax Encoding, 200 dpi, have margins, black and white.

Using the below code, I can only do one of these:

1.Using ImageOptions object, I can create a ccitt4 compressed tiff image (from a "doc" type), set the image to be 1 BPP, but can't set the resolution to 200.

2. Set the resolution of the image to 200 by using the PdfConverter object, but can't do the others.

I have this so far, can anyone help take this further? I also have other products handy: Pdf, Pdf Kit and Words. I'd really appreciate any help on this. Thank you.

public MemoryStream ConvertPDFToTIF(Stream inputStream)

{

string outPath = @"C:/Test/outtiff1.tif";

string imagePath = @"C:/Test/assignment.doc";

ImageOptions options = new ImageOptions();

options.TiffCompression = TiffCompression.Ccitt4;

options.Resolution = 200;

MemoryStream outStream = new MemoryStream();

Document doc = new Document(imagePath);

doc.SaveToImage(0, doc.PageCount, outStream, ImageFormat.Tiff, options);

File.WriteAllBytes(outPath, outStream.ToArray());

Image image1 = new Image();

image1.ImageInfo.ImageStream = outStream;

image1.ImageInfo.IsBlackWhite = true;

image1.ImageInfo.CcittSubFormat = CcittSubFormat.Group4;

PdfConverter converter = new PdfConverter();

//converter.Resolution = 200;

converter.BindPdf(image1.ImageInfo.ImageStream);

converter.DoConvert();

converter.SaveAsTIFF(image1.ImageInfo.ImageStream, 200, 200);

//EncoderParameters params1 = new EncoderParameters();

string outpath2 = @"C:/Test/outtiff2.tif";

File.WriteAllBytes(outpath2, outStream.ToArray());

return outStream;

}

Hi Swathi,

First of all, you’re trying to bind an image instead of a PDF using PdfConverter class, which is not supported. You can only convert a PDF file to a TIFF image using PdfConverter.

Secondly, if you’re having some problem with Aspose.Words then I would encourage you to post your question in the related forum, so that the concerned team would be able to help you out.

Lastly, I would like to inform you that I have logged a feature request as PDFKITNET-11417 in our issue tracking system, to support CCITT compression. Our team will be looking into this requirement and you’ll be updated via this forum as we support this feature; however, this might take some time.

We appreciate your patience.
Regards,



The issues you have found earlier (filed as 11417) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.