![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Creating The PDF from HTML using GTK WEBKIT Tool.
1 . This is pure ruby extension based pdf creator using gtk webkit api.
1 . Supports for RAILS integration. 2 . Create pdf based on the format in the controller with various options. 3 . Supports for rake level pdf creation.
EXAMPLE:
webkit = GTK::Webkit.new(string_data, format, options) #creates the webkit object where "format" => 1 . 0(zero) - means you are giving the html string to the first parameter(that is string_data). 2 . 1(one) - future usage. 3 . 2(two) - means you are giving the URI to the first parameter(that is string_data).
printer = webkit.gtk_printer #which returns the printer object, using this printer object you get the pdf content like below printer.pdf_content #returns pdf contenht as a string, then you can save this pdf content to a file or you can render using "send_data"(in the case of download). You can also export to a file using the following printer.export(base_url, filename) #base_url => base directory(like /home/mohanraj/), filename => name of the file, you want to export
In your controller just check the format, and render the pdf like below,
class UsersController < ApplicationController def index @users = User.scoped respond_to do |format| format.html format.pdf{ render :pdf => "pdf_name" } end end end
available options while rendering pdf, :layout => specify the layout, otherwise layout is false :template => template name to render :file => file to use :disposition => default to "inline" :format => :handler =>
NOTE: you have to create the view file for pdf like "index.pdf.erb" in the case of pdf render
You can enable middleware by adding following line to config/application.rb config.middleware.use GTK::Middleware
1.You need to install the following development packages, 1 . gtk 2 . libsoup 3 . webkitgtk 4 . atk 5 . gdk-pixbuf 6 . glib 7 . cario 8 . pango 2.And the following the libs 1 . libgtk 2 . libwebkitgtk 3.NOTE: minimum gtk2 and webkitgtk2 is required. 4.Then you can install the gem whether directly or by using bundler.
Thanks to GTK WEBKIT community.
FAQs
Unknown package
We found that gtk_webkit_pdf demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.