Free Support Forum - aspose.com

Add Group-4 TIFF in PDF using Aspose.PDF for .NET - Adobe Error: A Drawing Error Occured

I am getting the error when I am trying to use a Group 4 tif in my document. Here is the code that I am using to generate the document:

try

{

Aspose.Pdf.Pdf myDoc = new Aspose.Pdf.Pdf();

Aspose.Pdf.Section mySec = myDoc.Sections.Add();

mySec.IsLandscape = true;

Aspose.Pdf.Image img1 = new Aspose.Pdf.Image(mySec);

mySec.Paragraphs.Add(img1);

img1.ImageInfo.File = "C:\\Temp\\1.tif";

img1.ImageInfo.ImageFileType = ImageFileType.Ccitt;

img1.ImageScale = 0.1F;

img1.PositioningType = PositioningType.PageRelative ;

img1.Top = 0;

img1.Left = 0;

img1.ImageWidth = 1032;

img1.ImageHeight= 800;

img1.ImageInfo.CcittSubFormat = CcittSubFormat.Group4 ;

myDoc.Save("C:\\Temp\\Landscape.pdf");

}

catch (Exception ex)

{

MessageBox.Show (ex.Source + Environment.NewLine + ex.Message + Environment.NewLine + ex.StackTrace );

}

I have attached a sample tif that generates this error.

Hi,

Thank you for considering Aspose.

Sorry for replying to you so late because our web site is under maintenance last weekend.

Since your image is a TIFF image, just set the ImageFileType to TIFF. The width, height and CCITTSubFormat is not needed to set.