up

pageTrap converts HTML to PDF or Image files online.

Base Options
Key - User Identifier Key.
JSON - Return a JSON object containing a url to the pdf on success.
Advanced Options
FileName - Desired output filename.
Delay - Wait N milliseconds for possible javascript to run.
NoImages - Don't render the images
Zoom - Set the zoom factor of the source (1.0 means 100%).
PDF Options
PageSize - Size of output page
Orientation - Portrait or Landscape
NoBackground - Don't render the background
MarginTop - Top margin in millimetres
MarginBottom - Bottom margin in millimetres
MarginLeft - Left margin in millimetres
MarginRight - Right margin in millimetres
Grayscale - Whether you want to render your PDF in grayscale
PrintMedia - Use print media-type style instead of screen.
Title - The title of the generated PDF document.
NoBookmarks - Create PDF without bookmarks.
HeaderURL - URL of header content.
HeaderSpace - Space between header and content in mm.
FooterURL - URL of footer content.
FooterSpace - Space between footer and content in mm.
Image Options
ImageFormat - Format to output the image.
ImageWidth - Attempt to output an image of the specified width.
ImageHeight - Attempt to output an image of the specified height.
jSelector - Pick an element to exclusively render with a jQuery selector string.
BackgroundTransparent - Make the background transparent for PNG images.


Examples

pageTrap is a web service that converts a URL or HTML to a PDF or an Image. It quickly and accurately renders HTML to your chosen format and returns the result to you.

Some practical examples of what pageTrap can be used for are:

  • Easily generate PDF reports; newsletters; catalogues; etc.
  • Produce redistributable PDF documents
  • Capture preview images of webpages
  • Preserve live page states

You may wish to use pageTrap via the simple tool on this page, or if you're a developer you can achieve large-scale operations for your website or application using the buttons below or through our API.

   pageTrap's service can be utilized from within your own website via a simple link or button. When these buttons are clicked, the URL of the page that they're on is converted.

Preview:
Copy and paste this HTML code for the large button:
<iframe src="//pagetrap.com/button/?style=large&type=pdf" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:64px; height:64px;" allowTransparency="true"></iframe>
Or this for the small one:
<iframe src="//pagetrap.com/button/?style=small&type=pdf" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:32px; height:32px;" allowTransparency="true"></iframe>
Preview:
Copy and paste this HTML code for the large button:
<iframe src="//pagetrap.com/button/?style=large&type=image" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:64px; height:64px;" allowTransparency="true"></iframe>
Or this for the small one:
<iframe src="//pagetrap.com/button/?style=small&type=image" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:32px; height:32px;" allowTransparency="true"></iframe>
If you use Chrome you can download our plugin:
Extension
Drag pageTrapPDFlet or pageTrapImagelet into your bookmarks bar enabling quick one-click access to convert your current webpage.
If you want to create your own button it's easy with our API:
or
Convert this page to PDF
<!--HTML-->
<form method="post" action="http://pagetrap.com/API/PDF/" target="_blank">
    <input name="url" id="url" type="hidden" value="" />
    <input type="submit" value="Convert to PDF" onclick="$('#url').val(window.location);" />   
</form>

When you become a member with pageTrap you are given an API Key and 25 credits for free.

