=============== LIBRARY RULES =============== From library maintainers: - Send the HTML as a JSON string field named html; pdfOptions is optional - Use preview: true while developing; it is not billed and adds a watermark - Use uploadUrl (a presigned PUT URL) for large PDFs instead of reading the response body - Assets such as CSS, images, and fonts are uploaded per project and referenced by filename ### External Image Reference Source: https://github.com/heap-jp/pdfg-docs/blob/main/docs/en/image.md HTML example showing how to reference an image hosted on the internet using a full URL. ```html External image ``` -------------------------------- ### cURL Request for PDF Generation Source: https://github.com/heap-jp/pdfg-docs/blob/main/docs/en/api.md A cURL request example demonstrating how to specify HTML content and various PDF formatting options, saving the output to sample.pdf. ```bash curl --location 'https://api.pdfg.net/v1' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer YOUR_API_KEY' \ --data '{ "html": "

Hello World

", "pdfOptions": { "displayHeaderFooter": true, "footerTemplate": "
/
", "format": "A4", "headerTemplate": "
Sample Header
", "height": "297mm", "landscape": false, "margin": { "top": "20mm", "right": "20mm", "bottom": "20mm", "left": "20mm" }, "omitBackground": false, "pageRanges": "1-5", "preferCSSPageSize": false, "printBackground": true, "scale": 1, "width": "210mm" } }' \ --output sample.pdf ``` -------------------------------- ### Upload from Dashboard: Basic Image Reference Source: https://github.com/heap-jp/pdfg-docs/blob/main/docs/en/image.md HTML example showing how to reference an uploaded image file (sample.png) in your HTML. Suitable for fixed images like logos. Once uploaded, images can be reused in different PDF generations. ```html Sample image ``` -------------------------------- ### Generate landscape PDF with landscape property Source: https://github.com/heap-jp/pdfg-docs/blob/main/docs/en/page.md Switches the PDF to landscape orientation by setting 'landscape' to true in pdfOptions. The example uses A5 format. ```json { "pdfOptions": { "format": "A5", "landscape": true /* Set to landscape */ }, "html": '

Page

' } ``` -------------------------------- ### Define Jinja2 HTML template for invoice Source: https://github.com/heap-jp/pdfg-docs/blob/main/docs/en/jinja2.md HTML template with Jinja2 syntax for looping over items and displaying a total. Used as the template file 'templates/invoice.html' in the Python example. ```html {# templates/invoice.html #}

Invoice

{% for item in items %} {% endfor %}
Item Amount
{{ item.name }} {{ item.price }} USD

Total: {{ total }} USD

