Get a Free Trial

Merge many web pages or HTML into a PDF or DOCXMerge PDF or DOCX files

Any PDF's created with our API can easily be merged together into a combined PDF. Also Word documents created with our API can also be merged together into a single DOCX document, which is useful if you want to create a book type document. But of course you can't merge PDF and DOCX documents together!

To merge a document just pass the ID of the document you want to merge a document with in the mergeid parameter, the new document will then be appended to the existing document. The ID of a document is returned when it is created by calling the save method of the API.

Merge a batch of PDF's

The following examples shows how to convert three web pages into three separate PDF documents, before merging them into one.

//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();
grabzIt.URLToPDF("http://www.example.com/page1.html"); 
options.MergeId = await grabzIt.SaveAsync();
grabzIt.URLToPDF("http://www.example.com/page2.html", options); 
options.MergeId = await grabzIt.SaveAsync();
grabzIt.URLToPDF("http://www.example.com/page3.html", options); 
await grabzIt.SaveToAsync("documents/result.pdf");
GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret");
PDFOptions options = new PDFOptions();
grabzIt.URLToPDF("http://www.example.com/page1.html"); 
options.setMergeId(grabzIt.Save());
grabzIt.URLToPDF("http://www.example.com/page2.html", options); 
options.setMergeId(grabzIt.Save());
grabzIt.URLToPDF("http://www.example.com/page3.html", options); 
grabzIt.SaveTo("documents/result.pdf");
<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.example.com/page1.html",
{"format": "pdf", "onfinish": function(id){
    GrabzIt("Sign in to view your Application Key").ConvertURL("http://www.example.com/page2.html",
    {"mergeid": id, "format": "pdf", "onfinish": function(id){
        GrabzIt("Sign in to view your Application Key").ConvertURL("http://www.example.com/page3.html",
        {"mergeid": id, "format": "pdf"}).Create();
    }}).CreateInvisible();
}}).CreateInvisible ();
</script>
var grabzit = require('grabzit');

var client = new grabzit("Sign in to view your Application Key", "Sign in to view your Application Secret");
client.url_to_pdf("http://www.example.com/page1.html");
client.save(null, function (err, id){
    if (err != null){
        throw err;
    }
    client.url_to_pdf("http://www.example.com/page2.html",{"mergeId":id});
    client.save(null, function (err, id){
        if (err != null){
            throw err;
        }
        client.url_to_pdf("http://www.example.com/page3.html",{"mergeId":id});
        client.save_to("documents/result.pdf")
    });
});
#!/usr/bin/perl

use GrabzItClient;

$grabzIt = GrabzItClient->new("Sign in to view your Application Key", "Sign in to view your Application Secret");
$options = GrabzItPDFOptions->new();
$grabzIt->URLToPDF("http://www.example.com/page1.html");
$options->mergeId($grabzIt->Save());
$grabzIt->URLToPDF("http://www.example.com/page2.html", $options);
$options->mergeId($grabzIt->Save());
$grabzIt->URLToPDF("http://www.example.com/page3.html", $options);
$grabzIt->SaveTo("documents/result.pdf");
include("GrabzItClient.php");

$grabzIt = new \GrabzIt\GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret");
$options = new \GrabzIt\GrabzItPDFOptions();
$grabzIt->URLToPDF("http://www.example.com/page1.html");
$options->setMergeId($grabzIt->Save());
$grabzIt->URLToPDF("http://www.example.com/page2.html", $options);
$options->setMergeId($grabzIt->Save());
$grabzIt->URLToPDF("http://www.example.com/page3.html", $options);
$grabzIt->SaveTo("documents/result.pdf");
from GrabzIt import GrabzItClient
from GrabzIt import GrabzItPDFOptions

grabzIt = GrabzItClient.GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret")
options = GrabzItPDFOptions.GrabzItPDFOptions()
grabzIt.URLToPDF("http://www.example.com/page1.html") 
options.mergeId = grabzIt.Save()
grabzIt.URLToPDF("http://www.example.com/page2.html", options) 
options.mergeId = grabzIt.Save() 
grabzIt.URLToPDF("http://www.example.com/page3.html", options) 
grabzIt.SaveTo("documents/result.pdf") 
require 'grabzit'

grabzItClient = GrabzIt::Client.new("Sign in to view your Application Key", "Sign in to view your Application Secret")
options = GrabzIt::PDFOptions.new()
grabzItClient.url_to_pdf("http://www.example.com/page1.html")	
options.mergeId = grabzItClient.save() 	
grabzItClient.url_to_pdf("http://www.example.com/page2.html", options)	
options.mergeId = grabzItClient.save() 
grabzItClient.url_to_pdf("http://www.example.com/page3.html", options)	
grabzItClient.save_to("documents/result.pdf") 

