Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NuGet pack native libs, VS2017 project format #18

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ajryan
Copy link

@ajryan ajryan commented Dec 28, 2017

No description provided.

@Harha
Copy link

Harha commented Feb 16, 2018

Are you guys going to merge this and make a release or is this still a work in progress?

@dorny
Copy link

dorny commented Apr 5, 2018

Hello, would be possible to move with this? I'm using DinkToPdf in dockerized app so I have to download native libs using wget during build of the container... which works but it would be far more elegant if nuget package could handle this itself.

Looks like more people are waiting for this so if you need some help just let us know ;)

@ovovchak
Copy link

Guys, any plans on actually merging this PR? I think you'll simplify your lib a lot

@rafamerlin
Copy link

rafamerlin commented Jun 13, 2018

Hey @ajryan , sorry to bother, but apparently this PR is approved. Can you merge it? Or is just the owner of the repo who can merge?

Cheers

@aidanjryan
Copy link

Hi @Merurino I wish I could! But I don't maintain this repo, just submitted the PR.

At this point I'm thinking about forking...

@bill-richards
Copy link

This really needs merging, building and making its way into the NuGet repo

@LiamDotPro
Copy link

+1 I agree we've been having lots of issues getting the dll's to load and adding custom assembly is not ideal if it can be managed through nuget.

@kgrosvenor
Copy link

Does this commit fix the path issues in docker, any news on this being merged if so?

@aidanjryan
Copy link

Does this commit fix the path issues in docker, any news on this being merged if so?

Not sure what you mean by "path issues" - what's the symptom?

@bill-richards
Copy link

bill-richards commented Nov 20, 2018

The issue is (I think) that when running inside a docker container, invoking the PDF conversion on html content, images and stylesheets are not rendered, and rather one has to make a GET request to a service which will return the rendered html page instead

I spent a bit of time fighting this issue but in the end we just stood up a service with a POST endpoint for picking up the request for a PDF which either cached the input data locally, temporarily (not the end solution), or converted the input data to a URL encoded string to pass as a query param in a GET call to the service which applied the data to dynamic html (Razor template) and returned a properly rendered HTML page, which was then passed in as the HTML to the PDF generator -I so hope that makes sense.

// End user endpoint
[HttpPost("{templateName}")]
public IActionResult GeneratePdfDoc(string templateName, [FromBody]JObject json)
{
   var url =$"{HttpContext.Request.Scheme}://{HttpContext.Request.Host}/create-document/{templateName}/{UrlEncoder.Create().Encode(json.ToString())}";
    var output = _pdfConverter.Convert(new HtmlToPdfDocument()
   {
            GlobalSettings =
            {
               ColorMode = ColorMode.Color,
               Orientation = Orientation.Portrait,
               PaperSize = PaperKind.A4
             },

            Objects = { new ObjectSettings {Page = url} }
    });
    return new FileStreamResult(new MemoryStream(output), System.Net.Mime.MediaTypeNames.Application.Pdf);
}
 // Endpoint for applying a template to data and rendering Html
 [HttpGet("{templateName}/{jsonString}")]
      public async Task<IActionResult> ApplyTemplateToUrlEncodedJsonData(string templateName, string jsonString)
      {
         return await Task.Factory.StartNew(() => 
         {
            var json = JsonConvert.DeserializeObject<JObject>(WebUtility.UrlDecode(jsonString));
            var dictionary = _jsonConverter.GetDictionaryFromJson(json);
            var model = _modelFatory.CreateModelFromDictionary(dictionary);
            var viewToLoad = $"~/Views/Templates/{templateName}.cshtml";
            var result = View(viewToLoad, model);
            return result;
         });
      }

@kgrosvenor
Copy link

Does this commit fix the path issues in docker, any news on this being merged if so?

Not sure what you mean by "path issues" - what's the symptom?

In the end i just has to update my dockerfile with some dependencies to be able to run the included file for linux

@ssougnez
Copy link

@rdvojmoc Any update?

@JimWolff
Copy link

JimWolff commented Mar 8, 2019

@ajryan @rdvojmoc it would be great with more people that have write access, otherwise we have been thinking about creating a new nuget package with these issues solved, since we are also using dinktopdf.
It would be better to continue with the original package though.

@ajryan
Copy link
Author

ajryan commented Mar 9, 2019 via email

@rndusr0
Copy link

rndusr0 commented Mar 11, 2019

@ajryan If it's useful for anyone, I published a nuget package of my last PR #72 including your updates, a bugfix and an upgrade to .NET standard 2.0 and wkhtml2pdf 0.12.5 at https://www.nuget.org/packages/RndUsr0.DinkToPdf/

It's only been tested on Windows, but any feedback gratefully received...

@ajryan
Copy link
Author

ajryan commented Mar 11, 2019

@rndusr0 awesome! All, Chris Bryden's (rndusr0) fork looks solid to me. I plan to adopt his NuGet package and file issues against his repo instead of here. (If that's OK with you, Chris.)

@rndusr0
Copy link

rndusr0 commented Mar 11, 2019

@ajryan Thanks - Yes that's great with me, I'll aim to get it set up on my Linux and MacOS machines so I can test there. We are using this package in commercial projects on Windows, so I'd appreciate any bug reports or suggestions for improvement and will aim to get them turned round in a reasonable amount of time!

@HakanL
Copy link

HakanL commented May 16, 2019

My repo (https://github.com/hakanl/DinkToPdf) is also on NuGet and it includes all native binaries, is docker-compatible (and tested).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.