Coder Social home page Coder Social logo

hakanl / wkhtmltopdf-dotnet Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rdvojmoc/dinktopdf

351.0 11.0 58.0 88.84 MB

C# .NET Core wrapper for wkhtmltopdf library that uses Webkit engine to convert HTML pages to PDF.

License: GNU Lesser General Public License v3.0

C# 98.27% Dockerfile 1.34% HTML 0.38%
html pdf-generation wrapper-library

wkhtmltopdf-dotnet's Introduction

WkHtmlToPdf-DotNet NuGet Version

.NET Core P/Invoke wrapper for the native wkhtmltopdf library that uses Webkit engine to convert HTML pages to PDF.

Has been successfully tested on Windows, Linux, MacOSX and docker. One of the examples is using this in docker.

Install

Library can be installed through Nuget. Run command below from the package manager console:

PM> Install-Package Haukcode.WkHtmlToPdfDotNet

Note that with this NuGet package you don't need to manually add the native binaries to your project.

Fork

This library is forked from DinkToPdf. The main changes are to include the required native binaries in the package so they don't have to be manually installed, and renamed to a more appropriate project name. The license has also been corrected to match the license for the wkhtmltopdf parent project.

Building

Download the binaries (of wkhtmltopdf) from Github Releases (currently version 0.12.5) and put them under src\WkHtmlToPdf-DotNet in the runtimes folder (with a sub folder for each platform). Note that these binaries are only needed when you build this project to generate the NuGet package, you will not need the binaries when using the NuGet package, they will be automatically added.

Basic converter

Use this converter in single threaded applications.

Create converter:

var converter = new BasicConverter(new PdfTools());

Synchronized converter

Use this converter in multi threaded applications and web servers. Conversion tasks are saved to blocking collection and executed on a single thread.

var converter = new SynchronizedConverter(new PdfTools());

Define document to convert

var doc = new HtmlToPdfDocument()
{
    GlobalSettings = {
        ColorMode = ColorMode.Color,
        Orientation = Orientation.Landscape,
        PaperSize = PaperKind.A4Plus,
    },
    Objects = {
        new ObjectSettings() {
            PagesCount = true,
            HtmlContent = @"Lorem ipsum dolor sit amet, consectetur adipiscing elit. In consectetur mauris eget ultrices  iaculis. Ut                               odio viverra, molestie lectus nec, venenatis turpis.",
            WebSettings = { DefaultEncoding = "utf-8" },
            HeaderSettings = { FontSize = 9, Right = "Page [page] of [toPage]", Line = true, Spacing = 2.812 }
        }
    }
};

Convert

If Out property is empty string (defined in GlobalSettings) result is saved in byte array.

byte[] pdf = converter.Convert(doc);

If Out property is defined in document then file is saved to disk:

var doc = new HtmlToPdfDocument()
{
    GlobalSettings = {
        ColorMode = ColorMode.Color,
        Orientation = Orientation.Portrait,
        PaperSize = PaperKind.A4,
        Margins = new MarginSettings() { Top = 10 },
        Out = @"C:\WkHtmlToPdf-DotNet\src\TestThreadSafe\test.pdf",
    },
    Objects = {
        new ObjectSettings()
        {
            Page = "http://google.com/",
        },
    }
};
converter.Convert(doc);

Dependency injection

Converter must be registered as singleton.

public void ConfigureServices(IServiceCollection services)
{
    // Add converter to DI
    services.AddSingleton(typeof(IConverter), new SynchronizedConverter(new PdfTools()));
}

Docker

If you are using a linux version of docker container for net core provided from microsoft, you will need to install a couple of libraries.

The following example is for debian based linux distros;

Insert the below lines before the WORKDIR /app command

RUN apt update
RUN apt install -y libgdiplus
RUN ln -s /usr/lib/libgdiplus.so /lib/x86_64-linux-gnu/libgdiplus.so
RUN apt-get install -y --no-install-recommends zlib1g fontconfig libfreetype6 libx11-6 libxext6 libxrender1 wget gdebi
RUN wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.stretch_amd64.deb
RUN gdebi --n wkhtmltox_0.12.5-1.stretch_amd64.deb
RUN apt install libssl1.1
RUN ln -s /usr/local/lib/libwkhtmltox.so /usr/lib/libwkhtmltox.so

