0
votes

Is there a way I can add Adobe Illustrator file into a PDF file using itext7? I tried using the ImageData but I am getting an error about Image format cannot be recognized. I just wanted to see if there is another way to add this image into a PDF file.

iText.IO.Exceptions.IOException: 'Image format cannot be recognized.'

Paragraph paragraph = new Paragraph();
ImageData imageData = ImageDataFactory.Create(mapPath);
Image pdfMapImgage = new Image(imageData).ScaleAbsolute(mapWidth, mapHeight).SetFixedPosition(1, 25, 25);                         
paragraph.Add(pdfMapImgage);
Isn't an Adobe Illustrator .ai file essentially a PDF with extra information? I think you can try opening it in a PdfReader and PdfDocument, and then you can use CopyPagesTo or CopyAsFormXObject. - mkl