I got an html page with a few links. A render the page to string, and try to generate a pdf from it.
pdf = WickedPdf.new.pdf_from_string(html_string,
disable_internal_links: false,
disable_external_links: false)
Unfortunately the links(hrefs) are parsed as plain text
Link to google (google.com)
Instead I want the links to be clickable. Like the following
Link to google
Answering to my own question:
The problem was that the underlying tool was ignoring the 'disable_internal_links' and 'disable_external_links' options.
I needed to update wkhtmltopdf to be wkhtmltopdf with qt patch.
I used this install script
# you will be needing git if you haven't got it yet
sudo apt-get install git-core
sudo apt-get install openssl build-essential xorg libssl-dev libxrender-dev
git clone git://github.com/antialize/wkhtmltopdf.git wkhtmltopdf
sudo apt-get install libfontconfig1-dev libfreetype6-dev libx11-dev libxcursor-dev libxext-dev libxfixes-dev libxft-dev libxi-dev libxrandr-dev libxrender-dev
git clone git://gitorious.org/~antialize/qt/antializes-qt.git wkhtmltopdf-qt
cd wkhtmltopdf-qt
git checkout 4.8.4
QTDIR=. ./bin/syncqt
./configure -nomake "tools examples demos docs translations" -opensource -prefix ../wkqt
make -j3 && make install
cd ../wkhtmltopdf
../wkqt/bin/qmake
make && make install
Related
i'm planing to install sensu monitoring framework. It needs Erlang to work. I'm running RHEL5 and it's not connected to internet. Only option is to download and install the packages. Please help..
I would try to download and install the RPM package esl-erlang from Erlang Solutions (CentOS tab). It's a single-package installation.
Install required dependencies:
yum install -y openssl openssl-devel ncurses-devel ncurses unixODBC unixODBC-devel make which java-1.8.0-openjdk-devel.ppc64le tar gcc build-essential wget
Download erlang to install erl and escript binaries:
wget erlang.org/download/otp_src_18.3.tar.gz && tar zxvf otp_src_18.3.tar.gz && cd otp_src_18.3 && export ERL_TOP=`pwd` && export PATH=$PATH:$ERL_TOP/bin
Configure and build erlang:
./configure && make && make install
You can download the erlang source tar.gz from internet, then compile the source files and install. just like make and make install.
You can read this link:http://www.erlang.org/doc/installation_guide/INSTALL.html
I am on a Mac, using Lion. I am configuring my system for Ruby on Rails development but I ran into some issues. Instead of using brew or other shortcuts I want to configure Ruby on Rails from source. So, here is what I did.
Installed Ruby 2.0
Downloaded the source from the Ruby website
Compiled it by running the following code:
./configure --prefix=/Users/user/Applications/ruby2
make
make install
And made sure the $PATH file is updated to point to /Users/user/Applications/ruby2/bin
So, I am able to call ruby -v or if I do which ruby it does point to my custom compiled version of Ruby.
Installed Node.js
Downloaded the source from the main website
Compiled it by running the following code:
./configure --prefix=/Users/user/Applications/nodejs
make
make install
And made sure the $PATH file is updated to point to /Users/user/Applications/nodejs/bin
So, I am able to call node -v or if I do which node it does point to my custom compiled version of Ruby.
I also did the same steps for openssl and it is also accessible from the console or if I do which openssl it points to /Users/user/Application/openssl/bin
But still when I execute gem install rails I still get the following error:
ERROR: Loading command: install (LoadError)
cannot load such file -- openssl
ERROR: While executing gem ... (NoMethodError)
undefined method `invoke_with_build_args' for nil:NilClass
Any idea why?
System Specs
Mac Lion 10.8.4
OpenSSL 1.0.1e 11 Feb 2013
ruby 2.0.0p291
Nodejs v0.10.15
I managed to solve the problem by doing the following. The main problem was the step I followed to compile openssl itself.
Since I am on a 64 bit machine, I had to configure openssl by running the following command first
./configure --prefix=/Users/user/Applications/openssl darwin64-x86_64-cc
./make
./make install
And recompile ruby as such
./configure --prefix=/Users/user/Applications/ruby2 --with-openssl-dir=/Users/user/Applications/openssl
./make
./make install
Note: Even though while compiling ruby it might say... the option --with-openssl-dir is not valid or does not exist, ignore that.
I had very bad time with this ERROR.
Finally i done with it. There is only Once solution either you are with RVM or without RVM.
Make sure you have installed OpenSSL first BEFORE installing ruby.
First you should find where Ruby is:
whereis ruby
will list all the places where it exists on your system, then you can remove all them explicitly. Or you can use something like this:
rm -rf /usr/local/lib/ruby
rm -rf /usr/lib/ruby
rm -f /usr/local/bin/ruby
rm -f /usr/bin/ruby
rm -f /usr/local/bin/irb
rm -f /usr/bin/irb
rm -f /usr/local/bin/gem
rm -f /usr/bin/gem
THEN
sudo apt-get install zlib1g zlib1g-dev build-essential openssl libssl-dev libmysqlclient18 libmysqlclient-dev libyaml-dev curl git-core python-software-properties libpq-dev nodejs
apt-get -y update
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline6-dev libyaml-dev
cd /tmp
wget http://cache.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p247.tar.gz
tar -xvzf ruby-2.0.0-p247.tar.gz
cd ruby-2.0.0-p247/
./configure --prefix=/usr/local
make
make install
I hope this help you.
I'm having a trouble installing rvm ROR on my machine using ubuntu 12.04
here are the outputs I'm getting:
Output #1:
Searching for binary rubies, this might take some time.
No binary rubies available for: ubuntu/12.04/i386/ruby-1.8.7-p371.Continuing with compilation.
Please read 'rvm mount' to get more information on binary rubies.
Installing requirements for ubuntu, might require sudo password.
and at the end of the line of update I get this:
Output #2:
There has been error while updating 'apt-get', please give it some time and try again later.
For 404 errors check your sources configured in:
/etc/apt/sources.list
/etc/apt/sources.list.d/*.list
Try running sudo apt-get update separately on a command line. Your Ubuntu might be old and its repositories could be out of date. So apt-get update itself is maybe not working in your machine.
To step over that issue, run the following commands:
# Disable RVM from trying to install necessary software via apt-get
rvm autolibs disable
# Then try installing Ruby:
rvm install 1.8.7
If you still face errors, see if you can directly do apt-get install without doing apt-get update (which fails):
# Try to see if you can manually install the necessary software
sudo apt-get install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion pkg-config
If that's also not working, then paste your apt-get update output.
I have used this procedure.I m using Linux Mint.
I am getting the following error while installing.
E: Unable to locate package libreadline6-dev
E: Unable to locate package libyaml-dev
E: Unable to locate package libgdbm-dev
E: Package 'ncurses-dev' has no installation candidate
E: Package 'bison' has no installation candidate
E: Package 'subversion' has no installation candidate
E: Package 'libffi-dev' has no installation candidate
I think you didn't installed the rvm requirements .
Install the requirements like libreadline6-dev , libyaml-dev , libgdbm-dev ,etc..
I think This will solve the Problem.
Install all these with the command
sudo apt-get install build-essential openssl libreadline6 libreadline6-dev \
curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 \
libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison \
subversion pkg-config
Or, Just refer this link.
This instructions are old, following rvm installation instructions:
\curl -#L https://get.rvm.io | bash -s stable --autolibs=4 --ruby
It will:
Download and install RVM
Enable automatic requirements installation
Install ruby including all required dependencies
which OS you using ?
if you using Ubuntu,
then use the link :
http://blog.sudobits.com/2012/05/02/how-to-install-ruby-on-rails-in-ubuntu-12-04-lts/
if you are using windows
then problem while installing in some gem dependence like. 'libffi-dev', less-rail
than used other OS that very well for "Ruby on Rails" like Linux/Ubuntu
If you're using ubuntu, the copy and paste https://github.com/vaneyckt/Ruby-on-Rails-installation-script/blob/master/install.sh. You might need to hit enter at some point.
this worked for me.
WARNING: The following packages cannot be authenticated!
apt-get clean # Remove cached packages
cd /var/lib/apt
mv lists lists.old # Backup mirror info
mkdir -p lists/partial # Recreate directory structure
apt-get clean
apt-get update # Fetch mirror info
I didn't know that installing ruby is such a pain
After lot of trouble with curl certificate, I installed the rvm using the methods mentioned in the rvm site also with lot of help from stackoverflow questions.
Now I am trying to install rails using the gems command
gem install rails
but I always get this error
ERROR: Loading command: install (LoadError)
cannot load such file -- zlib
ERROR: While executing gem ... (NameError)
uninitialized constant Gem::Commands::InstallCommand
I did follow every thing mentioned here https://rvm.beginrescueend.com/packages/zlib/
and also as a mentioned in a stackoverflow post
I did install all the tools as required by the requirements
yum install -y gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison iconv-devel
But still I get this error. When I looked at the build log for ruby under
/usr/local/rvm/log/ruby-1.9.3-p125/configure.log
I see this error
[2012-04-07 01:13:44] ./configure --prefix=/usr/local/rvm/rubies/ruby-1.9.3-p125 --enable-shared --disable-install-doc --with-zlib --with-opt-dir=/usr/local/rvm/usr --with-libyaml
configure: WARNING: unrecognized options: --with-zlib, --with-libyaml
Is the rvm broken ? or is there a problem while building the ruby src.
Note: I am running fedora 14
RVM causes more problems than it solves (IMHO). Better tools are ruby-build and rb-env. Newer tools that look very good too are ruby-install and chruby.
Here are my notes from my recent Red Hat Enterprise Linux (RHEL) installation of Ruby, which I believe is pretty similar to Fedora. Perhaps these notes can be of some help to you. Ask me questions if you like.
Install zlib
yum install zlib zlib-devel
Install YAML
export k=yaml v=0.1.4
wget http://pyyaml.org/download/libyaml/$k-$v.tar.gz
tar zxvf $k-$v.tar.gz
cd $k-$v
./configure
make && make install
Install X11 if you want X or headless browsing for testing
yum install
xorg-x11-fonts-misc
xorg-x11-fonts-truetype
xorg-x11-server-Xorg
xorg-x11-server-Xvfb
Install libraries
yum install
gdbm gdbm-devel
ncurses ncurses-devel
openssl openssl-devel
readline readline-devel
tk tk-devel
libjpeg libjpeg-devel
libpng libpng-devel
libxml2 libxml2-devel
libxslt libxslt-devel
zlib zlib-devel
Install ruby-build
cd /opt
git clone git://github.com/sstephenson/ruby-build.git
cd ruby-build/
./install.sh
Install Ruby
export k=ruby v=1.9.3-p125
wget http://ftp.ruby-lang.org/pub/ruby/1.9/$k-$v.tar.gz
tar zxvf $k-$v.tar.gz
cd $k-$v
# Either onfigure with defaults...
./configure
# Or configure with custom locations...
./configure --prefix=/opt/$k/$v --enable-shared --with-opt-dir=/opt/yaml/current
make && make check && make install
Environment
Edit /etc/environment to add this:
RUBYOPT='-r rubygems -r psych'
If you put Ruby in a custom directory, also merge this with your existing path:
PATH=/opt/ruby/1.9.3-p125/bin (or wherever you put it)
Load environment:
source /etc/environment
Verify gem runs and you see the intial set of gems:
gem list
Gem update:
gem update --system