GraphicsQualityOptions

The type or namespace name “GraphicsQualityOptions” could not be found (are you missing a using directive or an assembly reference?)

What am I missing? I am currently using the following:

using Aspose.Words;
using Aspose.Words.Markup;
using Aspose.Words.Saving;

@pmarangoni

It seems that you are encountering an issue with the GraphicsQualityOptions type not being recognized in your project. This could be due to a few reasons:

  1. Missing Namespace: Ensure that you have included the correct namespace for GraphicsQualityOptions. In Aspose.Words, this class is typically found under the Aspose.Words.Saving namespace. You should have the following using directive in your code:

    using Aspose.Words.Saving;
    
  2. Assembly Reference: Make sure that you have referenced the correct Aspose.Words assembly in your project. If you are using NuGet, ensure that you have the latest version of the Aspose.Words package installed.

  3. Version Compatibility: Check if the version of Aspose.Words you are using supports GraphicsQualityOptions. This class is used to set rendering quality options when converting documents to image formats. If you are using an older version, consider updating to a more recent version that includes this feature.

Here is a simple example of how to use GraphicsQualityOptions in your code:

using Aspose.Words;
using Aspose.Words.Saving;

class Program
{
    static void Main()
    {
        Document doc = new Document("input.docx");

        // Create an instance of GraphicsQualityOptions
        GraphicsQualityOptions qualityOptions = new GraphicsQualityOptions();
        qualityOptions.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
        qualityOptions.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;

        // Set up ImageSaveOptions
        ImageSaveOptions saveOptions = new ImageSaveOptions(SaveFormat.JPEG);
        saveOptions.GraphicsQualityOptions = qualityOptions;

        // Save the document as an image
        doc.Save("output.jpg", saveOptions);
    }
}

This code snippet demonstrates how to create a GraphicsQualityOptions object, configure it, and then use it in ImageSaveOptions when saving a document as an image. Make sure to adjust the properties according to your needs.

If you continue to face issues, please check the documentation for any additional requirements or examples related to GraphicsQualityOptions.

I am referencing Aspose.Words 24.10.0 and the class is using Aspose.Words.Saving.

The metadata for ImageSaveOptions:

#region Assembly Aspose.Words, Version=24.10.0.0, Culture=neutral, PublicKeyToken=716fcc553a201e56
// C:\Users\pmara\.nuget\packages\aspose.words\24.10.0\lib\net8.0\Aspose.Words.dll
#endregion

using System.Drawing;

namespace Aspose.Words.Saving
{
    public class ImageSaveOptions : FixedPageSaveOptions
    {
        public ImageSaveOptions(SaveFormat saveFormat);

        public ImageBinarizationMethod TiffBinarizationMethod { get; set; }
        public MetafileRenderingOptions MetafileRenderingOptions { get; }
        public float Scale { get; set; }
        public float ImageContrast { get; set; }
        public float ImageBrightness { get; set; }
        public ImageColorMode ImageColorMode { get; set; }
        public TiffCompression TiffCompression { get; set; }
        public int JpegQuality { get; set; }
        public Size ImageSize { get; set; }
        public float Resolution { set; }
        public float VerticalResolution { get; set; }
        public float HorizontalResolution { get; set; }
        public ImagePixelFormat PixelFormat { get; set; }
        public Color PaperColor { get; set; }
        public PageSet PageSet { get; set; }
        public override SaveFormat SaveFormat { get; set; }
        public byte ThresholdForFloydSteinbergDithering { get; set; }
        public bool UseGdiEmfRenderer { get; set; }

        public ImageSaveOptions Clone();
    }
}

I don’t see any GraphicsQualityOptions in there…

@pmarangoni Most likely you are using .NET Standard, .NET6, NET7 or NET8 version of Aspose.Words. GraphicsQualityOptions are available only in .NET Framework versions of Aspose.Words.

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): WORDSNET-23273

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

Correct, I am working with .NET 8.

1 Like