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
1
vote
0 answers

How to detect HTTP Error 404 or 500 in TuesPechkin

I want to throw an exception if a web page that TuesPechkin is generating for PDF returns HTTP Error 404 or 500. I don't want to get a PDF file for the friendly-looking HTML error page. It have tried the EventHandler (see the codes below), but none…
Tony
  • 1,827
  • 1
  • 22
  • 23
1
vote
0 answers

Visual C++ 2013 runtime in Service Fabric

I am using TuesPechkin in one of Service Fabric services to generate PDF files from HTML. This is working fine on my local development computer, but as soon as I deploy my application to an Azure cluster and run the same code I get the following…
Johannes Heesterman
  • 1,248
  • 1
  • 12
  • 21
1
vote
0 answers

Generating PDF with Print button on .NET

I have a requirement to dynamically generate a PDF document from HTML that includes a button that will trigger the PDF print dialog, when viewed in either a browser or Adobe Acrobar Reader, or any program that displays PDFs. I currently use…
Myles McDonnell
  • 12,943
  • 17
  • 66
  • 116
1
vote
2 answers

How to set PageOptions in TuesPechkin

I'm using TuesPechkin (the C# wrapper of wkhtmltopdf) and have it generating PDF files from HTML. However, I would like to set the --disable-smart-shrinking option, which is listed in the wkhtmltopdf documentation as a PageOption How can I do…
PaulG
  • 13,871
  • 9
  • 56
  • 78
1
vote
1 answer

How to instantiate TuesPechkin PDF library?

What string is needed in TuesPechkin's StaticDeployment constructor? A temp folder? A dll path? My TuesPechkin PDF converter works fine on my localhost's IIS using: private static readonly IConverter _pdfConverter = new ThreadSafeConverter( …
Richard
  • 14,798
  • 21
  • 70
  • 103
1
vote
1 answer

Pechkin to Tuespechkin

For a project, we are migrating to Windows Azure. I have to make sure that the HTML to PDF converter will run on a 64 bit worker role. Since Pechkin can't run as a 64bit application I have decided to use Tuespechkin, because they should be very…
user480355
  • 31
  • 1
  • 6
1
vote
1 answer

Hide Footer on first page

Is it possible to hide the header/footer of a TuesPechkin document for a specific page. I'd like the header and footers to be ignored on the first page of the PDF document but can't find a way to achieve this. Document setup as below: var document =…
Israfel
  • 1,162
  • 2
  • 15
  • 29
1
vote
1 answer

How To Do A Page Break in a PDF Generated Using Pechkin

I'm generating a PDF file based on some HTML, using the pechkin dll. This is all working nicely except the I need to it add a page break at certain places and I don't know how. I thought that using a css page-break-before, but that doesn't seem to…
Matt Eno
  • 687
  • 5
  • 25
1
vote
2 answers

Pechkin with Windows Azure

I'm getting this error whenever I try to debug the Azure project from Visual Studio. I checked on my original site project file the Platform Target and project's and every dependence as well are using "Any CPU". Not really sure what to do from here.…
gdubs
  • 2,724
  • 9
  • 55
  • 102
0
votes
1 answer

Tuespechkin cannot find wkhtmltox.dll

Good morning, I'm trying to generate pdf files with Tuespechkin, using html. It works perfectly locally, however not in production. public static bool GeneratePDFFromHTMLPaysage(String full_path, String htmlContent, String baseUrl) { …
alexay68
  • 172
  • 10
0
votes
1 answer

Why does my header end up way outside the page with TuesPechkin?

I do a convert document.Objects.Clear(); document.GlobalSettings.PaperSize = PaperKind.A4; document.Objects.Add(new ObjectSettings { HtmlText = xml, HeaderSettings = new HeaderSettings { HtmlUrl = headerPath,…
liftarn
  • 429
  • 3
  • 21
0
votes
0 answers

System.DllNotFoundException - Unable to load DLL 'wkhtmltox.dll': Access is denied

I am faced with the problem convert html to pdf using TuesPechkin. I have two applications on IIS and both of the apps have different application pool. But I got an error from one of these: Unable to load DLL 'wkhtmltox.dll': Access is denied.…
Mert Metin
  • 373
  • 2
  • 13
0
votes
1 answer

TuesPechkin adding  in front of Currency £ Symbol

I have been using Tues Pechkin for html to PDF Conversion But there is one issue Tues Pechkin is adding by default  this symbol in front of £ Symbol Example :- £85,000 var document = new HtmlToPdfDocument { …
Parshuram Kalvikatte
  • 1,616
  • 4
  • 20
  • 40
0
votes
1 answer

How to make PDF of a page running behind windows authentication?

I'm trying to make PDF's of some webpages on the same site but since the website is behind Windows Authentication it failes. I can load the page markup using a HttpRequest and WindowsIdentity.Impersonate() but when the PDF plugin tries to create the…
Kulvis
  • 655
  • 11
  • 33
0
votes
2 answers

How to improve Linq-to-sql in MVC action method

I'm working on a method to generate pdf. For this purpose I'm using tuespechkin library . Conversion itself is quite fast. Most of the time it takes retrieving data from the database and creating html representation of pdf. To improve the…
nehfi
  • 131
  • 2
  • 4