Files
crm.clientright.ru/aiform_dev2/docs/BROWSERLESS_CURL_EXAMPLE.sh
Fedor 01c4fe80b5 chore: snapshot current working tree changes
Save all currently accumulated repository changes as a backup snapshot for Gitea so no local work is lost.
2026-03-26 14:19:01 +03:00

69 lines
2.2 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# ============================================================================
# Пример curl запроса для Browserless (HTML → PDF)
# Используйте этот запрос в HTTP Request ноде n8n
# ============================================================================
# ВАРИАНТ 1: С data URL (HTML в base64)
curl -X POST http://147.45.146.17:3000/pdf \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_TOKEN" \
-d '{
"url": "data:text/html;base64,PCFET0NUWVBFIGh0bWw+PGh0bWw+PGJvZHk+PGgxPlRlc3Q8L2gxPjwvYm9keT48L2h0bWw+",
"options": {
"format": "A4",
"printBackground": true,
"margin": {
"top": "20mm",
"right": "15mm",
"bottom": "20mm",
"left": "15mm"
}
}
}'
# ============================================================================
# ВАРИАНТ 2: С прямым HTML (если Browserless поддерживает)
# ============================================================================
# curl -X POST http://147.45.146.17:3000/pdf \
# -H "Content-Type: application/json" \
# -H "Authorization: Bearer YOUR_TOKEN" \
# -d '{
# "html": "<!DOCTYPE html><html><body><h1>Test</h1></body></html>",
# "options": {
# "format": "A4",
# "printBackground": true,
# "margin": {
# "top": "20mm",
# "right": "15mm",
# "bottom": "20mm",
# "left": "15mm"
# }
# }
# }'
# ============================================================================
# НАСТРОЙКА В HTTP REQUEST НОДЕ:
# ============================================================================
# Method: POST
# URL: http://147.45.146.17:3000/pdf
# Headers:
# Content-Type: application/json
# Authorization: Bearer YOUR_TOKEN (если требуется)
# Body (JSON):
# {
# "url": "data:text/html;base64,{{ $json.html_base64_encoded }}",
# "options": {
# "format": "A4",
# "printBackground": true,
# "margin": {
# "top": "20mm",
# "right": "15mm",
# "bottom": "20mm",
# "left": "15mm"
# }
# }
# }
# Response Format: Binary
# ============================================================================