``` -------------------------------- ### Generate A5 PDF with format property Source: https://github.com/heap-jp/pdfg-docs/blob/main/docs/en/page.md Sets the PDF format to A5 (148mm × 210mm) using the 'format' property. The font size is the same as the A3 example, but appears relatively larger due to the smaller page size. ```json { "pdfOptions": { "format": "A5" /* Specify A5 size */ }, "html": '

Page

' } ``` -------------------------------- ### Base64 Encoded Image Source: https://github.com/heap-jp/pdfg-docs/blob/main/docs/en/image.md HTML example showing how to embed a Base64 encoded image directly in the HTML using a data URI. Suitable for dynamically generated images like QR codes or displaying different images per user. ```html Base64 image ``` -------------------------------- ### Automatic page breaks with long text Source: https://github.com/heap-jp/pdfg-docs/blob/main/docs/en/page.md When content exceeds the specified page size, it automatically breaks into multiple pages. This example uses A5 format and long text content. ```json { "pdfOptions": { "format": "A5" }, "html": '

Lorem ipsum dolor sit amet... /* Long text content */

' } ``` -------------------------------- ### Custom page breaks with CSS page sizes Source: https://github.com/heap-jp/pdfg-docs/blob/main/docs/en/page.md Creates page breaks at specific positions by specifying page sizes in CSS. This example uses two div elements set to A4 size with different background colors, and requires 'printBackground' to be true to show the backgrounds. ```json { "pdfOptions": { "format": "A4", /* Specify A4 size */ "printBackground": true /* Required to show background colors */ }, "html": '

Page 1

Page 2

' } ``` -------------------------------- ### Prevent page breaks with explicit width and height Source: https://github.com/heap-jp/pdfg-docs/blob/main/docs/en/page.md Prevents page breaks by explicitly specifying the page size. This example uses A5 width (148mm) and double its height (420mm) to generate a single long PDF. ```json { "pdfOptions": { "width": "148mm", /* A5 width */ "height": "420mm" /* Double A5 height */ }, "html": '

Lorem ipsum dolor sit amet... /* Long text content */

' } ``` -------------------------------- ### Custom font with @font-face in HTML Source: https://github.com/heap-jp/pdfg-docs/blob/main/docs/en/font.md HTML example showing how to specify a custom uploaded font (e.g., Armenian) using @font-face inside a style tag. The font-family name must match the uploaded font, and the src URL points to the uploaded font file. ```html

Բարև աշխարհ

``` -------------------------------- ### Generate PDF from Go template using pdfg API Source: https://github.com/heap-jp/pdfg-docs/blob/main/docs/en/go.md The HTML template defines an invoice layout with Go template actions ({{range .Items}}, {{.Name}}, {{.Price}}, {{.Total}}) to render dynamic data. The Go program parses this template, executes it with invoice data, and sends the resulting HTML to pdfg's API endpoint https://api.pdfg.net/v1 with an Authorization header using YOUR_API_KEY. On a 200 response, it saves the returned PDF to invoice.pdf. ```html

Invoice

{{range .Items}} {{end}}
Item Amount
{{.Name}} {{.Price}} USD

Total: {{.Total}} USD

``` ```go // main.go package main import ( "bytes" "encoding/json" "html/template" "io" "net/http" "os" ) type Item struct { Name string Price int } type Invoice struct { Items []Item Total int } type PdfgRequest struct { HTML string `json:"html"` PdfOptions map[string]interface{} `json:"pdfOptions"` } func main() { // Load template tmpl, err := template.ParseFiles("templates/invoice.html") if err != nil { panic(err) } // Prepare data invoice := Invoice{ Items: []Item{ {Name: "Product A", Price: 1000}, {Name: "Product B", Price: 2000}, }, Total: 3000, } // Generate HTML string var buf bytes.Buffer if err := tmpl.Execute(&buf, invoice); err != nil { panic(err) } // Create request body reqBody := PdfgRequest{ HTML: buf.String(), PdfOptions: map[string]interface{}{ "format": "A4", }, } jsonData, err := json.Marshal(reqBody) if err != nil { panic(err) } // Request to pdfg's API req, err := http.NewRequest("POST", "https://api.pdfg.net/v1", bytes.NewBuffer(jsonData)) if err != nil { panic(err) } req.Header.Set("Content-Type", "application/json") req.Header.Set("Authorization", "Bearer YOUR_API_KEY") client := &http.Client{} resp, err := client.Do(req) if err != nil { panic(err) } defer resp.Body.Close() // Save PDF if resp.StatusCode == 200 { out, err := os.Create("invoice.pdf") if err != nil { panic(err) } defer out.Close() _, err = io.Copy(out, resp.Body) if err != nil { panic(err) } } } ``` -------------------------------- ### Upload from Dashboard: Path Notations Source: https://github.com/heap-jp/pdfg-docs/blob/main/docs/en/image.md HTML comments and img tags showing that subdirectory paths are not supported; all these notations refer to the same sample.png file. ```html Sample image Sample image Sample image ``` -------------------------------- ### curl request with preview: true Source: https://github.com/heap-jp/pdfg-docs/blob/main/docs/en/preview.md Use this curl command to generate a PDF in preview mode. The 'preview: true' parameter displays the PDF in the dashboard preview screen and does not count towards usage quota. The generated PDF will include a 'pdfg.net preview' watermark. ```bash curl -X POST 'https://api.pdfg.net/v1' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer YOUR_API_KEY' \ --data '{"html": "

Hello World

", "preview": true}' ``` -------------------------------- ### Generate PDF from ERB template using pdfg API (generate_pdf.rb) Source: https://github.com/heap-jp/pdfg-docs/blob/main/docs/en/erb.md Ruby script that loads the ERB template, prepares data, creates a binding object, generates the HTML string, and sends it to pdfg's API. It uses HTTParty to POST to https://api.pdfg.net/v1 with an Authorization header and saves the response as invoice.pdf if successful. ```ruby # generate_pdf.rb require 'erb' require 'httparty' # Load ERB template template = ERB.new(File.read('templates/invoice.html.erb')) # Prepare data items = [ { name: '商品A', price: 1000 }, { name: '商品B', price: 2000 } ] total = 3000 # Create a binding object class TemplateBinding def initialize(items, total) @items = items @total = total end def items @items end def total @total end def get_binding binding end end # Generate HTML string html = template.result(TemplateBinding.new(items, total).get_binding) # Request to pdfg's API response = HTTParty.post( 'https://api.pdfg.net/v1', headers: { 'Content-Type' => 'application/json', 'Authorization' => 'Bearer YOUR_API_KEY' }, body: { html: html, pdfOptions: { format: 'A4' } }.to_json ) # PDFの保存 if response.success? File.binwrite('invoice.pdf', response.body) end ``` -------------------------------- ### Render Jinja2 template and send HTML to pdfg API Source: https://github.com/heap-jp/pdfg-docs/blob/main/docs/en/jinja2.md Python script that loads the Jinja2 template, renders it with sample data, and posts the HTML to pdfg's API with an A4 format option. Saves the response content as 'invoice.pdf' on success. ```python # generate_pdf.py from jinja2 import Environment, FileSystemLoader import requests # Configure Jinja2 environment env = Environment(loader=FileSystemLoader('templates')) template = env.get_template('invoice.html') # Prepare data items = [ {'name': '商品A', 'price': 1000}, {'name': '商品B', 'price': 2000}, ] total = 3000 # Generate HTML string html = template.render(items=items, total=total) # Request to pdfg's API response = requests.post( 'https://api.pdfg.net/v1', headers={ 'Content-Type': 'application/json', 'Authorization': 'Bearer YOUR_API_KEY' }, json={ 'html': html, 'pdfOptions': { 'format': 'A4' } } ) # Save PDF if response.status_code == 200: with open('invoice.pdf', 'wb') as f: f.write(response.content) ``` -------------------------------- ### Generate PDF from React component using ReactDOMServer and pdfg API Source: https://github.com/heap-jp/pdfg-docs/blob/main/docs/en/react.md Defines an Invoice React component that renders an HTML table with items and total, then uses ReactDOMServer.renderToString() to convert it to an HTML string, sends it to pdfg's API with a Bearer token, and saves the returned PDF buffer to invoice.pdf. ```tsx // Invoice.tsx import React from "react"; interface Props { items: { name: string; price: number }[]; total: number; } export const Invoice: React.FC = ({ items, total }) => (

Invoice

{items.map((item, i) => ( ))}
Item Amount
{item.name} {item.price} USD

Total: {total} USD

); ``` ```ts // generatePdf.ts import ReactDOMServer from "react-dom/server"; import { Invoice } from "./Invoice"; import fs from "fs"; // Prepare data const items = [ { name: "商品A", price: 1000 }, { name: "商品B", price: 2000 }, ]; // Convert JSX to HTML string const html = ReactDOMServer.renderToString( ); // Request to pdfg's API const response = await fetch("https://api.pdfg.net/v1", { method: "POST", headers: { "Content-Type": "application/json", Authorization: "Bearer YOUR_API_KEY", }, body: JSON.stringify({ html: html, pdfOptions: { format: "A4", }, }), }); // Save PDF if (response.ok) { const pdfBuffer = await response.arrayBuffer(); fs.writeFileSync("invoice.pdf", Buffer.from(pdfBuffer)); } ``` -------------------------------- ### Generate PDF using Blade and pdfg API in generate_pdf.php Source: https://github.com/heap-jp/pdfg-docs/blob/main/docs/en/blade.md Configures the Blade engine, renders the template with data, and sends the resulting HTML to the pdfg API via cURL to save as a PDF. ```php register('blade', function () use ($compiler) { return new CompilerEngine($compiler); }); $finder = new FileViewFinder($files, ['templates']); $factory = new Factory($resolver, $finder, new Illuminate\Events\Dispatcher); // Prepare data $items = [ ['name' => '商品A', 'price' => 1000], ['name' => '商品B', 'price' => 2000], ]; $total = 3000; // Generate HTML string $html = $factory->make('invoice', [ 'items' => $items, 'total' => $total, ])->render(); // Request to pdfg's API $ch = curl_init('https://api.pdfg.net/v1'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Content-Type: application/json', 'Authorization: Bearer YOUR_API_KEY' ]); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([ 'html' => $html, 'pdfOptions' => [ 'format' => 'A4' ] ])); $response = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); // Save PDF if ($httpCode === 200) { file_put_contents('invoice.pdf', $response); } ``` -------------------------------- ### Generate PDF from Vue.js SSR HTML with pdfg API Source: https://github.com/heap-jp/pdfg-docs/blob/main/docs/en/vue.md Complete workflow: define an Invoice Vue component with props for items and total, then use createSSRApp and renderToString to generate an HTML string, send it to pdfg's API with a Bearer token, and save the returned PDF as invoice.pdf. Requires @vue/server-renderer and a valid API key. ```ts ``` ```ts // generatePdf.ts import { createSSRApp } from "vue"; import { renderToString } from "@vue/server-renderer"; import Invoice from "./Invoice.vue"; import fs from "fs"; // Prepare data const items = [ { name: "Product A", price: 1000 }, { name: "Product B", price: 2000 }, ]; // Create Vue application const app = createSSRApp(Invoice, { items, total: 3000, }); // Convert to HTML string const html = await renderToString(app); // Request to pdfg's API const response = await fetch("https://api.pdfg.net/v1", { method: "POST", headers: { "Content-Type": "application/json", Authorization: "Bearer YOUR_API_KEY", }, body: JSON.stringify({ html: html, pdfOptions: { format: "A4", }, }), }); // Save PDF if (response.ok) { const pdfBuffer = await response.arrayBuffer(); fs.writeFileSync("invoice.pdf", Buffer.from(pdfBuffer)); } ``` -------------------------------- ### Apply styles using the style tag Source: https://github.com/heap-jp/pdfg-docs/blob/main/docs/en/style.md Define CSS rules within a

