LabStack Docs
Login Signup

Webpage PDF

Convert webpage to a PDF

Request

GET https://webpage.labstack.com/api/v1/pdf

Parameter Description Type Required Default
url Webpage URL String Yes
language Language locale for webpage rendering String No en-US
ttl Max number of seconds to cache the webpage Number No 604800
size Page size Size No
width Page width Number No
height Page height Number No
orientation Page orientation Orientation No portrait
delay Number of milliseconds to delay Number No 0

Size

Orientation

curl \
  -X GET https://webpage.labstack.com/api/v1/pdf?url=amazon.com \
  -H 'Authorization: Bearer <API_KEY>'
c := labstack.NewClient("<API_KEY>")
s := c.Webpage()
res, err := s.PDF(&webpage.PDFRequest{
  URL: "amazon.com",
})
if err != nil {
  fmt.Println(err)
}
Client client = new Client("<API_KEY>");
WebpageService service = client.webpage();
try {
  PDFRequest request = PDFRequest.builder().url("http://amazon.com").build();
  PDFResponse response = service.pdf(request);
} catch (LabStackException e) {
  e.printStackTrace();
}
const client = new Client("<API_KEY>")
const service = client.webpage();
try {
  const response = await service.pdf({
    url: "http://twilio.com"
  });
} catch (error) {
  console.error(error);
}
client = Client("<API_KEY>")
service = client.webpage()
try:
  response = service.pdf({
    "url": "http://twilio.com"
  })
except LabStackError as e:
  print(e)

Response

{
  "pdf": "https://webpage.labstack.com/d/1ae894521182719b528d5cce289d65c6.pdf",
  "cached": true,
  "took": 0,
  "generated_at": "2019-07-19T04:41:11+00:00"
}
Parameter Description Type
pdf PDF URL String
cached PDF is cached or not Boolean
took Number of milliseconds took to generate the pdf Number
generated_at Generated timestamp Number