Note

For any other linux distro choose the correct package from the wkhtmltopdf releases

Recommendations

Do not use wkhtmltopdf with any untrusted HTML – be sure to sanitize any user-supplied HTML/JS, otherwise it can lead to complete takeover of the server it is running on!

wkhtmltopdf-dotnet's People

Contributors

bazen-teklehaymanot avatar davidevito avatar georgechond94 avatar gitfreud avatar gldraphael avatar hakanl avatar horizondave avatar hungdn2703 avatar huysentruitw avatar j0nimost avatar johguentner avatar mathlang avatar nilspur avatar poferro avatar rdvojmoc 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  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wkhtmltopdf-dotnet's Issues

License Change

I am not sure you are really allowed to Change the License of this code considering it was forked. You do not have copyright permissions to the substantial of the code base. It should stay as MIT

Blazor WASM

Hello,

Will it work on a blazor wasm? I guess not.
Getting the error below.

Unable to load native library. The platform may be missing native dependencies (libjpeg62, etc). Or the current platform is not supported.

Thanks for any answer.

Cpu 100% when generating pdf again after a restart

I am using the lib for pdf export, and it works good when items are far less than a hundred, when the items are closing to a hundred or even larger and I generate pdf again, the cpu is from 50% to 100% and cannot be done within 10 mins, do we have noticed the issue, is there a workaround?

The IIS worker process will occupy most the CPU.

How to re-produce:

  1. restart computer
  2. run a report have 50 pages, works good
  3. run a report again, the IIS worker process occupies all the cpu resource

disable-smart-shrinking is not implemented

Hello,

We are missing the disable-smart-shrinking setting. We have tested this using the wkthmltopdf library and it does work but there is no setting in the wrapper for this.

Could you advise on how to solve this problem please?

Thank you!

Pdf getting shrinked after conversion from HTML.

I am facing this weird issue , where the HTML file after conversion to PDF is getting shrinked . As a result i am getting a PDF which is shrinked to the top left corner.
Any pointers on how I can resolve the issue is appreciated.

Pictures no longer appear

Hello,
Since 1.3.0 version pictures (like .png) no longer appear.
I checked after just changing runtime for 0.12.5 and it works fine.

Unable to load native library

I'm still digging into this, but so far I'm not sure what the cause is yet.

I'm getting the following error when trying to use this, but only when deployed to a server to do testing. It doesn't have a problem when I run it locally within Visual Studio.

An unhandled exception occurred while processing the request.
AggregateException: One or more errors occurred. (Unable to load native library. The platform may be missing native dependencies (libjpeg62, etc). Or the current platform is not supported.)
System.Threading.Tasks.Task.ThrowIfExceptional(bool includeTaskCanceledExceptions)

NotSupportedException: Unable to load native library. The platform may be missing native dependencies (libjpeg62, etc). Or the current platform is not supported.
WkHtmlToPdfDotNet.ModuleFactory.GetModule()

AggregateException: One or more errors occurred. (Unable to load native library. The platform may be missing native dependencies (libjpeg62, etc). Or the current platform is not supported.)
System.Threading.Tasks.Task.ThrowIfExceptional(bool includeTaskCanceledExceptions)
System.Threading.Tasks.Task.Wait(int millisecondsTimeout, CancellationToken cancellationToken)
System.Threading.Tasks.Task.Wait()
WkHtmlToPdfDotNet.SynchronizedConverter.Invoke<TResult>(Func<TResult> delegate)
WkHtmlToPdfDotNet.SynchronizedConverter.Convert(IDocument document)
-- I've truncated the stack trace here for brevity -- 

NotSupportedException: Unable to load native library. The platform may be missing native dependencies (libjpeg62, etc). Or the current platform is not supported.
WkHtmlToPdfDotNet.ModuleFactory.GetModule()
WkHtmlToPdfDotNet.PdfTools.Load()
WkHtmlToPdfDotNet.BasicConverter.Convert(IDocument document)
WkHtmlToPdfDotNet.SynchronizedConverter.<>n__0(IDocument document)
WkHtmlToPdfDotNet.SynchronizedConverter+<>c__DisplayClass4_0.<Convert>b__0()
System.Threading.Tasks.Task<TResult>.InnerInvoke()
System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, object state)
System.Threading.Tasks.Task.ExecuteWithThreadLocal(ref Task currentTaskSlot, Thread threadPoolThread)