Hello World

``` -------------------------------- ### POST /v1 Source: https://github.com/heap-jp/pdfg-docs/blob/main/docs/en/api.md Converts HTML content to a PDF. The request body contains the HTML string and optional PDF generation options. If preview is true, a watermark is added and usage is not counted. If uploadUrl is provided, the PDF is uploaded to that URL instead of being returned in the response. ```APIDOC ## POST /v1 ### Description Converts HTML content to a PDF. The request body contains the HTML string and optional PDF generation options. If preview is true, a watermark is added and usage is not counted. If uploadUrl is provided, the PDF is uploaded to that URL instead of being returned in the response. ### Method POST ### Endpoint https://api.pdfg.net/v1 ### Headers - Content-Type: application/json - Authorization: Bearer YOUR_API_KEY ### Parameters #### Request Body - **html** (string) - Required - HTML content to be converted to PDF. - **pdfOptions** (object) - Optional - Various settings for PDF generation. - **preview** (boolean) - Optional - When true, adds a watermark and does not count towards API usage. - **uploadUrl** (string) - Optional - A presigned PUT URL (e.g. AWS S3). When provided, the generated PDF is uploaded directly to this URL instead of being returned in the response body. ### Request Example { "html": "...", "pdfOptions": {}, "preview": false, "uploadUrl": "https://example.com/upload" } ### Response #### Success Response (200) - The response body contains the generated PDF, unless uploadUrl is provided. #### Response Example (PDF binary data) ``` -------------------------------- ### List of built-in font files Source: https://github.com/heap-jp/pdfg-docs/blob/main/docs/en/font.md A plain-text list of the font files pre-installed with pdfg, centered around the Noto font family. Each font typically includes Bold 600 and Regular 400 styles. ```text NotoEmoji-Regular.ttf NotoSansJP-Bold.ttf NotoSansThai-Bold.ttf NotoSerifJP-Regular.ttf NotoKufiArabic-Bold.ttf NotoSansJP-ExtraBold.ttf NotoSansThai-Regular.ttf NotoSerifJP-SemiBold.ttf NotoKufiArabic-Regular.ttf NotoSansJP-ExtraLight.ttf NotoSerif-Bold.ttf NotoSerifKR-Bold.ttf NotoNaskhArabic-Bold.ttf NotoSansJP-Light.ttf NotoSerif-Regular.ttf NotoSerifKR-Regular.ttf NotoNaskhArabic-Regular.ttf NotoSansJP-Medium.ttf NotoSerifBengali-Bold.ttf NotoSerifSC-Regular.ttf NotoSans-Bold.ttf NotoSansJP-Regular.ttf NotoSerifBengali-Regular.ttf NotoSerifTC-Regular.ttf NotoSans-Regular.ttf NotoSansJP-SemiBold.ttf NotoSerifJP-Black.ttf NotoSerifThai-Bold.ttf NotoSansArabic-Bold.ttf NotoSansJP-Thin.ttf NotoSerifJP-Bold.ttf NotoSerifThai-Regular.ttf NotoSansArabic-Regular.ttf NotoSansKR-Bold.ttf NotoSerifJP-ExtraBold.ttf Roboto-Bold.ttf NotoSansBengali-Bold.ttf NotoSansKR-Regular.ttf NotoSerifJP-ExtraLight.ttf Roboto-Regular.ttf NotoSansBengali-Regular.ttf NotoSansSC-Regular.ttf NotoSerifJP-Light.ttf NotoSansJP-Black.ttf NotoSansTC-Regular.ttf NotoSerifJP-Medium.ttf ``` -------------------------------- ### Minimal request using curl Source: https://github.com/heap-jp/pdfg-docs/blob/main/README.md A basic POST request to the pdfg API to convert HTML to a PDF file. Requires an API key and valid JSON payload. ```bash curl -X POST https://api.pdfg.net/v1 \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer YOUR_API_KEY' \ -d '{"html": "

