Rotativa | Make Pdf from Asp.Net MVC | Model View Controller library

 by   webgio HTML Version: Current License: MIT

kandi X-RAY | Rotativa Summary

kandi X-RAY | Rotativa Summary

Rotativa is a HTML library typically used in Architecture, Model View Controller applications. Rotativa has no bugs, it has no vulnerabilities, it has a Permissive License and it has low support. You can download it from GitHub.

Rotativa, /rota'tiva/. Make Pdf from Asp.Net MVC. Available on Nuget https://www.nuget.org/packages/Rotativa
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              Rotativa has a low active ecosystem.
              It has 602 star(s) with 220 fork(s). There are 52 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              There are 93 open issues and 118 have been closed. On average issues are closed in 276 days. There are 12 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of Rotativa is current.

            kandi-Quality Quality

              Rotativa has 0 bugs and 0 code smells.

            kandi-Security Security

              Rotativa has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              Rotativa code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              Rotativa is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              Rotativa releases are not available. You will need to build from source code and install.
              Installation instructions are not available. Examples and code snippets are available.
              It has 1020 lines of code, 0 functions and 84 files.
              It has low code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of Rotativa
            Get all kandi verified functions for this library.

            Rotativa Key Features

            No Key Features are available at this moment for Rotativa.

            Rotativa Examples and Code Snippets

            No Code Snippets are available at this moment for Rotativa.

            Community Discussions

            QUESTION

            Problem Generating a PDF from html using Rotativa
            Asked 2021-Dec-15 at 15:14

            I have an MVC page that use a combination of Razor and C# code to render the html output. The page renders fine in the browser. However, in my browser when I use Rotativa to generate a PDF to print the page I get what seems to be JSON output instead of the formatted PDF.

            I am using Visual Studio 2019 with .NET 5.0 and Rotativa 1.7.3.

            I know I could try other HTML-to-PDF but Rotativa seems to be the best open source alternative.

            Can someone please tell me what I am doing wrong so I can get the output to render as a PDF?

            I am including excerpts of my code rendering the page, the Rotativa code and the "PDF" output.

            ...

            ANSWER

            Answered 2021-Dec-13 at 22:58

            Xudong, you were right about the response header being wrong. I downloaded a .net project which worked. I then did some more online searches and realized that I was using .net Core so I needed to download the .net Core version of Rotativa not the .net 4.6 version. With some help from the link, PDFCore , I was able to get my program to generate PDFs.

            Source https://stackoverflow.com/questions/70268051

            QUESTION

            Printing images as bakgrounds from HTML View in PDF
            Asked 2021-Apr-08 at 13:15

            I'm struggling very hard to be able to print a simple certificate template, my current problems are:

            1. I need to set two images for background, front page and backpage. Currently I set them up using some css positioning through tags.

            2. When I set all the layout, they are fine in the HTML view, however, once I try yo print from browser, or from a custom plugin (rotativa wkhtmlpdf), the layout get messed up and all formatting is gone.

            Below is the code: PS. @img_frente and @img_verso are base64 strings for the images as backgrounds.

            ...

            ANSWER

            Answered 2021-Apr-08 at 13:15

            I've come to a solution, treating div structure as parent/child with a master container on each block of the certificate, then aligned them with relative/absolute positioning. Full code below:

            PS. I removed useless scripts and the viewbags at src in img tags and vars are just base64 strings. I hope this can help people out!

            Source https://stackoverflow.com/questions/66895434

            QUESTION

            Wkhtmltopdf rotativa ASP.NET Core MVC issue
            Asked 2021-Mar-20 at 11:52

            I am using a digital ocean droplet using Ubuntu 18.04 LTS and deployed my ASP.NET Core 5.0 MVC project on it and everything works great. I was trying to install rotativa on it to print pdf documents but I cannot make this work.

            I followed these steps: https://blog.elmah.io/generate-a-pdf-from-asp-net-core-for-free/

            But I am getting this error when trying to print the pdf:

            Exception: QPainter::begin(): Returned false Exit with code 1, due to unknown error.

            I have this in my Startup.cs:

            ...

            ANSWER

            Answered 2021-Jan-04 at 19:19

            It's an issue with .NET 5. Looks related to the invoking Wkhtmltopdf.

            https://github.com/fpanaccia/Wkhtmltopdf.NetCore/issues/46

            Source https://stackoverflow.com/questions/65543457

            QUESTION

            IdentityServer4 Invalid Scope in Client application
            Asked 2021-Feb-11 at 07:43

            I am currently implementing IdentityServer4 with my microservices to authenticate users. My client application is a MVC project. While I run the project client application return an error as following,

            Sorry, there was an error : invalid_scope Invalid scope Request Id: 8000008d-0000-f700-b63f-84710c7967bb

            When I removed apiscopes from config file application works fine but then I didn't get any user claims in my authorization handler.

            Here's my code

            Config.cs

            ...

            ANSWER

            Answered 2021-Feb-11 at 07:43

            You should change the grant type to Code and also enable PKCE, because that is best practice to use when you use the authorization code flow.

            Source https://stackoverflow.com/questions/66131289

            QUESTION

            Display dynamic header using Rotativa pdf in MVC net core
            Asked 2020-Dec-10 at 07:34

            I want to display dynamic header in a cshtml. When i try to pass it using CustomSwitches i get an error like QPaintDevice: Cannot destroy paint device that is being paintedpure virtual method called terminate called without an active exception.

            Calling Rotativa component(it's in a class library) from mvc Controller to print the dynamic view without header works correctly but not with the header. Is there anyway to solve this problem?

            Thank you for your answers.

            Edit: Example using Rotativa

            string header = $"/Header.cshtml";

            var customSwitches = string.Format("--header-html "{0}" " + "--header-spacing "0" ", header);

            ...

            ANSWER

            Answered 2020-Dec-10 at 07:34

            customSwitches may not find /header.cshml. You need to give the correct path.

            Source https://stackoverflow.com/questions/65196561

            QUESTION

            How to get ControllerContext to build PDF using Rotativa in BackgroundJob with Hangfire
            Asked 2020-Nov-09 at 12:24

            I have to send mails in my background application, for this I use Hangfire, but I have to attach a document to each mail with its recipient, the information of the document to be attached is in a table that I convert with rotativa.

            My concern is when I want to convert the document into byte[] I always get that the HttpContext is null, obviously because there is no HTTP request which triggers the action while everything is in the background.

            Here is my actual code:

            ...

            ANSWER

            Answered 2020-Oct-27 at 22:29

            It looks like an issue in Rotativa lib that it has to take a controller context, github.com/webgio/Rotativa/pull/88

            And you won't be able to pass the context to hangfire background process as you listed.

            A work around (incase the file is not too big) might be that your hangfire process call a URL on your website which do the email sending code instead of doing the Rotativa and email sending in the hangfire background process.

            Source https://stackoverflow.com/questions/64554617

            QUESTION

            How to print into a pdf the results of a search on ASP.NET MVC?
            Asked 2020-Nov-04 at 14:59

            I'm new to ASP.NET MVC and I am trying to print the filtered records between two dates to a PDF. I'm using ROTATIVA to generate the PDF, the problem is that the PDF is generated correctly but with all the records and not only with the result of the record filter by the two dates.

            Code for the Controller:

            ...

            ANSWER

            Answered 2020-Nov-03 at 23:28

            You're calling the SalesToPdf action with no parameter which means it will always match the unfiltered list. You can pass parameters into the ActionAsPdf overloads as shown in the documentation here

            In your case this would probably require some kind of separate action for the filtered list like this:

            Source https://stackoverflow.com/questions/64672050

            QUESTION

            failed to add an attachment in MimeMessage (rotativa) for sending Mail
            Asked 2020-Oct-27 at 08:25

            I want to send a (view page) pdf sending by email.but when I trying to add an attachment, I found an error below "Add". for that I can't successfully sending mail with attaching my view pdf. Here is my code:

            ...

            ANSWER

            Answered 2020-Oct-27 at 08:25

            Attachments is a MimeMessage property that has no such method Add, so here comes the error. To add the attachments you should create a BodyBuilder object before, with this class you will be able to add new attachments (each one of them as byte array), usign Attachments Property and its Add method, but always related to BodyBuilder, not to MimeMessage.

            Please, take a look to the answer given here, as I guess is what you are looking for: .net Core Mailkit send attachement from array

            Or check another example here: https://www.taithienbo.com/send-email-with-attachments-using-mailkit-for-net-core/

            In addition, you could get Rotativa PDF as byte array usign this code:

            Source https://stackoverflow.com/questions/64520863

            QUESTION

            How to generate page footer for a PDF with dynamic content generated using Rotativa
            Asked 2020-Oct-19 at 10:24

            I am generating a pdf, and my employer asked me to add a footer to every single page in the pdf. The pdf gets generated with Rotativa, with a html page that turns into a pdf.

            My only problem is, how am i gonna do this. I thought about some ideas, plain css code, although there are more then enough options, none of them really worked out for me. Especially because i can have 1 page, or i can have 10, depends on the amount of information that has to be put onto it.

            So the footer has to be responsive to the amount of pages that will be generated.

            Does anyone have any ideas for me? I want to get this worked out really bad, but i just have no clue how to.

            Greetings Lorenzo Otto

            ...

            ANSWER

            Answered 2020-Oct-19 at 07:42

            If I have not misunderstood your question, you could simply use an HTML page as a footer, to display the page footer, involving some javascript to display the current page and total number of pages. I'am actually using this approach for several web applications using Rotativa that generate PDF files based on MVC views with dynamic content.

            Supposing we create a Footer.html (use the name you prefer here), this could be the HTML file for the PDF footer, including javascript code to generate page number info:

            Source https://stackoverflow.com/questions/64276766

            QUESTION

            Rotativa - controllercontext is null
            Asked 2020-Aug-24 at 10:53

            i work with ASP.NET MVC and i try to use rotativa for build a pdf by model. The problem is that in this context i operate in a model (i can't move the code in controller), and i write a procedure into a controller for build pdf. Like this

            ...

            ANSWER

            Answered 2020-Aug-24 at 10:53

            If you take a look at ControllerContext class documentation, it is expected to has HTTP request information. As you have instantiated this controller, there is no related HTTP request, so the context has no data.

            Maybe you could try building your own HTTP data on this ControllerContext class. Please, try using this code:

            Source https://stackoverflow.com/questions/63508982

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install Rotativa

            You can download it from GitHub.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/webgio/Rotativa.git

          • CLI

            gh repo clone webgio/Rotativa

          • sshUrl

            git@github.com:webgio/Rotativa.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link