Home » Posts tagged "Web Service"

Getting close to launching HTML2PDF Web Service!

For the last couple of months I’ve been busy developing HTML2PDF Web Service. Due to some setbacks I had to postpone its launch. The way it’s looking now I’ll be ready to launch by the end of the month.

So what had to change?

  • I had to switch from Payment Service Provider, which is done now. Instead of only credit cards I’m now supporting PayPal, iDEAL, Paysafe Card and Mister Cash. Credit Card support should come back later. Instead of recurring subscriptions you can now buy up to 1 year of access in advance. This is due to not being able to support recurring subscriptions anymore because of the PSP switch.
  • The website is now multilingual: currently supporting English and Dutch. Both have their own domain names. I’ve done this to get a better position in the Dutch market.

All that’s left now is changing the way token usage is being calculated and it should be all set to go. The HTML2PDF Web Service is still in beta, so feel free to try it out. Once the web service is out of beta I’ll do another post here with a follow up on used technology (Perl, Go and more!).

 

Help beta test an HTML2PDF Web Service

In an earlier post I asked if anyone would be interested to help me out test a web service for converting HTML to PDF. Today I’m opening up the beta to anyone that’s interested.

Please visit https://html2pdfwebservice.com/ and sign-up for a 7-day trial account. No credit card required! Trial length can be extended upon request.

Converting HTML to PDF is easy with the HTML2PDF Web Service. Here are some examples:

cURL

$ curl -H "X-API-Key: F8802062-4D31-11E3-8F59-BFD4058B6BFF"
       -H "X-API-Username: MyUsername"
       -d '{"content":"<html><head><title>My page</title></head><body><h1>Hello World!</h1><p>I am an HTML page converted to PDF!</p></body></html>"}'
       https://html2pdfwebservice.com/api/convert > page.pdf

Perl

#!/usr/bin/env perl
use strict;
use warnings;
use Mojo::UserAgent;

my $ua = Mojo::UserAgent->new;
my $tx = $ua->post(
    'https://html2pdfwebservice.com/api/convert' => {
        'X-API-Username' => 'MyUsername',
        'X-API-Key'      => 'F8802062-4D31-11E3-8F59-BFD4058B6BFF'
    } => json => {url => 'http://domain.com/invoice.html'}
);
if (my $res = $tx->success) {
    my $pdf_data = $res->body;
}

Ruby

require 'net/https'
require 'uri'

uri           = URI.parse('https://html2pdfwebservice.com/api/convert')
https         = Net::HTTP.new(uri.host, uri.port)
https.use_ssl = true
# In case the SSL certificate isn't accepted
https.verify_mode = OpenSSL::SSL::VERIFY_NONE

req = Net::HTTP::Post.new(uri.path)
req['X-API-Username'] = 'MyUsername'
req['X-API-Key']      = 'F8802062-4D31-11E3-8F59-BFD4058B6BFF'
req.body              = '{"url": "http://domain.com/invoice.html"}'

res = https.request(req)
if res.code == '200'
    pdf_data = res.body
    # - or write to file -
    # File.open('invoice.pdf', 'w') { |file| file.write(res.body) }
end

PS: Prices are subject to change. During the beta you can’t use your own credit card for payments since we’re still running in sandbox mode. All data will be wiped after the beta ends. Expected launch date will be some time in January 2014.