Tiff File Format Issue In Linux Server After .Net6 migration

Hi @asad.ali

As you suggested above, I have implemented the code to set custom fonts with the user service, but still same issue, However there is change in the file after applying this code. One letter shown in the below image “D”(Highlighted with orange box)
FontWithCustom.PNG (31.0 KB)

If you see initial screenshot, you will get the difference.

I have seen the ticket still in open state, please let me know if you need any help on this issue.

@Chenchu

Thanks for your kind feedback. We are investigating the case further and will surely let you know once the ticket is resolved or we need something from your side. Please spare us some time.

We are sorry for the inconvenience.

@Chenchu

Could you please send the full Docker file with which you are launching the application? And specify the installed version of Docker?

image.png (78.1 KB)

This is the docker file we are using. I am not sure about current docker version, I think we might be using latest one.
Thanks

@Chenchu

We have updated the ticket information and will let you know once some information is available about issue fix.

@Chenchu

We could not use your Dockerfile, because an error is generated when trying to build it.
Perhaps it is not given in full. According to the Docker documentation, it should start with FROM instruction “A Dockerfile must begin with a FROM instruction.”(Dockerfile reference | Docker Docs)

There is also no source code to convert the document to Bitmap.

Could you please send the full dockerfile so that the problem with Tiff conversion can be reproduced?
Using a standard Microsoft image, we successfully converted the document to PDF format. We attached an example of a Docker file and code.

internal class Program
    {
        static void Main(string[] args)
        {
            ConvertHtmlToTif();
        }

        public static void ConvertHtmlToTif()
        {
            using (Stream stream = File.Open("HTMLPage1.html", FileMode.Open))
            using (HTMLDocument doc = new HTMLDocument(stream, ""))
            {
                using (MemoryStream imageStr = new MemoryStream())
                {
                    var renderer = new HtmlRenderer();
                    var device = new PdfDevice(new FileCreateStreamProvider(".", "HTMLPage1.pdf"));
                    renderer.Render(device, doc);
                }
            }
        }
    }

Dockerfile:

FROM mcr.microsoft.com/dotnet/sdk:6.0

STOPSIGNAL SIGINT

RUN apt-get update \
    && apt-get install -y --allow-unauthenticated \
        libc6-dev \
        libgdiplus \
        libx11-dev \
     && rm -rf /var/lib/apt/lists/*

ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false

RUN sed -i'.bak' 's/$/ contrib/' /etc/apt/sources.list
RUN apt-get update; apt-get install -y ttf-mscorefonts-installer fontconfig

RUN fc-cache -f -v

WORKDIR /app

COPY . .

LinuxPdf.PNG (78.2 KB)

Hi @asad.ali
Thank you so much for looking into this issue.

I am okay with the above docker file and code you refered above or else u can wrote your own code, but the code should run under .net6 in linux environment.

Convert the given sample html file into tiff image, attach the docker file&code. I will use that and run in my system.

I am also able to convert html to pdf, but here only issue with html to tiff conversion. Please check from your side once.

@Chenchu

Sure, we will further investigate and share our feedback with you soon.

Hi @asad.ali
Any update on this

@Chenchu

Regretfully, the investigation could not get completed yet due to other pending issues in the queue. Nevertheless, we will let you know once we have some updates. Please spare us some time.

We apologize for the inconvenience.

Hi @asad.ali

Still the ticket is in open state, could you please let me know when it can be resolved.

@Chenchu

We are sorry for the delay and the inconvenience. We are in process of investigating the ticket and will surely let you know soon once the analysis is done. We again apologize for your inconvenience.

@Chenchu

In Q1 we plan to improve the quality of rendering for UNIX systems in a variety of ways. We plan to improve the rendering quality of text, pictures and graphical primitives. These fixes will most likely fix all rendering issues in your document. At the end of Q2, we plan to finish testing a new rendering system for UNIX systems that will remove the dependency on GDI+. This will slightly change the rendering result, but will improve the quality of the rendering even more.

Have you released the latest change.

@Chenchu

Sadly, the ticket has not been yet resolved and fix has not been yet released. Nevertheless, your concerns have already been recorded and we will surely inform you once we make some progress towards ticket resolution. Please spare us some time.

We are sorry for the inconvenience.

@Chenchu

Rendering quality improvements for Linux have been included in release 23.3.0.
Using the following Linux docker with .NET 6:

FROM mcr.microsoft.com/dotnet/sdk:6.0

RUN apt-get update \
    && apt-get install -y --allow-unauthenticated \
        libc6-dev \
        libgdiplus \
        libx11-dev \
     && rm -rf /var/lib/apt/lists/*

ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false

RUN sed -i'.bak' 's/$/ contrib/' /etc/apt/sources.list
RUN apt-get update; apt-get install -y ttf-mscorefonts-installer fontconfig

RUN fc-cache -f -v

And the following code:

using var doc = new HTMLDocument("input.htm");
using var dev = new ImageDevice(new ImageRenderingOptions(ImageFormat.Tiff), "result.tiff");
doc.RenderTo(dev);

You will receive the attached “result.tiff” file.

Thanks @asad.ali
I will try this one let you know.

Hi @asad.ali

Could you please provide the Docker file in the form of alpine image
FROM repo.mitchell.com/dotnet/aspnet:6.0-alpine

If I use alpine api-get commands shows not found

Could you please provide me the docker file in the for of alpine image

@Chenchu

We have logged your request under the linked ticket and will work on it. As soon as we have some feedback to share, we will let you know.

Thank you so much Asad Ali
I completed this issue, it’s working fine now.