Aspose.PDF dependend on system.drawing

I have the same wish as System.Drawing is not supported on this platform.
I would really like to use Aspose.PDF on dotnet core.

Please keep me up to date when this is possible.

Kind regards.

@Fred.Net

Thank you for contacting support.

We are working to remove the dependency on System.Drawing which is quite a task, so we are afraid any ETA may not be available yet. However, we have logged your concerns and have attached the ticket ID PDFNET-45556 with this thread so that you may be notified automatically as soon as the ticket is resloved.

Hi,
We use Aspose in web service and we have problems referring to System.Drawing.

We would like to know if this reference has been removed in any version.

Best regards

@rblasco76

At this moment, Aspose.PDF is delivered with a reference to System.Drawing Assembly. We have been trying to remove this dependency and replace it with our own component but that is still in raw production. As far as the API usage under .NET Core environment is concerned, we tested following code snippet with 20.7 and later versions of the API and did not face any issue.

The following snippet has been successfully tested in the South Central US Data Center with Aspose.PDF v20.7 and later. Code tested as Azure Functions v2 and also as v3.

public static class Function1
{
    [FunctionName("Function1")]
    public static void Run([BlobTrigger("pdf-in/{name}", Connection = "")] Stream myBlob, string name, ILogger log,
        [Blob("images-out/{rand-guid}.png", FileAccess.Write)] Stream imageStream)
    {
        log.LogInformation($"C# Blob trigger function Processed blob\n Name:{name} \n Size: {myBlob.Length} Bytes");
        using var pdf = new Aspose.Pdf.Document(myBlob);
        var rect = pdf.Pages[1].GetPageRect(true);
        var pngDevice1 = new Aspose.Pdf.Devices.PngDevice((int)rect.Width, (int)rect.Height,
            new Aspose.Pdf.Devices.Resolution(300));
        var memoryStream = new MemoryStream();
        try
        {
            pdf.Pages[1].SendTo(pngDevice1, memoryStream);
            memoryStream.Position = 0;
            memoryStream.CopyTo(imageStream);
            log.LogInformation($"C# Blob trigger function. \n Copied to images-out");
        }
        catch (Exception ex)
        {
            log.LogError($"C# Queue trigger function processed: {ex.Message}");
        }
    }
}

Yet another snippet for TIFF:

[FunctionName("Function1")]
public static void Run(
    [BlobTrigger("pdf-in/{name}", Connection = "")] Stream myBlob,
    string name,
    ILogger log,
    [Blob("images-out/{rand-guid}.tiff", FileAccess.Write)] Stream imageStream)
{
    log.LogInformation($"C# Blob trigger function Processed blob\n Name:{name} \n Size: {myBlob.Length} Bytes");

    using (var pdf = new Aspose.Pdf.Document(myBlob))
    {
        var rect = pdf.Pages[1].GetPageRect(true);
        var tiffDevice = new Aspose.Pdf.Devices.TiffDevice((int)rect.Width, (int)rect.Height,
            new Aspose.Pdf.Devices.Resolution(300));
        var memoryStream = new MemoryStream();
        try
        {
            tiffDevice.Process(pdf, 1, 1, memoryStream);
            memoryStream.Position = 0;
            memoryStream.CopyTo(imageStream);
            log.LogInformation($"C# Blob trigger function. \n Copied to images-out");
        }
        catch (Exception ex)
        {
            log.LogError($"C# Queue trigger function processed: {ex.Message}");
        }
    }
}

Please let us know if you need further information.

@rblasco76

Adding more to our previous response, DRAWINGNET-331 is the ticket which was logged in order to integrate Aspose.Drawing with Aspose.PDF to remove System.Drawing dependency. The ticket has been linked with this post now and you will be notified once it is resolved.

Any update on this? its been over a year already!!

@amurakon

We are afraid that the above-logged ticket has not been yet resolved. Please note that replacing System.Drawing dependency with our own component is quite a complex task and requires a certain amount of time to get fully implemented. At the moment, the ticket resolution has been delayed due to regressions during testing and we will surely inform you once we have some definite updates in this regard. Please spare us some time.

We are sorry for the inconvenience.

Hello,

14 months later, is there any news on this ? This is annoying and problematic on macOS…

Thanks,

@Whiletrue,

There is a new Assembly, which is the same as Aspose.PDF, but does not require System.Drawing,

Is called Aspose.Pdf.Drawing. The documentation is here.

@carlos.molina
If I replace the the Aspose.Pdf nuget package with Aspose.Pdf.Drawing, getting error like there is not Pages.Add() method.
Even there is no Pages class.

@Whiletrue did you fix your problem.

@Santosh_Singh
Please attach a code snippet (isolated from yours, working only with the Aspose library) and a document with which this happens.