Hello

", "pdfOptions": {"format": "A4"}}' \ --output out.pdf ``` -------------------------------- ### POST https://api.pdfg.net/v1 Source: https://github.com/heap-jp/pdfg-docs/blob/main/docs/en/api.md Generates a PDF from provided HTML content with configurable PDF options. The request is authenticated with a Bearer token. The response is the PDF binary data, or an empty JSON object if an uploadUrl is provided. ```APIDOC ## [POST] https://api.pdfg.net/v1 ### Description Generates a PDF from the provided HTML content with configurable PDF options. The PDF is returned as binary data, or uploaded to a specified URL if an uploadUrl is provided. ### Method POST ### Endpoint https://api.pdfg.net/v1 ### Parameters #### Request Body - **html** (string) - Required - The HTML content to convert to PDF. - **pdfOptions** (object) - Optional - Configuration options for the PDF generation. - **displayHeaderFooter** (boolean) - Optional - Whether to display header and footer. - **footerTemplate** (string) - Optional - HTML template for the footer. - **format** (string) - Optional - Page format (e.g., A4). - **headerTemplate** (string) - Optional - HTML template for the header. - **height** (string) - Optional - Page height (e.g., 297mm). - **landscape** (boolean) - Optional - Whether to use landscape orientation. - **margin** (object) - Optional - Page margins. - **top** (string) - Optional - Top margin (e.g., 20mm). - **right** (string) - Optional - Right margin (e.g., 20mm). - **bottom** (string) - Optional - Bottom margin (e.g., 20mm). - **left** (string) - Optional - Left margin (e.g., 20mm). - **omitBackground** (boolean) - Optional - Whether to omit background graphics. - **pageRanges** (string) - Optional - Page ranges to include (e.g., 1-5). - **preferCSSPageSize** (boolean) - Optional - Whether to prefer CSS page size. - **printBackground** (boolean) - Optional - Whether to print background graphics. - **scale** (number) - Optional - Scale factor (e.g., 1). - **width** (string) - Optional - Page width (e.g., 210mm). ### Request Example ```bash curl --location 'https://api.pdfg.net/v1' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer YOUR_API_KEY' \ --data '{ "html": "

