@@ -12,7 +12,7 @@ Capture a screenshot of a website URL with customizable browser settings and vie
1212
1313{% multicode %}
1414```client-web
15- import { Client, Avatars } from "appwrite";
15+ import { Client, Avatars, Theme } from "appwrite";
1616
1717const client = new Client()
1818 .setEndpoint('https://<REGION>.cloud.appwrite.io/v1')
@@ -24,14 +24,15 @@ const result = avatars.getScreenshot({
2424 url: 'https://example.com',
2525 viewportWidth: 1280,
2626 viewportHeight: 720,
27- theme: 'light' ,
27+ theme: Theme.Light ,
2828 fullpage: false
2929});
3030
3131console.log(result); // Resource URL
3232```
3333```client-flutter
3434import 'package:appwrite/appwrite.dart';
35+ import 'package:appwrite/enums.dart';
3536
3637final client = Client()
3738 .setEndpoint('https://<REGION>.cloud.appwrite.io/v1')
@@ -43,7 +44,7 @@ Future result = avatars.getScreenshot(
4344 url: 'https://example.com',
4445 viewportWidth: 1280,
4546 viewportHeight: 720,
46- theme: ' light' ,
47+ theme: Theme. light,
4748 fullpage: false
4849).then((bytes) {
4950 // Use the screenshot image bytes
@@ -54,6 +55,7 @@ Future result = avatars.getScreenshot(
5455```
5556```client-apple
5657import Appwrite
58+ import AppwriteEnums
5759
5860let client = Client()
5961 .setEndpoint("https://<REGION>.cloud.appwrite.io/v1")
@@ -65,13 +67,14 @@ let byteBuffer = try await avatars.getScreenshot(
6567 url: "https://example.com",
6668 viewportWidth: 1280,
6769 viewportHeight: 720,
68- theme: " light" ,
70+ theme: . light,
6971 fullpage: false
7072)
7173```
7274```client-android-kotlin
7375import io.appwrite.Client
7476import io.appwrite.services.Avatars
77+ import io.appwrite.enums.Theme
7578
7679val client = Client()
7780 .setEndpoint("https://<REGION>.cloud.appwrite.io/v1")
@@ -83,7 +86,7 @@ val result = avatars.getScreenshot(
8386 url = "https://example.com",
8487 viewportWidth = 1280,
8588 viewportHeight = 720,
86- theme = "light" ,
89+ theme = Theme.LIGHT ,
8790 fullpage = false
8891)
8992```
@@ -119,11 +122,11 @@ The `getScreenshot` method accepts the following parameters:
119122| viewportWidth | integer | Browser viewport width in pixels. Accepts values between `1-1920`. Defaults to `1280`. |
120123| viewportHeight | integer | Browser viewport height in pixels. Accepts values between `1-1080`. Defaults to `720`. |
121124| scale | number | Browser scale factor. Accepts values between `0.1-3`. Defaults to `1`. |
122- | theme | string | Browser theme. Accepts `"light"` or `"dark"`. Defaults to `"light"`. |
125+ | theme | string | Browser theme. Accepts `"light"` or `"dark"`. Use `Theme` enum in Web SDK. Defaults to `"light"`. |
123126| userAgent | string | Custom user agent string. Defaults to browser default. |
124127| fullpage | boolean | Capture full page scroll. Pass `true` for full page, `false` for viewport only. Defaults to `false`. |
125128| locale | string | Browser locale (e.g., `"en-US"`, `"fr-FR"`). Defaults to browser default. |
126- | timezone | string | IANA timezone identifier (e.g., `"America/New_York"`, `"Europe/London"`). Defaults to browser default. |
129+ | timezone | string | IANA timezone identifier (e.g., `"America/New_York"`, `"Europe/London"`). Use `Timezone` enum in Web SDK. Defaults to browser default. |
127130| latitude | number | Geolocation latitude. Accepts values between `-90` to `90`. Defaults to `0`. |
128131| longitude | number | Geolocation longitude. Accepts values between `-180` to `180`. Defaults to `0`. |
129132| accuracy | number | Geolocation accuracy in meters. Accepts values between `0` to `100000`. Defaults to `0`. |
@@ -133,7 +136,7 @@ The `getScreenshot` method accepts the following parameters:
133136| width | integer | Output image width in pixels. Pass `0` to use original width, or an integer between `1` to `2000`. Defaults to `0` (original width). |
134137| height | integer | Output image height in pixels. Pass `0` to use original height, or an integer between `1` to `2000`. Defaults to `0` (original height). |
135138| quality | integer | Screenshot quality. Accepts values between `0` to `100`. Defaults to keep existing image quality. |
136- | output | string | Output format type. Accepts `"jpeg"`, `"jpg"`, `"png"`, `"gif"`, or `"webp"`. |
139+ | output | string | Output format type. Accepts `"jpeg"`, `"jpg"`, `"png"`, `"gif"`, or `"webp"`. Use `Output` enum in Web SDK. |
137140
138141# Viewport configuration {% #viewport-configuration %}
139142
@@ -295,55 +298,63 @@ Capture screenshots in light or dark theme to match your application's design or
295298
296299{% multicode %}
297300```client-web
301+ import { Theme } from "appwrite";
302+
298303// Light theme (default)
299304const light = avatars.getScreenshot({
300305 url: 'https://example.com',
301- theme: 'light'
306+ theme: Theme.Light
302307});
303308
304309// Dark theme
305310const dark = avatars.getScreenshot({
306311 url: 'https://example.com',
307- theme: 'dark'
312+ theme: Theme.Dark
308313});
309314```
310315```client-flutter
316+ import 'package:appwrite/enums.dart';
317+
311318// Light theme (default)
312319Future light = avatars.getScreenshot(
313320 url: 'https://example.com',
314- theme: ' light'
321+ theme: Theme. light
315322);
316323
317324// Dark theme
318325Future dark = avatars.getScreenshot(
319326 url: 'https://example.com',
320- theme: ' dark'
327+ theme: Theme. dark
321328);
322329```
323330```client-apple
331+ import AppwriteEnums
332+
324333// Light theme (default)
325334let light = try await avatars.getScreenshot(
326335 url: "https://example.com",
327- theme: " light"
336+ theme: . light
328337)
329338
330339// Dark theme
331340let dark = try await avatars.getScreenshot(
332341 url: "https://example.com",
333- theme: " dark"
342+ theme: . dark
334343)
335344```
336345```client-android-kotlin
346+ import io.appwrite.enums.Theme
347+
337348// Light theme (default)
338349val light = avatars.getScreenshot(
339350 url = "https://example.com",
340- theme = "light"
351+ theme = Theme.LIGHT
341352)
342353
343354// Dark theme
344355val dark = avatars.getScreenshot(
345356 url = "https://example.com",
346- theme = "dark"
357+ theme = Theme.DARK
347358)
348359```
349360{% /multicode %}
@@ -354,6 +365,8 @@ Configure geolocation and locale settings to capture location-specific content o
354365
355366{% multicode %}
356367```client-web
368+ import { Timezone } from "appwrite";
369+
357370// With geolocation
358371const withLocation = avatars.getScreenshot({
359372 url: 'https://example.com',
@@ -367,10 +380,12 @@ const withLocation = avatars.getScreenshot({
367380const localized = avatars.getScreenshot({
368381 url: 'https://example.com',
369382 locale: 'fr-FR',
370- timezone: 'Europe/Paris'
383+ timezone: Timezone.EuropeParis
371384});
372385```
373386```client-flutter
387+ import 'package:appwrite/enums.dart';
388+
374389// With geolocation
375390Future withLocation = avatars.getScreenshot(
376391 url: 'https://example.com',
@@ -384,10 +399,12 @@ Future withLocation = avatars.getScreenshot(
384399Future localized = avatars.getScreenshot(
385400 url: 'https://example.com',
386401 locale: 'fr-FR',
387- timezone: 'Europe/Paris'
402+ timezone: Timezone.europeParis
388403);
389404```
390405```client-apple
406+ import AppwriteEnums
407+
391408// With geolocation
392409let withLocation = try await avatars.getScreenshot(
393410 url: "https://example.com",
@@ -401,10 +418,12 @@ let withLocation = try await avatars.getScreenshot(
401418let localized = try await avatars.getScreenshot(
402419 url: "https://example.com",
403420 locale: "fr-FR",
404- timezone: "Europe/Paris"
421+ timezone: .europeParis
405422)
406423```
407424```client-android-kotlin
425+ import io.appwrite.enums.Timezone
426+
408427// With geolocation
409428val withLocation = avatars.getScreenshot(
410429 url = "https://example.com",
@@ -418,7 +437,7 @@ val withLocation = avatars.getScreenshot(
418437val localized = avatars.getScreenshot(
419438 url = "https://example.com",
420439 locale = "fr-FR",
421- timezone = "Europe/Paris"
440+ timezone = Timezone.EUROPE_PARIS
422441)
423442```
424443{% /multicode %}
@@ -429,6 +448,8 @@ Control the output image size, quality, and format to optimize file size and per
429448
430449{% multicode %}
431450```client-web
451+ import { Output } from "appwrite";
452+
432453// Resize output image
433454const resized = avatars.getScreenshot({
434455 url: 'https://example.com',
@@ -442,17 +463,19 @@ const resized = avatars.getScreenshot({
442463const highQuality = avatars.getScreenshot({
443464 url: 'https://example.com',
444465 quality: 100,
445- output: 'png'
466+ output: Output.Png
446467});
447468
448469// Optimized WebP
449470const webp = avatars.getScreenshot({
450471 url: 'https://example.com',
451472 quality: 85,
452- output: 'webp'
473+ output: Output.Webp
453474});
454475```
455476```client-flutter
477+ import 'package:appwrite/enums.dart';
478+
456479// Resize output image
457480Future resized = avatars.getScreenshot(
458481 url: 'https://example.com',
@@ -466,17 +489,19 @@ Future resized = avatars.getScreenshot(
466489Future highQuality = avatars.getScreenshot(
467490 url: 'https://example.com',
468491 quality: 100,
469- output: ' png'
492+ output: Output. png
470493);
471494
472495// Optimized WebP
473496Future webp = avatars.getScreenshot(
474497 url: 'https://example.com',
475498 quality: 85,
476- output: ' webp'
499+ output: Output. webp
477500);
478501```
479502```client-apple
503+ import AppwriteEnums
504+
480505// Resize output image
481506let resized = try await avatars.getScreenshot(
482507 url: "https://example.com",
@@ -490,17 +515,19 @@ let resized = try await avatars.getScreenshot(
490515let highQuality = try await avatars.getScreenshot(
491516 url: "https://example.com",
492517 quality: 100,
493- output: " png"
518+ output: . png
494519)
495520
496521// Optimized WebP
497522let webp = try await avatars.getScreenshot(
498523 url: "https://example.com",
499524 quality: 85,
500- output: " webp"
525+ output: . webp
501526)
502527```
503528```client-android-kotlin
529+ import io.appwrite.enums.Output
530+
504531// Resize output image
505532val resized = avatars.getScreenshot(
506533 url = "https://example.com",
@@ -514,14 +541,14 @@ val resized = avatars.getScreenshot(
514541val highQuality = avatars.getScreenshot(
515542 url = "https://example.com",
516543 quality = 100,
517- output = "png"
544+ output = Output.PNG
518545)
519546
520547// Optimized WebP
521548val webp = avatars.getScreenshot(
522549 url = "https://example.com",
523550 quality = 85,
524- output = "webp"
551+ output = Output.WEBP
525552)
526553```
527554{% /multicode %}
0 commit comments