It's being used on a website hosted in IIS and using .NET 6, and I'm using the SynchronizedConverter. I do see the wkhtmltox.dll, so I know that's not it. I assume that the mentioned libjpeg62 thing is for when on linux? Not sure what else would be causing this?

NotSupportedException: Current platform is not supported

Hi,

I've installed the NuGet package according to the documentation (README). But if I want to convert HTML to PDF this error shows up.
Am I missing something here?

I'm running this on Windows 10 1909 x64, but in further process I want this to run inside an ASP.NET core 3.1 project on Ubuntu.

Thanks for any advice

Edit:
Message:
Current platform is not supported

Stacktrace:
at WkHtmlToPdfDotNet.ModuleFactory.GetModule()
at WkHtmlToPdfDotNet.PdfTools.Load()
at WkHtmlToPdfDotNet.BasicConverter.Convert(IDocument document)
at WkHtmlToPdfDotNet.SynchronizedConverter.<>c__DisplayClass5_0.b__0()
at System.Threading.Tasks.Task`1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()

Is it possible to run multiple conversions in parallel?

In my ASP.NET Core app, I run into a problem with the Synchronized converter that multiple web requests are queued on a single thread instead of running in parallel and/or utilizing all cores. I take it it is the expected behavior:

Use this converter in multi threaded applications and web servers. Conversion tasks are saved to blocking collection and executed on a single thread.

Is there a way to work around this limitation? For ASP.NET Core apps it's a really big issue as they are inherently multithreaded.

centos8 Error

Unable to load native library. The platform may be missing native dependencies (libjpeg62, etc). Or the current platform is not supported

Typo in Readme

renamed to a move appropriate project name
renamed to a more appropriate project name

runtimes

good job!

Can you please commit the runtimes ?

Thanks and kind regards

Tests crashing on linux but not windows

using dotnet test have no issues on windows hosts, but on the ubuntu-latest in azure devops pipeline consistently get this.

i'm sure i'm doing something wrong...just not sure what.


The active test run was aborted. Reason: Test host process crashed : Unhandled exception. System.NullReferenceException: Object reference not set to an instance of an object.
   at DinkToPdf.PdfTools.Dispose(Boolean disposing)
   at DinkToPdf.PdfTools.Finalize()

Error running on Azure (An attempt was made to load a program with an incorrect format.)

Everything works fine locally (I am running on macos), but then after deploying my solution to azure I get this error An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B).
It seems like @HakanL said that it doesn't use the right library 32/64 version.
I tried to Modify in my App service parameters to switch the machine to 64bit environment, but it has no effect, I still get the error.

Memory leak in SynchronizedConverter

in case of using of SynchronizedConverter PdfTools is as singleton and contains _Delegates member that is never cleared and list just fills with delegates on each conversion

_Delegates.Clear(); in DestroyConverter should remove this issue

Incorrect character encoding

Hello. I try to convert html to pdf. Html has charset set to iso-8859-2. Converted pdf should looks like Zażółć gęślą jaźń, but it looks like this Za���� g��lďż˝ ja��
Steps to reproduce
Use following code to generate pdf

private void Convert()
        {
            var html = "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html;charset=iso-8859-2\"><body>Zażółć gęślą jaźń</body></head></html>";
            using (var tools = new PdfTools())
            using (var converter = new SynchronizedConverter(tools))
            {
                var doc = new HtmlToPdfDocument()
                {
                    GlobalSettings = {
                        ColorMode = ColorMode.Color,
                        Orientation = Orientation.Portrait,
                        PaperSize = PaperKind.A4,
                        DPI = 300
                    },
                    Objects = {
                        new ObjectSettings() {
                            HtmlContent = html,
                            Encoding = Encoding.GetEncoding(28592),  //iso-8859-2
                            WebSettings = { DefaultEncoding = Encoding.GetEncoding(28592).WebName }
                        }
                    }
                };

                var bytes = converter.Convert(doc);
                File.WriteAllBytes("document.pdf", bytes);                
            }
        }

hi in linux my project has follow errors

System.DllNotFoundException: Unable to load shared library 'wkhtmltox' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libwkhtmltox: cannot open shared object file: No such file or directory

@media print not working

Hi, I was wondering why @media print is not working when used in the part of css?

I already enabled the options PrintMediaType = true;
image

Should Update Example

Hi,

Thanks for this nuget.
Just wanted to let you know if you try to convert two documents to pdf in the same call it will hang on the 2nd conversion, with no error.
You need to Dispose() the converter after it has been used.

        `var converter = new BasicConverter(new PdfTools());
        var bytes = converter.Convert(doc);
        converter.Dispose();
        return bytes;`

[Help] error 80010106 - Worker Service

Hi,
I am having trouble with implantation with Work Service

My Program.cs

  public class Program
  {
    [STAThread]
    public static void Main(string[] args)
    {
      CreateHostBuilder(args).Build().Run();
    }

    public static IHostBuilder CreateHostBuilder(string[] args) =>
        Host.CreateDefaultBuilder(args)
            .ConfigureServices((hostContext, services) =>
            {
              services.AddSingleton(typeof(IConverter), new SynchronizedConverter(new PdfTools()));
              services.AddHostedService<Worker>();
            });
  }

My Worker.cs

    protected override async Task ExecuteAsync(CancellationToken stoppingToken)
    {

      var converter = new SynchronizedConverter(new PdfTools());
      var doc = new HtmlToPdfDocument()
      {
        GlobalSettings = {
          ColorMode = ColorMode.Color,
          Orientation = Orientation.Portrait,
          PaperSize = PaperKind.A4,
          Margins = new MarginSettings() { Top = 10 },
          Out = $"‪C:\\Users\\b.sajermann.da.silva\\Desktop\\test.pdf",
          },
        Objects = {
          new ObjectSettings()
          {
              HtmlContent = @"<b>Lorem</b><div style='display:none'>bruno</div> ",

          },
        }
      };

      converter.Convert(doc);
      Console.WriteLine("Hello World!");
      Console.ReadKey();
    }

Error in Console:

Qt: Could not initialize OLE (error 80010106)
QPainter::begin(): Returned false

I've already tested it with and without [STAThread]

Thanks!

NotSupportedException with web server inside arm64 container until wkhtmltopdf is installed explicitly

Hello. Got an issue with workaround when using your library in arm64-hosted containers.

I have Mac M1 and x86 PC. My .net5 containers when launched on each of mentioned devices are arm64 and amd64 (docker specify it by itself i guess).
Everything is working fine when containers are x86, but with arm64 the following exception appears
`NotSupportedException: Unable to load native library. The platform may be missing native dependencies (libjpeg62, etc). Or the current platform is not supported.