Hello World

", "pdfOptions": { "displayHeaderFooter": true, "footerTemplate": "
/
", "format": "A4", "headerTemplate": "
Sample Header
", "height": "297mm", "landscape": false, "margin": { "top": "20mm", "right": "20mm", "bottom": "20mm", "left": "20mm" }, "omitBackground": false, "pageRanges": "1-5", "preferCSSPageSize": false, "printBackground": true, "scale": 1, "width": "210mm" } }' \ --output sample.pdf ``` ### Response #### Success Response (200) - Without `uploadUrl`: Returns the generated PDF as binary data. - With `uploadUrl`: Returns an empty JSON object `{}` with `Content-Type: application/json`. The PDF has been uploaded to the provided URL. #### Response Example Without `uploadUrl`: Binary PDF data. With `uploadUrl`: `{}` ``` -------------------------------- ### Define ERB template for invoice (templates/invoice.html.erb) Source: https://github.com/heap-jp/pdfg-docs/blob/main/docs/en/erb.md HTML ERB template that iterates over an `items` array and displays each item's name and price, plus a total. It expects `items` and `total` to be available in the binding. ```html <%# templates/invoice.html.erb %>

Invoice

<% items.each do |item| %> <% end %>
Item Amount
<%= item[:name] %> <%= item[:price] %> USD

Total: <%= total %> USD

