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
4
votes
2 answers

Running a TuesPechkin converter more than once

I'm using TuesPechkin for my web application, which I'm testing locally on IIS with VS2013. The user clicks a button and the page's current HTML is saved to a PDF file, which is then emailed out. This process is going to be run regularly as the…
MikeOShay
  • 522
  • 1
  • 7
  • 17
3
votes
1 answer

Rendering local images using TuesPechkin?

I'm trying to generate documents using TuesPechkin and so far it's working flawlessly when it comes to URL images. However, when it comes to local images it doesn't seem to generate the image at all as shown here:…
z0mby
  • 95
  • 1
  • 11
3
votes
2 answers

Using tuespechkin with MVC project in Azure

I can't manage to get pechkin or tuespechkin to work on my azure site. Whenever I try to access the site it just hangs with no error message (even with customErrors off). Is there any further setup I'm missing? Everything works perfectly locally.…
woggles
  • 7,444
  • 12
  • 70
  • 130
3
votes
1 answer

How can I add a header and footer to the generated PDF

I'm using Gmanny's Pechkin Pdf library and it's working perfectly. Here's is my code: private void CreatePdfPechkin(string htmlString, string fileName) { //Transform the HTML into PDF var pechkin =…
panky sharma
  • 2,029
  • 28
  • 45
3
votes
1 answer

Pechkin and in-used process in IIS

I use Pechkin for generating pdf in my web application, but i have a problem, when application use it to generate PDF, append to IIS application a in use process and i can not restart application, i have to recycle application pool at first and then…
Behrooz
  • 2,437
  • 3
  • 21
  • 31
2
votes
0 answers

How do I make the --viewport-size argument available in Tuespechkin?

I have a web application where I want to add a "Save as PDF" button on each page that when pressed will automatically convert the current web page to a PDF document available for download in the browser. I have added TuesPechkin (v2.1.1) and…
2
votes
1 answer

How do I force TuesPechkin to use the latest version of 'wkhtmltox.dll' (0.12.5)?

I've downloaded the more recent version of TuesPechkin and the most recent version of TuesPechkin.Wkhtmltox.Win64.dll. The version of the latter is 0.12.2. I need to access fixes in 0.12.5. Can anyone give me a clue as to what I have to do to get…
Stuart Hemming
  • 1,553
  • 2
  • 21
  • 44
2
votes
2 answers

Tuespechkin takes a long time to respond, and returns null

I'm currently using in my project TuesPechkin version 2.1.1, and also TuesPechkin.Wkhtmltox.AnyCPU v0.12.4.1 This is some of my code: byte[] result = null; try { var globalSettings = CreateGlobalSettings(portraitMode); var objectSettings =…
Rui Piloto
  • 31
  • 3
2
votes
0 answers

wkhtmltopdf anchor text having HTML. issue

wkhtmltopdf 0.12.3.2 (with patched qt) -- Windows 8 If I include some html inside anchor tag then the generated pdf doesn't make it clickable. e.g
TreeMap!
Command : wkhtmltopdf.exe…
xtremist
  • 909
  • 2
  • 9
  • 18
2
votes
2 answers

TuesPechkin: IIS-hosted application

I'm having trouble trying to setup the PDF to HTML converter from the TuesPechkin Nuget package. I have it set up like mentioned here: This is my code in my aspx.cs page: private static IConverter converter = new ThreadSafeConverter( …
Barry Michael Doyle
  • 9,333
  • 30
  • 83
  • 143
2
votes
1 answer

Remove top margin from cover page of PDF generated using TuesPechkin

I am using TuesPechkIn to convert my html to PDF. I am setting the configuration as follows: My question is, can I remove the top margin from the first page of the PDF only? (Basically its the cover page which includes a banner image). Is there any…
2
votes
1 answer

Repeating table header on every page with Pechkin

I'm trying to include the header (thead) of a table on the top of every page generated by Pechkin (wrapper for wkhtmltopdf), but it doesn't seem to work at all. Is this feature even available or am I missing something? I've tried including the…
user4614918
2
votes
2 answers

Convert Persian HTML to PDF

When converting a html file with Persian content, the result does not contain appropriate Persian content. All Persian content shows as ???
Masoud Bahrami
  • 111
  • 1
  • 12
2
votes
1 answer

Background colors not rendering in Pechkin generated PDF

I'm generating a PDF file based on some HTML, using the pechkin dll. This is all working nicely except the background colors are not being rendered. An example of the HTML I'm using is:
Matt Eno
  • 687
  • 5
  • 25
1
vote
1 answer

Base64 string encoded Images not loading on the output PDF (TuesPechkin / Wkhtmltopdf)

Fair warning: This post is a bit of an essay-sized question... So let me say my thanks beforehand to whoever goes through it and tries to answer it. Context: I have been trying the only 2 free-commercial-use open-source html to pdf converting…
Mxpsth
  • 67
  • 8
1
2 3