ScriptX.Cloud

HTML to PDF service

ScriptX.Cloud allows the easy conversion of any web page into a printable PDF or XPS via the click of a button.

ScriptX.Cloud HTML to PDF converter functionality for your website

Brilliant for testing and evaluation of ScriptX.Services

Our FREE cloud service provides ‘save webpage as pdf’ for ‘printing’ to a PDF or XPS format file which is downloaded by the user. They may open, save or print the file – this as an easy way to provide a “download this page as a PDF/XPS document” facility on your website. The cloud service is frictionless. There is nothing for your users to install, but they must have JavaScript enabled in their browser. They could be using any modern browser on any internet-connected device, from desktop PC to tablet or smartphone. This html pdf JavaScript service is available now at no cost but is subject to a fair-use policy. Click here to sign up for your free cloud service account.

ScriptX.Cloud Features

Output HTML to print ready PDF

Control margins and orientation

Set headers and footers

Try it now

Click the button to receive a PDF conversion of this web page. This example is simple but the margins, the page header and footer and the paper orientation have all been described in JavaScript. CSS has been used to remove some content for the print and to layout the content appropriately. Notice the date and time in the PDF headers and footers – the PDF was produced right now; it isn’t a canned file. You will receive a PDF file – the output from our cloud service `printing` using a print to PDF print driver.

FREE Cloud service license

Give it a try! You can always upgrade your license later to print to printers and devices on your own premises.

How to use ScriptX.Cloud

Implementing save webpage as pdf with ScriptX.Cloud couldn’t be easier.

Once you have verified your free subscription, follow this simple guide to be up and running quickly. This is a basic guide; in-depth walk-through can be found here.

Add these JavaScript modules to the page:

				
					<script src="~/Scripts/jquery-3.1.1.js"></script>
<script src="/scripts/MeadCo.ScriptX/core.js"></script>
<script src="/scripts/MeadCo.ScriptX/scriptxprint.js"></script>
<script src="/scripts/MeadCo.ScriptX/scriptxprinthtml.js"></script>

				
			

The whole of MeadCo.ScriptX.Print.HTML is now available to the page and must be configured with:

				
					MeadCo.ScriptX.Print.HTML.connect(
    "https://scriptxservices.meadroid.com/api/v1/printHtml",
    "{replace-withyour-subsription-id}"
);

				
			

A UI is now needed for the user to click/touch, a button in standard html styled with some Bootstrap css and Font Awesome:

				
					<button type="button" class="btn btn-primary d-print-none" id="btn_printPage">
    <i class="fas fa-cloud-download-alt"></i>  Download as PDF
</button>

				
			

We need some code to set the desired properties and print the page:

				
					function printPage() {
    var settings = MeadCo.ScriptX.Print.HTML.settings;
    settings.header = "ScriptX.Services :: Browser Agnostic Printing";
    settings.footer = "&D&b&p of &P&b&t";
    settings.page.orientation =
    MeadCo.ScriptX.Print.HTML.PageOrientation.PORTRAIT;
     
    var margins = settings.page.margins;
    margins.left = 12.5;
    margins.top = 12.5;
    margins.bottom = 12.5;
    margins.right = 12.5;
     
    MeadCo.ScriptX.Print.HTML.printDocument(true);
});

				
			

And lastly, we handle the click event on the button to do the print:

				
					document.getElementById("btn_printPage")
    .addEventListener("click",function(event) {
    printPage();
})

				
			

Need greater print control?

Try ScriptX.Services instead

ScriptX.Services is an evolution that provides developers with the tools they need to ensure the consistent formatting and appearance of printed content. We promise you’ll love it, and with an immediate sixty-day license there’s nothing to lose.