Outils pour capturer et convertir le Web

Comment créer des documents DOCX et PDF avec des formats de page personnalisés?

Par défaut, les documents DOCX et PDF utilisent le format de page A4, tandis que les autres formats de page standard, tels que A3 et B4, sont également pris en charge. Cependant, GrabzIt permet également aux développeurs d’utiliser des tailles de page entièrement personnalisées. Pour créer un format de page personnalisé, spécifiez simplement le format de la largeur et de la hauteur de la page en millimètres (mm), avec une taille de page minimale de 15 mm.

Format de page PDF personnalisé

Les exemples ci-dessous montrent comment créer une taille de page PDF personnalisée de 150mm by 150mm pour chaque langage de programmation pris en charge actuellement.

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.spacex.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.spacex.com", options);
grabzIt.Save("http://www.mywebsite.com/handler");
<script src="https://cdn.jsdelivr.net/npm/@grabzit/js@3.3.7/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")
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")

Format de page personnalisé DOCX

Les formats de page personnalisés pour DOCX peuvent être générés de la même manière que pour PDF dans les exemples ci-dessus. Là encore, un format de page personnalisé de 150mm by 150mm a été utilisé.

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.spacex.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.spacex.com", options);
grabzIt.Save("http://www.mywebsite.com/handler");
<script src="https://cdn.jsdelivr.net/npm/@grabzit/js@3.3.7/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")
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")