Your API Key, used as a parameter itself, lets you use the member options/parameters that can be accessed via the tool at the top of the page (if you're logged in), or through direct calls to the API.

When you use pageTrap with your API Key the pageTrap logo will be removed from the result and your credits will be subtracted.

You will be subtracted 1 credit for each 0.5MB in a conversion, rounded up.

If your credits run out requests using your API Key will not work.


Below are some demonstrations of how to implement pageTrap, via our API:

  If you wish to have more control over the result, then pageTrap can return a JSON object containing a path to the converted file on our server that will stay active for 24 hours.

//jQuery with JSON
$.ajax({
    type: 'POST',
    dataType: 'text', /*won't return json object if errors*/
    url: 'http://pagetrap.com/API/PDF/',
    data: 'JSON=true&URL=www.google.com',
    success: function (data) {
        var jso = JSON.parse(data);
        var link = jso.path;
        var name = jso.filename;
        var size = jso.filesize;
        var timetaken = jso.timetaken;
        //do what you like with these variables
    }
});

  Of course you'll probably want to do this from the server:

//C#
using (WebClient client = new WebClient())
{
    NameValueCollection nvc = new NameValueCollection();
    nvc.Add("URL", "www.google.com");
    byte[] response = client.UploadValues('http://pagetrap.com/API/PDF/', nvc);
    //do what you want with response
}
||CURL
curl http://pagetrap.com/API/PDF/ -d"url=www.google.com"

  pageTrap not only outputs PDF files, but Images too. This allows for things like a 'preview' effect:

//jQuery
$('#bootstrapElement').popover({
    trigger: 'hover',
    html: true,
    content: function () {
        $.ajax({
            type: 'POST',
            dataType: 'json',
            contentType: "application/json; charset=utf-8",
            url: 'Member.aspx/GetScreenshot', //source call handled server side
            success: function (data) { 
                $('#bootstrapElementSource').html('<img src="' + JSON.parse(data.d).path + '"/>');
            }
        });
        return $('#bootstrapElementSource').html();
    }
});
    
//C#
[WebMethod]
public static string GetScreenshot()
{
    WebClient wc = new WebClient();
    NameValueCollection nvc = new NameValueCollection();
    nvc.Add("URL", "https://pagetrap.com/");
    nvc.Add("JSON", "true");
    nvc.Add("ImageWidth", "512"); /*won't work without a membership*/
    nvc.Add("ImageHeight", "512");
    nvc.Add("Key", /*your private key*/);
    byte[] res = wc.UploadValues("https://pagetrap.com/api/image/", nvc);
    return Encoding.Default.GetString(res);
}

pageTrap's API is very simple. You just make a request to one of these two endpoints:

http://pagetrap.com/api/image/

or

http://pagetrap.com/api/pdf/

The API endpoints support both http: and https: protocols.

Make POST requests with the below parameters as your data.

These parameters are available only to members (users of an API Key).

However URL HTML Key JSON are free and will work without an API Key.

Parameter Name Type Options Description Modes
Base Options
URLStringN/AURL to convert.PDF, Image
HTMLStringN/AHTML to convert.PDF, Image
KeyStringN/AUser Identifier Key.PDF, Image
JSONBooleanN/AReturn a JSON object containing a url to the pdf on success.PDF, Image
Advanced Options
FileNameStringN/ADesired output filename.PDF, Image
DelayUnitN/AWait N milliseconds for possible javascript to run.PDF, Image
NoImagesBooleanN/ADon't render the imagesPDF, Image
ZoomFloatN/ASet the zoom factor of the source (1.0 means 100%).PDF, Image
PDF Options
PageSizeEnumA0; A1; A2; A3; A4; A5; A6; Letter; Legal; Tabloid; Executive; DLESize of output pagePDF
OrientationEnumPortrait; LandscapePortrait or LandscapePDF
NoBackgroundBooleanN/ADon't render the backgroundPDF
MarginTopUnitN/ATop margin in millimetresPDF
MarginBottomUnitN/ABottom margin in millimetresPDF
MarginLeftUnitN/ALeft margin in millimetresPDF
MarginRightUnitN/ARight margin in millimetresPDF
GrayscaleBooleanN/AWhether you want to render your PDF in grayscalePDF
PrintMediaBooleanN/AUse print media-type style instead of screen.PDF
TitleStringN/AThe title of the generated PDF document.PDF
NoBookmarksBooleanN/ACreate PDF without bookmarks.PDF
HeaderURLStringN/AURL of header content.PDF
HeaderSpaceUnitN/ASpace between header and content in mm.PDF
FooterURLStringN/AURL of footer content.PDF
FooterSpaceUnitN/ASpace between footer and content in mm.PDF
Image Options
ImageFormatEnumjpg; pngFormat to output the image.Image
ImageWidthUnitN/AAttempt to output an image of the specified width.Image
ImageHeightUnitN/AAttempt to output an image of the specified height.Image
jSelectorStringN/APick an element to exclusively render with a jQuery selector string.Image
BackgroundTransparentBooleanN/AMake the background transparent for PNG images.Image

If you do not use the JSON parameter in your request, then pageTrap will return the resultant file in its response.

If you do use JSON a successful request will return a JSON result containing a path to the result.

The string-pairs returned look like this:

{
    "path":"https://pagetrap.com/Out/d4pagetrap_com.JPG", /*will remain on server for 24 hours*/
    "timetaken":"3306",  /*milliseconds*/
    "filename":"pagetrap_com.JPG", /*friendly filename, may be different to path's filename*/
    "filesize":"763553", /*bytes*/
    "creditsused":"2" /*only returned if an API Key is used*/
}

Possible response codes:

Code Meaning Description
200 Success
501 Unavailable If POST method was not used; Or if API paths used incorrectly.
500 Error The reason will be written to the page in plain text.
429 Deny The reason will be written to the page in plain text.
402 No Credit If the user's account associated with the used API Key has insufficient credits remaining.
408 Timeout
403 Bad Inputs Invalid parameter inputs. The reason will be written to the page in plain text.


Membership

Using pageTrap is free, however access to many additional conversion options is unavailable and the conversions will have a small pageTrap logo on them. to unlock these features.

When you become a member of pageTrap you will receive an API Key and 25 free credits allowing you to fully utilize the service, be that with the tool at the top of this page, on your own website or application through our API, or however you wish. It also means you can make use of many additional parameters to control the format and remove the pageTrap branding from the output. 1 credit is subtracted from your account for each 0.5MB in a conversion, rounded up.

now or login via Facebook or Google to receive 25 free credits.


Lite
US$9.00 Monthly
  • 300 Credits
  • Expires Monthly
  • Remove Logo
  • Unlock Options
Purchase
Average
US$29.00 Monthly
  • 5000 Credits
  • Expires Monthly
  • Remove Logo
  • Unlock Options
Purchase
Unlimited
US$59.00 Monthly
  • Unlimited Credits
  • Expires Monthly
  • Remove Logo
  • Unlock Options
Purchase
Extra
US$15.00 Never Expires
  • 750 Credits
  • Never Expires
  • Remove Logo
  • Unlock Options
Purchase

Buy now with PayPal

Login to your account

Invalid Email Address
Required
Email and/or Password incorrect

Don't have an account?