By default both DOCX and PDF documents use the A4 page size, while other standard pages sizes such as a A3 and B4 are also supported. However GrabzIt also allows developers to use completely customized page sizes as well. To create a custom page size just specify the size of the page width and height in millimetres (mm), with a minimum page size of 15 mm.
The examples below show how to create a custom PDF page size of 150mm by 150mm for every programming language we currently support. The custom page size for PDF also supports full page length, which is were the page length matches the size of the web page, to do this just pass a -1 to the page height.
//The client should be stored somewhere and reused! GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret", client); PDFOptions options = new PDFOptions(); options.PageWidth = 150; options.PageHeight = 150; grabzIt.URLToPDF("http://www.spacex.com", options); await grabzIt.SaveAsync("http://www.mywebsite.com/Home/Handler");
GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret"); PDFOptions options = new PDFOptions(); options.setPageWidth(150); options.setPageHeight(150); grabzIt.URLToPDF("http://www.spacex.com", options); grabzIt.Save("http://www.mywebsite.com/handler");
<script src="https://cdn.jsdelivr.net/npm/@grabzit/js@3.5.2/grabzit.min.js"></script>
<script>
GrabzIt("Sign in to view your Application Key").ConvertURL("http://www.spacex.com",
{"format": "pdf", "download": 1, "height": 150, "width": 150}).Create();
</script>
var grabzit = require('grabzit'); var client = new grabzit("Sign in to view your Application Key", "Sign in to view your Application Secret"); var options = {"pageWidth":150,"pageHeight":150}; client.url_to_pdf("http://www.spacex.com", options); client.save("http://www.example.com/handler", function (error, id){ if (error != null){ throw error; } });
$grabzIt = GrabzItClient->new("Sign in to view your Application Key", "Sign in to view your Application Secret"); $options = GrabzItPDFOptions->new(); $options->pageWidth(150); $options->pageHeight(150); $grabzIt->URLToPDF("http://www.spacex.com", $options); $grabzIt->Save("http://www.mywebsite.com/handler.pl");
$grabzIt = new \GrabzIt\GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret"); $options = new \GrabzIt\GrabzItPDFOptions(); $options->setPageWidth(150); $options->setPageHeight(150); $grabzIt->URLToPDF("http://www.spacex.com", $options); $grabzIt->Save("http://www.mywebsite.com/handler.php");
grabzIt = GrabzItClient.GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret") options = GrabzItPDFOptions.GrabzItPDFOptions() options.pageWidth = 150 options.pageHeight = 150 grabzIt.URLToPDF("http://www.spacex.com", options) grabzIt.Save("http://www.mywebsite.com/handler.py")
https://api.grabz.it/convert?key=Sign in to view your Application Key&format=pdf&height=150&width=150&url=https%3A%2F%2Fspacex.com%2F
grabzIt = GrabzIt::Client.new("Sign in to view your Application Key", "Sign in to view your Application Secret") options = GrabzIt::PDFOptions.new() options.pageWidth = 150 options.pageHeigh = 150 grabzIt.url_to_pdf("http://www.spacex.com", options) grabzIt.save("http://www.mywebsite.com/handler/index")
Custom page sizes for DOCX can be generated in a similar way as for PDF in the above examples. Again a custom page size of 150mm by 150mm has been used.
//The client should be stored somewhere and reused! GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret", client); DOCXOptions options = new DOCXOptions(); options.PageWidth = 150; options.PageHeight = 150; grabzIt.URLToDOCX("http://www.spacex.com", options); await grabzIt.SaveAsync("http://www.mywebsite.com/Home/Handler");
GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret"); DOCXOptions options = new DOCXOptions(); options.setPageWidth(150); options.setPageHeight(150); grabzIt.URLToDOCX("http://www.spacex.com", options); grabzIt.Save("http://www.mywebsite.com/handler");
<script src="https://cdn.jsdelivr.net/npm/@grabzit/js@3.5.2/grabzit.min.js"></script>
<script>
GrabzIt("Sign in to view your Application Key").ConvertURL("http://www.spacex.com",
{"format": "docx", "download": 1, "height": 150, "width": 150}).Create();
</script>
var grabzit = require('grabzit'); var client = new grabzit("Sign in to view your Application Key", "Sign in to view your Application Secret"); var options = {"pageWidth":150,"pageHeight":150}; client.url_to_docx("http://www.spacex.com", options); client.save("http://www.example.com/handler", function (error, id){ if (error != null){ throw error; } });
$grabzIt = GrabzItClient->new("Sign in to view your Application Key", "Sign in to view your Application Secret"); $options = GrabzItDOCXOptions->new(); $options->pageWidth(150); $options->pageHeight(150); $grabzIt->URLToDOCX("http://www.spacex.com", $options); $grabzIt->Save("http://www.mywebsite.com/handler.pl");
$grabzIt = new \GrabzIt\GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret"); $options = new \GrabzIt\GrabzItDOCXOptions(); $options->setPageWidth(150); $options->setPageHeight(150); $grabzIt->URLToDOCX("http://www.spacex.com", $options); $grabzIt->Save("http://www.mywebsite.com/handler.php");
grabzIt = GrabzItClient.GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret") options = GrabzItDOCXOptions.GrabzItDOCXOptions() options.pageWidth = 150 options.pageHeight = 150 grabzIt.URLToDOCX("http://www.spacex.com", options) grabzIt.Save("http://www.mywebsite.com/handler.py")
https://api.grabz.it/convert?key=Sign in to view your Application Key&format=docx&height=150&width=150&url=https%3A%2F%2Fspacex.com%2F
grabzIt = GrabzIt::Client.new("Sign in to view your Application Key", "Sign in to view your Application Secret") options = GrabzIt::DOCXOptions.new() options.pageWidth = 150 options.pageHeigh = 150 grabzIt.url_to_docx("http://www.spacex.com", options) grabzIt.save("http://www.mywebsite.com/handler/index")