``` -------------------------------- ### Generate PDF using Thymeleaf and pdfg API Source: https://github.com/heap-jp/pdfg-docs/blob/main/docs/en/thymeleaf.md This Java class configures Thymeleaf with a ClassLoaderTemplateResolver, prepares data, processes the 'invoice' template to generate an HTML string, and sends it to pdfg's API. It saves the response as invoice.pdf if the status code is 200. Requires a valid API key and the Thymeleaf library. ```java // GeneratePdf.java import org.thymeleaf.TemplateEngine; import org.thymeleaf.context.Context; import org.thymeleaf.templateresolver.ClassLoaderTemplateResolver; import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; import java.nio.file.Files; import java.nio.file.Path; import java.util.List; import java.util.Map; public class GeneratePdf { public static void main(String[] args) throws Exception { // Configure Thymeleaf TemplateEngine templateEngine = new TemplateEngine(); ClassLoaderTemplateResolver resolver = new ClassLoaderTemplateResolver(); resolver.setPrefix("/templates/"); resolver.setSuffix(".html"); templateEngine.setTemplateResolver(resolver); // Prepare data List> items = List.of( Map.of("name", "Product A", "price", 1000), Map.of("name", "Product B", "price", 2000) ); int total = 3000; // Set context Context context = new Context(); context.setVariable("items", items); context.setVariable("total", total); // Generate HTML string String html = templateEngine.process("invoice", context); // Create request body String requestBody = String.format(""" { "html": "%s", "pdfOptions": { "format": "A4" } } """, html.replace("\"", "\\\"")); // Request to pdfg's API HttpClient client = HttpClient.newHttpClient(); HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://api.pdfg.net/v1")) .header("Content-Type", "application/json") .header("Authorization", "Bearer YOUR_API_KEY") .POST(HttpRequest.BodyPublishers.ofString(requestBody)) .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofByteArray()); // Save PDF if (response.statusCode() == 200) { Files.write(Path.of("invoice.pdf"), response.body()); } } } ``` -------------------------------- ### Generate A3 PDF with format property Source: https://github.com/heap-jp/pdfg-docs/blob/main/docs/en/page.md Sets the PDF format to A3 (420mm × 297mm) using the 'format' property in pdfOptions. The font size is set to 40mm. ```json { "pdfOptions": { "format": "A3" /* Specify A3 size */ }, "html": '

Page

' } ``` -------------------------------- ### Apply styles using the style attribute Source: https://github.com/heap-jp/pdfg-docs/blob/main/docs/en/style.md Apply CSS directly to an HTML element using the style attribute, suitable for dynamic or one-time styling. ```html

Hello World

``` -------------------------------- ### cURL API Request to pdfg Source: https://github.com/heap-jp/pdfg-docs/blob/main/docs/en/index.md Sends an HTML string to the pdfg API endpoint and saves the returned PDF to a file. Requires a valid API key in the Authorization header. ```bash curl --location 'https://api.pdfg.net/v1' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer YOUR_API_KEY' \ --data '{"html": "

Hello World

"}' \ --output pdfg.pdf ``` -------------------------------- ### Reference external CSS via CDN Source: https://github.com/heap-jp/pdfg-docs/blob/main/docs/en/style.md Directly reference CSS files hosted on the internet. Note that this may increase generation time and carries risks related to CDN availability. ```html

Hello World

``` -------------------------------- ### Reference uploaded CSS file Source: https://github.com/heap-jp/pdfg-docs/blob/main/docs/en/style.md Reference a CSS file uploaded via the dashboard in your HTML document. ```html

Hello World

``` -------------------------------- ### Define the Blade template in templates/invoice.blade.php Source: https://github.com/heap-jp/pdfg-docs/blob/main/docs/en/blade.md This template uses standard Blade syntax to iterate over items and display a total, which will be rendered into an HTML string. ```php {{-- templates/invoice.blade.php --}}

Invoice

@foreach ($items as $item) @endforeach
Item Amount
{{ $item['name'] }} {{ $item['price'] }} USD

Total: {{ $total }} USD

``` -------------------------------- ### Define Thymeleaf HTML template for invoice Source: https://github.com/heap-jp/pdfg-docs/blob/main/docs/en/thymeleaf.md This HTML template uses Thymeleaf attributes (th:each, th:text) to iterate over items and display total. It is saved as templates/invoice.html and used by the Java code to generate the HTML string. ```html

Invoice

Item Amount

``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.