.NET Core Linux cannot convert PDF to Tiff

I’m unable to convert a PDF or page of a PDF to a bitonal tiff. It throws an error about the Gdip.CheckStatus not being implemented. I’m using Ubuntu 19.04 64-bit with a 30 day evaluation license. The code I used is the same one in the documentation.

Any ideas on if this will work or if its a limitation of TIFFs on Linux and the GDI+ in .NET Core?

@sbarnes88

Thank you for contacting support.

Would you please share complete stack trace of error and the source file you are working with, so that we may try to reproduce and investigate it in our environment. Please also verify that you are using the code snippet under heading of Convert All Pages to One TIFF Image. Before sharing requested data, please ensure using Aspose.PDF for .NET 19.9.

//Snippet 1 - fails
var bytes = File.ReadAllBytes("/home/shawn/test.pdf");
using (var stream = new MemoryStream(bytes))
{

            PdfConverter pdfConverter = new PdfConverter();
            Resolution resolution = new Resolution(300);
            pdfConverter.Resolution = resolution;

            pdfConverter.BindPdf(stream);
            pdfConverter.DoConvert();

            try
            {
                TiffSettings tiffSettings = new TiffSettings();

                tiffSettings.Compression = CompressionType.CCITT4;
                pdfConverter.SaveAsTIFF("/home/shawn/output.tiff", tiffSettings);
            }
            catch
            {

            }
            finally
            {
                pdfConverter.Close();
            }
        }

Exception:
Message: Not implemented.

Stack Trace: at System.Drawing.SafeNativeMethods.Gdip.CheckStatus(Int32 status)
at System.Drawing.Image.SaveAdd(EncoderParameters encoderParams)
at #=zW7kTTZBL43vgrbkMjsxgYFpOhoa6bMV3Oyq3qGZM0j6LBMADFw==.#=znwioz8I=()
at Aspose.Pdf.Devices.TiffDevice.Process(Document document, Int32 fromPage, Int32 toPage, Stream output)
at Aspose.Pdf.Facades.PdfConverter.SaveAsTIFF(Stream outputStream, Int32 imageWidth, Int32 imageHeight, TiffSettings settings)
at Aspose.Pdf.Facades.PdfConverter.SaveAsTIFF(String outputFile, TiffSettings settings)
at AsposeConversion.Program.Main(String[] args) in /home/shawn/RiderProjects/AsposeConversion/AsposeConversion/Program.cs:line 34

test.pdf (46.7 KB)

@sbarnes88

Thank you for elaborating further.

Would you please also share a ZIP containing sample application including the project file because project configurations are also required in order to reproduce this in our environment. We will then proceed further to assist you.

AsposeConversion.zip (7.7 KB)

@sbarnes88

We are looking into this scenario. In the meanwhile, can you please follow below steps and then share you kind feedback with us.

  1. Try installing “System.Drawing.Common” from NuGet

  2. If it does not resolve the issue, try the following steps:

  • Install .NetCore SDK
  • Install libgdiplus

The installation command to install libgdiplus is as follows

sudo apt-get install libgdiplus
ln -s libgdiplus.so gdiplus.dll 
  1. Try the following command as well:
  • apt-get install libc6-dev

Please share your findings after trying these suggestions.

Same issue still.

@sbarnes88

Thank you for the feedback.

We have logged a ticket with ID PDFNET-47078 in our issue management system for further investigations and will let you know once any update will be available in this regard.