wkpdf | A command line HTML to PDF converter for Mac OS X | Document Editor library

 by   plessl Ruby Version: Current License: MIT

kandi X-RAY | wkpdf Summary

kandi X-RAY | wkpdf Summary

wkpdf is a Ruby library typically used in Editor, Document Editor, macOS applications. wkpdf has no bugs, it has no vulnerabilities, it has a Permissive License and it has low support. You can download it from GitHub.

Command line tool for rendering HTML to PDF using WebKit and RubyCocoa on Mac OS X. Although there are plenty of browsers available for Mac OS X, I could not find a command-line tool that allows for downloading a website and storing the rendered website as PDF. This was my motivation for creating wkpdf. The application uses Apple WebKit for rendering the HTML pages, thus the result should look similar to what you get when printing the webpage with Safari.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              wkpdf has a low active ecosystem.
              It has 189 star(s) with 25 fork(s). There are 10 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              There are 4 open issues and 38 have been closed. On average issues are closed in 385 days. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of wkpdf is current.

            kandi-Quality Quality

              wkpdf has 0 bugs and 49 code smells.

            kandi-Security Security

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

            kandi-License License

              wkpdf 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

              wkpdf 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.
              wkpdf saves you 413 person hours of effort in developing the same functionality from scratch.
              It has 979 lines of code, 47 functions and 15 files.
              It has high code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed wkpdf and discovered the below as its top functions. This is intended to give you an instant insight into wkpdf implemented functionality, and help decide if they suit your requirements.
            • Parse the command line arguments
            • Defines a new option
            • Iterate over the arguments from the arguments .
            • Resolves the available options .
            • Parses an IO option and returns the command - line argument
            • Notifies the application .
            Get all kandi verified functions for this library.

            wkpdf Key Features

            No Key Features are available at this moment for wkpdf.

            wkpdf Examples and Code Snippets

            No Code Snippets are available at this moment for wkpdf.

            Community Discussions

            QUESTION

            How to bulk generate PDF from HTML templates ready for double-sided printing in PHP?
            Asked 2018-Aug-16 at 16:17

            I've been struggling with this for a while and feel helpless. Prestashop uses tcpdf to generate invoices and delivery slips from HTML templates filled using Smarty. We are working on updating the invoice design and found tcpdf to be lacking in CSS support. After some research we settled for wkhtmltopdf as the right tool from converting the HTML/CSS templates to PDF.

            The problem

            The store has a feature for exporting multiple invoices into a single PDF. Using TCPDF I was able to make the batch file ready for double sided printing by inserting a blank page after each invoice that had odd number of pages before the file was generated. But now that we switched to wkhtmltopdf I cannot achieve the same result.

            The crucial problem is that while wkhtmltopdf allows for the usage of multiple HTML templates there seems to be no reliable way to determine the number of pages they are each going to have before the file is generated. The header and footer templates can receive the page count that the invoice ends up being but they are separate from the main content and therefore I cannot insert a page break accordingly.

            I've also tried to calculate the height of the content / PDF page height but there were various issues with that once I started exporting multiple templates (worked alright with a single template). This approach isn't great either because inserting a blank page into the content itself causes the footer to appear on the new page as well which is not what I want.

            My best attempt

            The only way I've figured out that could get me around these issues is very inefficient. Each time a template is added to the batch I could pre-generate it using a separate instance of a wrapper for wkhtmltopdf, get the temporary file name, determine how many pages it has using pdfinfo and add a blank HTML template to the main instance accordingly. Here's a draft of a function to get the number of pages of the last template added (from a class that extends the wrapper, based on some other pdfinfo questions I found on SO):

            ...

            ANSWER

            Answered 2018-Aug-16 at 16:17

            Unfortunately wkhtmltopdf is the library, which is written in C language and we can not dynamically add one page on the fly like in PHP libraries.

            Citate from your comment: Due to number of items ordered or ammount of customer data each invoice can be anywhere from 1 to 3 pages long.

            And because of this we can not precalculate the number of pages and write it to a database.

            I think you have only one possibility / solution: you have to write behind each invoice a blank page and after the whole PDF was generated you have to edit it with free PHP library like FPDI. In combination with FPDI it is even possible to edit PDF documents.

            By PDF editing you could delete all blank pages which you do not need if they starts with odd page number (like 3, 5, etc.). And in FPDI you have the possibility to detect a page number. It is much faster than the solution which you use now.

            And the blank(or empty) pages you could detect on content length with FPFI like follows:

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

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

            Vulnerabilities

            No vulnerabilities reported

            Install wkpdf

            You can download it from GitHub.
            On a UNIX-like operating system, using your system’s package manager is easiest. However, the packaged Ruby version may not be the newest one. There is also an installer for Windows. Managers help you to switch between multiple Ruby versions on your system. Installers can be used to install a specific or multiple Ruby versions. Please refer ruby-lang.org for more information.

            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/plessl/wkpdf.git

          • CLI

            gh repo clone plessl/wkpdf

          • sshUrl

            git@github.com:plessl/wkpdf.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