Convert HTML to EPS in C#

Is it possible to use Aspose.HTML to convert HTML to EPS.

If not, do you have another product that can do this in .Net (C#)

@jonathan-4

Aspose.HTML does not currently support direct conversion of HTML to EPS format. However, you can use other Aspose products to achieve this. Specifically, Aspose.PDF can be utilized to convert HTML to PDF, and then you can convert the resulting PDF to EPS.

Here’s a general approach you can follow in C#:

  1. Convert HTML to PDF using Aspose.HTML:
    You can use the ConvertHTML() method from the Aspose.HTML library to convert your HTML content to a PDF document.

  2. Convert PDF to EPS using Aspose.PDF:
    After generating the PDF, you can use Aspose.PDF to convert the PDF file to EPS format.

Here’s a sample code snippet demonstrating this process:

using Aspose.Html;
using Aspose.Html.Saving;
using Aspose.Pdf;

class Program
{
    static void Main(string[] args)
    {
        // Step 1: Convert HTML to PDF
        string htmlFilePath = "input.html";
        string pdfFilePath = "output.pdf";

        // Load HTML document
        using (var document = new Aspose.Html.HTMLDocument(htmlFilePath))
        {
            // Save as PDF
            var pdfOptions = new PdfSaveOptions();
            document.Save(pdfFilePath, pdfOptions);
        }

        // Step 2: Convert PDF to EPS
        string epsFilePath = "output.eps";

        // Load PDF document
        using (Document pdfDocument = new Document(pdfFilePath))
        {
            // Save as EPS
            pdfDocument.Save(epsFilePath, SaveFormat.Eps);
        }
    }
}

Make sure you have both Aspose.HTML and Aspose.PDF libraries referenced in your project to use the above code.

If you need further assistance or have specific requirements, feel free to ask!