Preview Generator
Generates preview image for HTML
- Author: frappe
- Repository: https://github.com/frappe/preview_generator
- GitHub stars: 21
- Forks: 16
- License: MIT
- Category: Developer Tools
- Maintenance: Actively Maintained
- Frappe versions: develop
Install Preview Generator
bench get-app https://github.com/frappe/preview_generator
Add the Frappe Gems badge to your README
Maintain Preview Generator? Paste this into your README:
[](https://frappegems.com/gems/apps/frappe/preview_generator)
About Preview Generator
# Preview Generator
Generate a rendered HTML preview image from a website URL or HTML snippet.
## Installation
Install this app using the [bench](https://github.com/frappe/bench) CLI:
```bash
cd $PATH_TO_YOUR_BENCH
bench get-app $URL_OF_THIS_REPO --branch develop
bench install-app preview_generator
```
You might need to install Playwright for the app to work. You can do this by running the following commands:
```
source $PATH_TO_YOUR_BENCH/env/bin/activate
playwright install
```
## Usage
### Generate Preview of a URL
Make a POST request to `/api/method/preview_generator.api.generate_preview_from_url` with the following parameters:
```js
{
"url": "https://www.example.com", // URL of the webpage for which you want to genetate a preview
"wait_for": 5000, // In milliseconds, optional, default is 0
"headers": {}, // Optional, headers to be provided when visiting the URL
"format": "webp" // Optional, default is "jpg"
}
```
**Note:** The URL passed should be publicly accessible.
### Generate Preview of HTML Content
Make a POST request to `/api/method/preview_generator.api.generate_preview` with the following parameters:
```js
{
"html": "
Hello World
", // Your HTML content "format": "webp" // Optional, default is "jpg" } ``` This will return a preview image. ## License MIT LicenseRelated Developer Tools apps for Frappe & ERPNext
- Frappe — Low code web framework for real world applications, in Python and Javascript
- Frappe Docker — Docker environment for developing, deploying, and running Frappe applications (ERPNext and custom apps) in production and development
- Builder — Craft beautiful websites effortlessly with an intuitive visual builder and publish them instantly
- Bench — CLI to manage Multi-tenant deployments for Frappe apps
- Frappe Ui — A set of components and utilities for rapid UI development
- Press — Full service cloud hosting for the Frappe stack - powers Frappe Cloud
- Gameplan — Open Source Discussions Platform for Remote Teams
- Doppio — A Frappe app (CLI) to magically setup single page applications and Vue/React powered desk pages on your custom Frappe apps.