Merge a batch of Word Documents

The following examples shows how to convert three web pages into three separate Word documents, before merging them into a single DOCX document.

//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();
grabzIt.URLToDOCX("http://www.example.com/page1.html"); 
options.MergeId = await grabzIt.SaveAsync();
grabzIt.URLToDOCX("http://www.example.com/page2.html", options); 
options.MergeId = await grabzIt.SaveAsync();
grabzIt.URLToDOCX("http://www.example.com/page3.html", options); 
await grabzIt.SaveToAsync("documents/result.docx");
GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret");
DOCXOptions options = new DOCXOptions();
grabzIt.URLToDOCX("http://www.example.com/page1.html"); 
options.setMergeId(grabzIt.Save());
grabzIt.URLToDOCX("http://www.example.com/page2.html", options); 
options.setMergeId(grabzIt.Save());
grabzIt.URLToDOCX("http://www.example.com/page3.html", options); 
grabzIt.SaveTo("documents/result.docx");
<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.example.com/page1.html",
{"format": "docx", "onfinish": function(id){
    GrabzIt("Sign in to view your Application Key").ConvertURL("http://www.example.com/page2.html",
    {"mergeid": id, "format": "docx", "onfinish": function(id){
        GrabzIt("Sign in to view your Application Key").ConvertURL("http://www.example.com/page3.html",
        {"mergeid": id, "format": "docx"}).Create();
    }}).CreateInvisible();
}}).CreateInvisible ();
</script>
var grabzit = require('grabzit');

var client = new grabzit("Sign in to view your Application Key", "Sign in to view your Application Secret");
client.url_to_docx("http://www.example.com/page1.html");
client.save(null, function (err, id){
    if (err != null){
        throw err;
    }
    client.url_to_docx("http://www.example.com/page2.html",{"mergeId":id});
    client.save(null, function (err, id){
        if (err != null){
            throw err;
        }
        client.url_to_docx("http://www.example.com/page3.html",{"mergeId":id});
        client.save_to("documents/result.docx")
    });
});
#!/usr/bin/perl

use GrabzItClient;

$grabzIt = GrabzItClient->new("Sign in to view your Application Key", "Sign in to view your Application Secret");
$options = GrabzItDOCXOptions->new();
$grabzIt->URLToDOCX("http://www.example.com/page1.html");
$options->mergeId($grabzIt->Save());
$grabzIt->URLToDOCX("http://www.example.com/page2.html", $options);
$options->mergeId($grabzIt->Save());
$grabzIt->URLToDOCX("http://www.example.com/page3.html", $options);
$grabzIt->SaveTo("documents/result.docx");
include("GrabzItClient.php");

$grabzIt = new \GrabzIt\GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret");
$options = new \GrabzIt\GrabzItDOCXOptions();
$grabzIt->URLToDOCX("http://www.example.com/page1.html");
$options->setMergeId($grabzIt->Save());
$grabzIt->URLToDOCX("http://www.example.com/page2.html", $options);
$options->setMergeId($grabzIt->Save());
$grabzIt->URLToDOCX("http://www.example.com/page3.html", $options);
$grabzIt->SaveTo("documents/result.docx");
from GrabzIt import GrabzItClient
from GrabzIt import GrabzItDOCXOptions

grabzIt = GrabzItClient.GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret")
options = GrabzItDOCXOptions.GrabzItDOCXOptions()
grabzIt.URLToDOCX("http://www.example.com/page1.html") 
options.mergeId = grabzIt.Save()
grabzIt.URLToDOCX("http://www.example.com/page2.html", options) 
options.mergeId = grabzIt.Save() 
grabzIt.URLToDOCX("http://www.example.com/page3.html", options) 
grabzIt.SaveTo("documents/result.docx") 
require 'grabzit'

grabzItClient = GrabzIt::Client.new("Sign in to view your Application Key", "Sign in to view your Application Secret")
options = GrabzIt::DOCXOptions.new()
grabzItClient.url_to_docx("http://www.example.com/page1.html")	
options.mergeId = grabzItClient.save() 	
grabzItClient.url_to_docx("http://www.example.com/page2.html", options)	
options.mergeId = grabzItClient.save() 
grabzItClient.url_to_docx("http://www.example.com/page3.html", options)	
grabzItClient.save_to("documents/result.docx") 

Merge Documents using a Web Scraper

GrabzIt's Web Scraper offers a streamlined way to merge documents. We've simplified the process with ready-made templates for PDF and DOCX merging. These scrapes may involve creating temporary files to facilitate the merging of content, the largest document is the finished document.