Posted by & filed under HTML to PDF conversion, HTML to PDF SDK.

A few weeks ago we released the newest version of the HTML to PDF SDK. In this post we’ll go into the new features that have been added in this version.

Our PHP SDK already supported a plethora of functions like page formats, margins, encryption, password protection etc. The newest features that now have been added consist of a set of watermarking options.

With this latest version of the SDK you can now:

  • Add your own image as watermark to the PDF
  • Add your own text in a font and size of your choice to the PDF
  • Define the size and location of the watermark
  • Define the angle of rotation of the watermark
  • Define the opacity of the watermark – in case you choose fully opague, you will notice that the watermark looks like a stamp

Watermarking functions

The new watermarking functions that have been added to our PHP library are listed in the table below.

SetWatermarkLocationInput parameters: $x, $y
Indicate where the watermark should start.
Note that the top left of a watermark image will start at this location, whilst this location will indicate the BOTTOM left of a text watermark
SetWatermarkTransformationInput parameters: $angle, $opacity, $scaling_x, $scaling_y
Indicate the rotation in degrees, opacity from 0 to 1 (0 = fully transparant, 1 = fully opague) and scaling (horizontal and vertical) of the watermark
SetWatermarkImageInput parameter: $url
Adds an image as watermark to all the pages of your PDF
SetWatermarkTextInput parameters: $text, $fontname, $color, $fontsize
Adds a text watermark to all the pages of your PDF
You control font name, color and size


The following example code shows how you can watermark your PDFs, by using the newest functions of the HTML to PDF SDK in PHP. If the above list of functions was not enough – this will surely get you going.

$pdf = new Htm2PdfApi ($userid, $apikey); // initialize

$pdf->SetWatermarkLocation(100,100); // put this at position 100,100
$pdf->SetWatermarkTransformation(45,1); // it's at an angle of 45 degrees
// and fully opague (so stamped)
$pdf->SetWatermarkText('SAMPLE','Tahoma','#000000',64); // Print SAMPLE in Tahoma
// use color black, size 64

$pdf->CreateFromURL(''); // do the conversion
$pdf->Display(); // send it to the user as attachment


This hopefully shows you the power of the new watermarking functions in our HTML to PDF SDK. We feel this makes the SDK even more complete than it already was. If you want learn more about this service, then please view the full documentation we have compiled.

If you’re ready to give it a go – please sign up!

3 Responses to “HTML to PDF SDK version 1.4 released”

  1. torty komunijne katowice

    I do agree with all the ideas you have presented in your post. They’re really convincing and will definitely work. Still, the posts are too short for novices. Could you please extend them a little from next time? Thanks for the post.

  2. wycieczka do warszawy 3 dni

    I think what you composed made a ton of sense.
    However, think on this, suppose you added a little information?
    I ain’t saying your information is not solid., but what if you added a post title that makes people want more? I mean HTML to PDF SDK – newest features is a little plain. You might peek at Yahoo’s home page and watch how they
    create post headlines to get viewers to open the links.
    You might add a related video or a related pic or
    two to get readers excited about what you’ve written. In my opinion, it would make your website a little bit more interesting.

  3. Dan

    hey guys, version 1.5 has now been released and offers PDF merging and support for CSS media type ‘print’ and ‘screen’. With the merge functionality you can now create PDFs of different sources and with different layouts combined throughout the PDF like landscape, portrait, different page sizes etc.

Leave a Reply

You must be logged in to post a comment.