C#导入Adobe Illustrator(.AI)文件渲染到Bitmap?

任何人都知道如何加载.AI文件(Adobe Illustrator),然后光栅化/渲染矢量到一个位图,所以我可以生成例如。 从它的JPG或PNG?

如果可能的话,我想制作缩略图+在PNG中渲染具有透明背景的大版本。

如果您知道.AI的规格,那么它是“可能的”,但是有任何知识或代码可以分享吗? 或者只是一些组件的链接?

C#.NET请:o)

代码是最有趣的,因为我对读取矢量点和绘制样条线一无所知。

好吧,如果Gregory认为ai文件是pdf兼容的,并且你可以使用GPL代码,那么在github上有一个名为GhostscriptSharp的项目,它是Ghostscript引擎的.NET接口,可以呈现PDF。

使用较新的AI版本,您应该能够从PDF转换为图像。 有很多图书馆这样做便宜,所以我会选择购买这个。 如果您需要转换旧的AI文件,则所有投注均已关闭。 我不确定他们的格式是什么。

private void btnGetAIThumb_Click(object sender, EventArgs e) { Illustrator.Application app = new Illustrator.Application(); Illustrator.Document doc = app.Open(@"F:/AI_Prog/2009Calendar.ai", Illustrator.AiDocumentColorSpace.aiDocumentRGBColor, null); doc.Export(@"F:/AI_Prog/2009Calendar.png",Illustrator.AiExportType.aiPNG24, null); doc.Close(Illustrator.AiSaveOptions.aiDoNotSaveChanges); doc = null; // } 

Illustrator.AiExportType.aiPNG24可以设置为JPEG,GIF,Flash,SVG和Photoshop格式。

我用Pdf2Png对它进行了测试,它与.PDF和.ai文件都运行良好。
但我不知道它如何与transparents合作。

 string pdf_filename = @"C:\test.ai"; //string pdf_filename = @"C:\test.pdf"; string png_filename = "converted.png"; List errors = cs_pdf_to_image.Pdf2Image.Convert(pdf_filename, png_filename);