Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error CGI azure font and img #30

Closed
deniscesar opened this issue Feb 16, 2018 · 2 comments
Closed

Error CGI azure font and img #30

deniscesar opened this issue Feb 16, 2018 · 2 comments

Comments

@deniscesar
Copy link

I have application working right on local machine with kestrel.
Usage azure service returns error CGI aplication.
With simple writing text generates squares.
With absolute path css font family returns CGI error.
Img tag also returns CGI error.
Error: The specified CGI application encountered an error and the server terminated the process.
Here's an example.

 string  cssPath = @"file:///" + _environment.ContentRootPath + @"\wwwroot\font.css";

            var doc = new HtmlToPdfDocument()
            {
                GlobalSettings =
                {
                    ColorMode = ColorMode.Color,
                    Orientation = Orientation.Landscape,
                    PaperSize = PaperKind.A4
                },
                Objects =
                {
                    new ObjectSettings()
                    {
                        PagesCount = true,
                        HtmlContent = @"<html>
                                        <head>
                                            <meta charset='UTF-8' \>
                                            <link href=' "+ cssPath + @"' rel='stylesheet' type ='text/css' media='screen'>
                                        </head>
                                        <body>
                                            <img class='qrcode img-fluid pb-2' src='https://chart.googleapis.com/chart?chs=500x500&cht=qr&&chld=L|0&chl=12345678'>
                                            <h2>Imagem</h2>
                                        </body>
                                        </html>",
                        WebSettings =
                        {
                            DefaultEncoding = "utf-8"
                        },
                        HeaderSettings =
                        {
                            FontSize = 9,
                            Spacing = 2.812
                        }
                    }
                }
            };
          
            byte[] pdf = _converter.Convert(doc);
@branislav91srb
Copy link

@deniscesar I have similar problem but on local machine. Is there any solution?

@branislav91srb
Copy link

DI as singleton fixed my problem :-)

@rdvojmoc rdvojmoc closed this as completed Apr 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants