Questions tagged [tuespechkin]

TuesPechkin is a .NET Wrapper for the wkhtmltopdf library.

TuesPechkin is a .NET Wrapper for the wkhtmltopdf library.

Supported usage

  • It supports .NET 2.0+, 32 and 64-bit processes, and IIS-hosted applications.
  • Azure Websites does not currently support the use of wkhtmltopdf.
  • It is not tested with any operating systems besides Windows.
  • It is available as a NuGet package for your convenience.
  • It is built and tested around wkhtmltopdf 0.12.2.
  • Even if you use the IIS-compatible method documented below, you may only use one converter/toolset instance per application pool/process. A workaround is being researched for a future version.

Example

1. Create a document with options of your choosing.

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

2. Create a converter for an IIS-hosted application

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

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

byte[] result = converter.Convert(document);
37 questions
0
votes
0 answers

Issue converting aspx file to image

I've been using TuesPechkin to create images of some HTML code from my application. I'e been using the following code successfully when using HTML, but if I try to load ASPX files instead, the code doesn't work. var htmlDocument =…
Zelig880
  • 500
  • 4
  • 6
0
votes
1 answer

How to add dynamic header to generated PDF document

Im using TuesPechkin to ceate Pdfs from dynamic Html. The body is easy as it can take a Html string, the header & footer however only take Urls. I have them stored locally atm as html, I can bring them in to the document, but without any dynamic…
Tamzoid
  • 29
  • 6
0
votes
2 answers

Convert to PDF method only works once

I'm using pechkin.synchronized to convert from HTML to PDF. On the first http request it works fine, but after that it gets stuck on the convert method and doesn't doesn't do anything after that. Here's my controller action method: public…
luka
  • 103
  • 1
  • 5
0
votes
2 answers

How can I start content on a new page if it doesn't fit

I'm using Pechkin to convert html content with css to pdf files. The problem I am facing is that a part of a html block is being cut off because it doesn't fit on the current page anymore. Now what i would like is that when the content doesn't fit…
Jamie
  • 3,031
  • 5
  • 36
  • 59
0
votes
1 answer

Footer not rendering when converting HTML to PDF

I'm using TuesPechkin to convert HTML to PDF and I'm specifying the URL of an HTML file that should appear as the footer on each page, however it doesn't render the footer. As a test, I even tried setting the LeftText to something and that doesn't…
Matt Eno
  • 687
  • 5
  • 25
0
votes
3 answers

Pechkin lib throws a TypeLoadException

I've tried many examples that use Pechkin and Pechkin.Synchronized but can't get it to run, because all the times, I get the following error. An unhandled exception of type 'System.TypeLoadException' occurred in mscorlib.dll Additional…
Vikrant
  • 253
  • 4
  • 15
-1
votes
1 answer

Is there any js radar chart library can work with Tuespechkin on console application?

I am trying to develop an .Net console application that can convert an html file (with css, js file) to pdf by Tuespechkin. There is an radar chart in html file. That radar chart show smoothly in browser (even IE 11). But chart cannot show in pdf…
ONLAEG
  • 197
  • 3
  • 12
1 2
3