Tools to Capture and Convert the Web

How to create DOCX and PDF documents with custom page sizes?

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.

PDF Custom Page Size

The examples below show how to create a custom PDF page size of 150mm by 150mm for every programming language we currently support.

GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret");
PDFOptions options = new PDFOptions();
options.PageWidth = 150;
options.PageHeight = 150;
grabzIt.URLToPDF("http://www.google.com", options);
grabzIt.Save("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.google.com", options);
grabzIt.Save("http://www.mywebsite.com/handler");
<script src="https://cdn.jsdelivr.net/gh/GrabzIt/grabzit@js-3.2.9.9/javascript/grabzit.min.js"></script>
<script>
GrabzIt("Sign in to view your Application Key").ConvertURL("http://www.google.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.google.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.google.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.google.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.google.com", options)
grabzIt.Save("http://www.mywebsite.com/handler.py")
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.google.com", options)
grabzIt.save("http://www.mywebsite.com/handler/index")

DOCX Custom Page Size

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.

GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret");
DOCXOptions options = new DOCXOptions();
options.PageWidth = 150;
options.PageHeight = 150;
grabzIt.URLToDOCX("http://www.google.com", options);
grabzIt.Save("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.google.com", options);
grabzIt.Save("http://www.mywebsite.com/handler");
<script src="https://cdn.jsdelivr.net/gh/GrabzIt/grabzit@js-3.2.9.9/javascript/grabzit.min.js"></script>
<script>
GrabzIt("Sign in to view your Application Key").ConvertURL("http://www.google.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.google.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.google.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.google.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.google.com", options)
grabzIt.Save("http://www.mywebsite.com/handler.py")
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.google.com", options)
grabzIt.save("http://www.mywebsite.com/handler/index")
Back to Support
Try all our premium features for free with a 7 day free trial. Then from $5.99 a month, unless cancelled.
  • More Captures
  • More Features
  • More API's
  • Bigger Scrapes
  • Bigger Captures
  • Bigger Everything
Start Free Trial