This is an archived forum post. The information may be outdated. Contact us if you have any questions.

Basic help with the HTML to PDF API

Biberkopf wrote on 2016-02-29:
With a few minor edits we've managed to take your PHP example code and get it to generate a two-page PDF in portrait mode. It all works beautifully. Except for the design of the pdf-result. So I think I need som help:

I can see all the nice PHP functions in the documentation - like function setPageWidth($value) - but I have no idea where to insert these function snippets.

Can you help me on the right track. Or point me to a more elaborae example which includes functional adjustment. ?

Biberkopf wrote on 2016-02-29:
We managed to solve this question myself.

If other users should be in the same situation, here's what we did:

We copied the example php-code from here:

and put the page setup functions (page width, height and margins) in my document immediately after the creation of the API client instance, like this:

// create an API client instance
$client = new Pdfcrowd("***", "***");

$client->setPageWidth("297mm"); // <<< this is my addition line
$client->setPageHeight("210mm"); // <<< this is my addition line
$client->setPageMargins("20mm", "20mm", "20mm", "20mm"); // <<< this is my addition line

Good luck!