Cloudconvert capture-website does not respect zoom or page_width

77 Views Asked by At

To capture more details on a Javascript website I tried increasing page_width/page_heigth or decreasing zoom. Yet I get no change in the resulting jpg file.

API docs
https://cloudconvert.com/api/v2/capture-website#capture-website-tasks

My request looks like:

curl -X POST https://api.cloudconvert.com/v2/capture-website -H Authorization: Bearer xyz -H Content-type: application/json -d '
{
  "url": "https://zyx/",
  "zoom": 0.5,
  "output_format": "jpg"
}
'

The response from the API is:

{
  "data": {
    "id": "xyz",
    "job_id": null,
    "status": "waiting",
    "credits": null,
    "code": null,
    "message": null,
    "percent": 100,
    "operation": "capture-website",
    "engine": "chrome",
    "engine_version": "112",
    "result": null,
    "created_at": "2023-08-18T20:56:56+00:00",
    "started_at": null,
    "ended_at": null,
    "retry_of_task_id": null,
    "copy_of_task_id": null,
    "user_id": 12345,
    "priority": -10,
    "host_name": null,
    "storage": "ceph-fra",
    "depends_on_task_ids": [],
    "links": {
      "self": "https://api.cloudconvert.com/v2/tasks/xyz"
    }
  }
}

Is there a way to capture a larger screen?

2

There are 2 best solutions below

0
Drarig29 On

Well first, I think you should try to contact the support since apparently the zoom feature doesn't work for you.

But in the meantime, what you can try is to use a proxy which adds a style="zoom: 0.5" to the page, so that CloudConvert sees a zoomed out page.

I created an example of such proxy:

https://replit.com/@Drarig29/DezoomOnTheFly

And you can use it like this:

https://dezoomonthefly.drarig29.repl.co/<zoom>/<url>

e.g. https://dezoomonthefly.drarig29.repl.co/0.5/https:/github.com/Drarig29

If that solution works for you, you will have to host it yourself. This replit doesn't run forever, you have to run it manually.

Note: This cannot work in all cases. Some websites use content-security-policy headers for some resources, so those resources will fail to load because of the custom dezoomonthefly.drarig29.repl.co domain. This is normal, and you cannot bypass this security.

0
Ramon Soarez On

In CloudConvert documentation using chrome engine by default and in this engine the zoom parameter doesn't work, you must switch to wkhtml engine in your request. "engine": "wkhtml"

Example:

$ curl -X POST "https://api.cloudconvert.com/v2/jobs" \
    -H "Authorization: Bearer API_KEY" \
    -H "Content-type: application/json" \
    -d '{
    "tasks": {
        "websitetask": {
            "operation": "capture-website",
            "url": "https://api.cloudconvert.com/v2/capture-website",
            "output_format": "jpg",
            "engine": "wkhtml",
            "zoom": 0.5,
            "fit": "max",
            "quality": 80,
            "wait_until": "load",
            "wait_time": 0
        }
    },
    "tag": "jobbuilder"
}' 

You can do other tests directly on the platform in JOB BUILDER it follows link:

https://cloudconvert.com/api/v2/jobs/builder

try it!