Problem adding CCITT G4 Image to PDF

I am adding a CCITT G4 image to the PDF using the VB code listed below. Aspose.Pdf reports no problem, however, when I open the generated PDF using Adobe Acrobat version 6.0.2, it reports “Insufficient data for an image.”. The page displays, but there is no image shown. I have verified that the image height, width and format (G4) are all correct.

What could be wrong here? I wanted to attach the CCITT data file, but I didn’t see any way to add an attachment to this message. So instead, the CCITT data file can be found here: www.softwaretime.com/aspose/raw.dat and the generated PDF can be found here www.softwaretime.com/aspose/test.pdf

Thank you,
Joe A.

Sub AsposeTestIt()
Dim pdf1 As Aspose.Pdf.Pdf = New Aspose.Pdf.Pdf
Dim sec1 As Aspose.Pdf.Section = New Aspose.Pdf.Section(pdf1)
sec1.PageInfo.PageWidth = 2560 + 90 + 90 ’ image size plus left/right margins
sec1.PageInfo.PageHeight = 3171 + 72 + 72 ’ image height plus top/bottom margins
pdf1.Sections.Add(sec1)
Dim image1 As Aspose.Pdf.Image = New Aspose.Pdf.Image(sec1)
sec1.Paragraphs.Add(image1)
image1.ImageInfo.File = “C:\raw.dat”
image1.ImageInfo.ImageFileType = Aspose.Pdf.ImageFileType.Ccitt
image1.ImageInfo.CcittSubFormat = CcittSubFormat.Group4
image1.ImageWidth = 2560
image1.ImageHeight = 3171
image1.ImageScale = 1.0
pdf1.Save(“c:\test.pdf”)
End Sub

Dear Joe,

Thank you for considering Aspose.

I have tested other CCITT-G4 image and have not found any error. But when incorrect image width or height is used, the error you described occured.
Are you sure the image you used is valid CCITT-G4 image and the image width and height is correct?

I’m fairly confident it is correct. I will double check. Perhaps you could try the CCITT image file I posted on my website (see previous link) and let me know if it works or fails for you.

Thanks,
Joe A.

I have tried the image on your web site and failed. But I have not found the reason now.

Hello,
I am facing the same problem. My file is Ccitt file with group 4 compression.
The generated pdf is empty although there are three pages in the image, see the attached file.

I tried using

ImageInfo.ImageFileType = ImageFileType.Tiff

The result is extremely slow performance.

Please help.
Mohammed Al-Ashraf

Dear ashraf,

Thank you for considering Aspose.

I have tested your image and have not found any error. Please remeber to set the IsBlackWhite property to true. Aspose.Pdf processes black-and-white CCITT image a little slowly. This is because the algorithm is complexed.

A Little bit slow? I takes ages to process one page!

Excuse me for that last post. I was onlu surprised that although I submit my image in the correct format, it is obviously re-compressed by Aspose.Pdf. I am probably doing something wrong here, since 35 seconds to convert a 1-bit tiff image to a 1-bit tiff image is simply unacceptable.

Dear robvanderveer,

Thank you for considering Aspose.

Aspose.Pdf needs to de-compress the image and recompress it. If the image is large, this will take much time. I think you have not do anything wrong. I know it takes too much time to process a image, but I have to improve it later.

I Hope you get around to it real soon. I’ve checked out products that can convert 10.000 images to pdf per minute. I can hardly take this product serious this way.

Did you find time to look into my problem?

Dear robvanderveer,

Thank you for considering Aspose.

I have checked this problem and found I can’t improve the performance in short time. I have not found better way to process the CCITT G4 image. I need much time to to this work, Sorry.