Giter Site home page Giter Site logo

pugpdf's Introduction

PugPDF

A WkHtmlToPdf .net core wrapper.

It includes all binaries to run wkhtmltopdf, no external dependencies.

NuGet

To get started you can download the prebuilt NuGet package.

Usage

var renderer = new HtmlToPdf();

renderer.PrintOptions.Title = "My title";

var pdf = await renderer.RenderHtmlAsPdfAsync("<h1>Hello world</h1>");

pdf.SaveAs("c:\\my.pdf");

// Or

var byteArray = pdf.BinaryData;

pugpdf's People

Contributors

afucher avatar denny966 avatar eangelin-froda avatar samuelcallicoat avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

pugpdf's Issues

"Executable not found" when running .NET Core 2.2

Exception is thrown when trying to find the executable path to wkhtmltopdf.exe

"Executable not found.":"C:\\Users\\<user>\\.nuget\\packages\\pugpdf.core\\1.0.8\\lib\\netstandard2.0\\wkhtmltopdf\\windows\\x64\\wkhtmltopdf.exe"}

Hi. I need to see multiple rows of data for table in pdf file.

Hi.. I am using foreach loop to retrieve list of elements from database. It has multiple rows of data. Well I don't know how can I get this whole list printed on pdf file that I want to generate using this library.

Can anyone help me in this please?

Thanks in advance.

Full HTML to pdf (including css)

Hello,

I am trying to use a html page and convert it to pdf but it gives an output like multiple lines while it should have been in a single line and ending column’s data gets cut in half if it is too long to fit. Would love any advice.

Regards, Faruk

Not working on Linux Envirotment

It is not working on linux, tried aloot of things, had to import a new version of wkhtmltopdf that i found on the web and got it working for me.

This repository has "wkhtmltopdf 0.12.4" version and i had to create a docker image with "wkhtmltopdf 0.12.5 (with patched qt)"

Dockerfile
`FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim AS base

...

// Install wkhtmltopdf dependencies
RUN apt-get update && apt-get install -y
xvfb
libfontconfig
wkhtmltopdf
libxrender1
libgdiplus
libc6-dev

...

// copy a working linux binary of wkhtmltopdf
// wkhtmltopdf 0.12.5 (with patched qt) -
// this is where i replace your wkhtmltopdf for a latest version
RUN cp newVersionFileForLinux /app/wkhtmltopdf/linux/x64/wkhtmltopdf`

Headers/Footers/Misc

Hi there,

Is there any interest in extending the wrapper to support the configuration of headers, footers, and a few other switches (such as --lowquality, --print-media-type, and --grayscale)?

If so, I'm happy to submit a pull request.

Cheers

Executeable not found in dotnet Net6 core

Debugged the code locally and the path of the wkhtmltopdf.exe points to a folder outside the project, "AppData\Local\AzureFunctionsTools\Releases\4.10.1\cli_x64"

It works when you place the executable file there but I could not now where is points when deploying the code to the server

Library doesn't work in single file application in .NET 5

When publishing my application with -p:PublishSingleFile=true the pugpdf library doesn't work, it throws an error when trying to access the assembly location.

Unhandled exception. System.ArgumentNullException: Value cannot be null. (Parameter 'path1')
   at System.IO.Path.Combine(String path1, String path2)

According to the documentation Assembly.location will always return an empty string.

The solution seems to be simple, just change assembly.location to AppContext.BaseDirectory.

I'll send a PR with this fix, I made some tests locally and seems to work fine.

wrong destination path, not running with azure-function,

the wkhtmltopdf binaries will be copyed in a wrong folder.

DestinationFiles="$(OutDir)\wkhtmltopdf<plattform><bitness>\wkhtmltopdf" is not ok for AzureFunction.

it must be:
DestinationFiles="$(OutDir)\bin\wkhtmltopdf<plattform><bitness>\wkhtmltopdf"

the start of any azurefunction is "../bin/court4u.AzureFunction.dll"
image

but the binaries not copyed in the correct bin-folder
image

do you can fix this? or do you have any workaround?

Executable not found in dotnet core 5

[16:05:26 INF] Exporting process started....
[16:05:47 ERR] Exception Message = Executable not found.
StackTrace = at PugPdf.Core.WkHtmlToPdfDriver.GetPath()
at PugPdf.Core.WkHtmlToPdfDriver.ConvertAsync(String html, String switches)
at PugPdf.Core.HtmlToPdf.RenderHtmlAsPdfAsync(String html)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.