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

First time works fine, second request nothing happen #190

Open
manishvadher opened this issue Feb 3, 2021 · 1 comment
Open

First time works fine, second request nothing happen #190

manishvadher opened this issue Feb 3, 2021 · 1 comment

Comments

@manishvadher
Copy link

First time works fine, the second request nothing happens, no exceptions

 public ActionResult BarcodePdf()
    {

      var document = new HtmlToPdfDocument
      {
        GlobalSettings =
                {
                    ProduceOutline = true,
                    DocumentTitle = "Pretty Websites",
                    //PaperSize = PaperKind.A4,
                    Margins =
                    {
                        All = 1.375,
                        Unit = Unit.Centimeters
                    }
                },
        Objects = {
                    new ObjectSettings { HtmlText = "<h1>Pretty Websites</h1><p>This might take a bit to convert!</p>" }
                }
      };

      IConverter converter =
    new ThreadSafeConverter(
        new RemotingToolset<PdfToolset>(
            new WinAnyCPUEmbeddedDeployment(
                new TempFolderDeployment())));

 
      // convert document
      byte[] result = converter.Convert(document);
      //string image = BarcodePdf1("abc");
      //string html = RenderRazorViewToString("BarcodePdf", image);
      //byte[] pdfContent = new SimplePechkin(new GlobalConfig()).Convert(html);
      return new FileContentResult(result, "application/pdf");
    }
@DoubleDot
Copy link

As it says in the documentation
"// Keep the converter somewhere static, or as a singleton instance!
// Do NOT run the above code more than once in the application lifecycle!"

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

2 participants