WkHtmlToPdfDotNet.ModuleFactory.GetModule()`

I docker exec-ed into container and tried to investigate the problem.
Simple installing the parent library arm64 seems to fix the issue. Installing does not require additional dependencies to be installed, so it's only a matter of parent package itself I guess

I've read in readme that this is not how this library is supposed to function. So I don't know should I stick to that solution.
Also I've found repo with binaries, maybe this repo just misses arm64 type of lib? IDK, just guessing.

Some additional info
I have following Dockerfile (these packages for install was just copied from output of 'apt install wkhtmltopdf --no-install-recommends', many of them are included in your console app dockerfile).

FROM mcr.microsoft.com/dotnet/aspnet:5.0-buster-slim AS base
WORKDIR /app
COPY ["app/bash", "./"]
EXPOSE 80

RUN apt-get update \
    && apt-get install -y --no-install-recommends \
        ca-certificates \
        fontconfig \
        fontconfig-config \
        fonts-dejavu-core \
        libexpat1 \
        libfontconfig1 \
        libfontenc1 \
        libfreetype6 \
        libjpeg62-turbo \
        libpng16-16 \
        libx11-6 \
        libx11-data \
        libxau6 \
        libxcb1 \
        libxdmcp6 \
        libxext6 \
        libxrender1 \
        lsb-base \
        sensible-utils \
        ucf \
        x11-common \
        xfonts-75dpi \
        xfonts-base \
        xfonts-encodings \
        xfonts-utils
      

COPY root.crt /usr/local/share/ca-certificates/certificate.crt
RUN update-ca-certificates

# Api
FROM mcr.microsoft.com/dotnet/sdk:5.0-buster-slim AS build
WORKDIR /src
COPY ["app/Api/Api.csproj", "app/Api/"]
RUN dotnet restore "app/Api/Api.csproj"
COPY . .
WORKDIR "/src/app/Api"
RUN dotnet build "Api.csproj" -c Release -o /app/build/Api

FROM build AS publish
RUN dotnet publish "Api.csproj" -c Release -o /app/publish/Api

FROM base AS final
WORKDIR /app/Api
COPY --from=publish /app/publish/Api .

WORKDIR /app
ENTRYPOINT ["/bin/bash", "setup.sh"]

Entrypoint script here only runs dotnet Api.dll

And following csproj (partially presented here)

<PropertyGroup>
    <TargetFramework>net5.0</TargetFramework>
    <DockerComposeProjectPath>..\..\docker-compose.dcproj</DockerComposeProjectPath>
    <DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
    <DockerfileContext>..\..</DockerfileContext>
    <LangVersion>9</LangVersion>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="BCrypt.Net-Core" Version="1.6.0" />
    <PackageReference Include="Google.Apis.Oauth2.v2" Version="1.48.0.1869" />
    <PackageReference Include="Haukcode.WkHtmlToPdfDotNet" Version="1.5.59" />
  //rest imports here
  </ItemGroup>

So is it okay to probably launch some bash script to get current container architecture and install this package if needed? Or solution can be found and commited there? If so I'd like to help with contributing, just need some guidance

'local-file-access' is 'disabled' by default since version 0.12.6 of wkhtmltopdf

Issue described in #24, can be eventually caused by the disabled local file access since version 0.12.6 of wkhtmltopdf.

Local files during generation cannot be accessed by default since 0.12.6 of wkhtmltopdf.

This can be identified by the doc changes for the related parameters in wkhtmltopdf:
--disable-local-file-access is (default) in 0.12.6 and
--enable-local-file-acccess is (default) in 0.12.5
https://github.com/wkhtmltopdf/wkhtmltopdf/blob/0.12.6/docs/usage/wkhtmltopdf.txt
https://github.com/wkhtmltopdf/wkhtmltopdf/blob/0.12.5/docs/usage/wkhtmltopdf.txt

Temporary Solution:
Currently this can be solved by replacing the *.dll-files within the runtime-folder.
Just download the 0.12.5-Version for your system (https://github.com/wkhtmltopdf/wkhtmltopdf/releases/tag/0.12.5), install it, and copy the *.dll-File of the version to your runtime-folder

After digging into the code, I found, that 'BlockLocalFileAccess' in 'LoadSettings' (which can be applied to 'ObjectSettings'), can be set to 'false', which also solves the issue.

(this is not technical advice, but only the way I solved it. Downgrading to an old version might lead to bugs in previous versions, or can have security issues, which are solved in the new version)

Add support for --post option

wkhtmltopdf documents a repeatable --post option (under "Page Options") that allows adding additional POST fields to send to the input URL. Could we have an option added to LoadSettings to support this?

Not working with many request.

  • I used it for asp.net core api to generation pdf, but the first request work ok, but the second timeout in byte[] pdf = converter.Convert(doc);
    get 1: api/generatePdf response OK
    get again: api/generatePdf timeout

EF Core migrations fails after adding this package

We currently use this package to generate PDFs from HTML in a .NET Core Web API and it has been working great.

When I try to add a new EF Core migration an unhandled exception is thrown in this package:

dotnet ef migrations add <name> 
Build started...
Build succeeded.
Unhandled exception. System.NullReferenceException: Object reference not set to an instance of an object.
   at DinkToPdf.PdfTools.Dispose(Boolean disposing)
   at DinkToPdf.PdfTools.Finalize()

In Startup.cs I have added the IConverter as a singleton:

    .AddSingleton<IConverter>(new SynchronizedConverter(new PdfTools()))

Migrations does not work in either Windows or Mac.

Related: #14

Tear down isn't working 100%

When running unit test the testhost is kept running which holds a reference to the DLL of WkHtmlToPdf library, so if you're making changes it can't build. It's most likely something that isn't disposed/unloaded properly, but needs investigation.

Collaboration

Hi, I'd like to collaborate a bit on this project.

Things I'd like to improve:

  • limit API surface (now everything is public, even DllImports), I'd like to strip this down to the bare minimum
  • see if we can improve memory handling
  • improve performance
  • start using SemVer + git flow for versioning
  • setup github actions for automatic CI/CD

Perhaps this could all go in as a next major version 2.0. Are you open to contributors and willing to deviate away from DinkToPdf? I could create a fork and call it a day, but it's better to start with an existing user-base for validation.

Table of Content is blank page

Hi,
I'm implementing functionality to export pdf file used ASP.Net core 2.2
In the first time run project, i can export pdf with table of content as well. But in the next time, it's blank page.

[WkHtml("isTableOfContent")]
public bool IsTableOfContents { get; set; }

Can you help check it?

Fonts not working on server (works locally) even though PDF is being created

I've managed to get DinkToPdf generating pdfs locally (using DI in an Azure webjob), on a windows machine, and in a cloud app.

However, I reference a font (Swis721 Th BT) in my markup that isn't installed on any of these machines, so I use @font-face to add support for it. This works great on Mac, on Windows machine, but just doesn't work on the Cloud app (although the PDF is still generated)

I have tried:

    • 'link' style sheet with font file references
    • 'link' style sheet with embedded ttf fonts
    • <style> tags with font file references
    • <style> tags with embedded base64 ttf font
    • <style> tags with embedded base64 WOFF font
    • WebSettings.UserStyleSheet with embedded WOFF font

ALL of these work as markup, and on my local machine and on my windows dev machine as generated PDFs with the new font. But the new font is NEVER rendered in the webjob output.

Can anyone give me ANYTHING else to try?

If I remove the style locally from the markup, the font isn't rendered, so it's not installed on either of my local machines (i've checked)

I've got everything working except this one issue.

Runtimes folder is not copied during publish-process on .NET Framework

Publishing .NET Framework (4.8) Projects does not copy runtimes directory to target location.
The problem occures with new csproj-format (i.e. console app) as well as with old csproj-format (i.e. asp.net application)...

Steps to reproduce for first example:

  • dotnet new console -n Test -o ./
  • changing target framework to net48 in csproj file
  • dotnet add package Haukcode.WkHtmlToPdfDotNet --version 1.5.8
  • dotnet publish --configuration=Release

I have not tried to get a minimum example for legacy csproj format since I think it s the same problem with both formats...

Blank Pages being inserted in large PDFs

WkHtmlToPdf-DotNet seems to be inserting blank pages into pdfs being converted to byte arrays if its used consecutively. I don't know if this is an issue with the converter or something else. I am generating student ids in pdfs from html templates and CSS. If I generate them individually it works correctly and is formatted right. However if I generate a large number of them it starts inserting blank pages between the front and back of the ids that print fine when doing them individually. I tried limiting the to 25 students thus 50 page pdfs which makes the first 50 print correctly but after that it starts inserting blank pages. Maybe an issue with calling the converter back to back? Any help would be appreciated.

Readme should be updated

First, proper installation command for this particular version of package should be instead

Install-Package Haukcode.DinkToPdf

Also it would be useful to know, what in particular has changed since the original DinkToPdf fork.

Dependency error calling Convert method executing Lambda

Hi,

First of all, thanks very much for putting this code together. I'm working on upgrading a working .Net Core 2.1 lambda with DinkToPdf to 3.1 and struggling with dependencies, hoping this code is easier. But still running into issues with dependencies. Specifically, this error when trying to convert the html to byte[]:

Exception encountered on server. System.AggregateException: One or more errors occurred. (Unable to load native library. The platform may be missing native dependencies (libjpeg62, etc). Or the current platform is not supported.)

Pretty sure the issue is with the deployment / package, rather than the code. Here is the command I use to manually build the uploaded zip file: dotnet lambda package --configuration debug --framework netcoreapp3.1 --output-package bin/Release/netcoreapp3.1/release.zip

And attached is the csproj fil
VDEx.FCRA.WebAPI.csproj,txt
e

Any suggestions?
Thanks,
Reuven

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.