We're sorry GroupDocs doesn't work properply without JavaScript enabled.

Free Support Forum - groupdocs.com

Preview AI file as PNG or JPG using C#

Hi,

I just want to confirm GroupDocs.Viewer can do what I want it to do.

I have a .NET Framework 4.8 WebForms app, using VB (visual basic) on an IIS server.

I have Illustrator files (AI) on a network share, which can be read by the IIS server.

I would like users of the site to be able to view a preview of the Illustrator file on the web page. This would happen “on-the-fly”.

I would provide them a little “Illustrator” icon, and when they hover their mouse, it would render the AI file as PNG (or JPG or whatever) in an IFRAME or equivalent.

Thanks,
Mike

@msatkevich

Welcome to GroupDocs Forum!

GroupDocs.Viewer can be used in WebForms app that is targeting .NET Framework 4.8. You’re free to choose which language to use. The WebForms C# example can be found at GitHub (unfortunately we do not have VB example).

GroupDocs.Viewer does support AI file format, the supported versions are: 2, 3, and 8. The file can be located anywhere but we do recommend loading files into memory for faster processing.

We do support rendering AI in PNG and JPG formats.

Feel free to ask additional questions!

Hi,

Thank you for your prompt response.

If I want to show a 400px by 300px image of the Illustrator file, which format would I use? (If not JPG or PNG).

Thanks,
Mike

@msatkevich

There are two options JPG or PGN. The output image can be resized using Width or Height properties. Use one of the properties to resize proportionally.

using (Viewer viewer = new Viewer("sample.ai"))
{
    JpgViewOptions viewOptions = new JpgViewOptions();
    viewOptions.Width = 400; // use width or height to keep proportions
    viewOptions.Height = 300;
    
    viewer.View(viewOptions);
}