Documentation
¶
Overview ¶
Package chromium provides a client for the Gotenberg Chromium service. It offers a convenient API for converting HTML, URLs, and Markdown to PDF documents and screenshots.
Index ¶
- type Chromium
- func (r *Chromium) Bool(fieldName string, value bool) *Chromium
- func (r *Chromium) ConvertHTML(ctx context.Context, html io.Reader) *Chromium
- func (r *Chromium) ConvertMarkdown(ctx context.Context, html io.Reader) *Chromium
- func (r *Chromium) ConvertURL(ctx context.Context, url string) *Chromium
- func (r *Chromium) DownloadFrom(url string, headers map[string]string) *Chromium
- func (r *Chromium) File(filename string, content io.Reader) *Chromium
- func (r *Chromium) Float(fieldName string, value float64) *Chromium
- func (r *Chromium) GenerateDocumentOutline() *Chromium
- func (r *Chromium) GenerateTaggedPdf() *Chromium
- func (r *Chromium) Header(key, value string) *Chromium
- func (r *Chromium) Landscape() *Chromium
- func (r *Chromium) MarginBottom(value float64) *Chromium
- func (r *Chromium) MarginLeft(value float64) *Chromium
- func (r *Chromium) MarginRight(value float64) *Chromium
- func (r *Chromium) MarginTop(value float64) *Chromium
- func (r *Chromium) Margins(top, right, bottom, left float64) *Chromium
- func (r *Chromium) NativePageRanges(value string) *Chromium
- func (r *Chromium) OmitBackground() *Chromium
- func (r *Chromium) OutputFilename(filename string) *Chromium
- func (r *Chromium) PaperHeight(value float64) *Chromium
- func (r *Chromium) PaperSize(width, height float64) *Chromium
- func (r *Chromium) PaperSizeA4() *Chromium
- func (r *Chromium) PaperSizeA6() *Chromium
- func (r *Chromium) PaperSizeLetter() *Chromium
- func (r *Chromium) PaperWidth(value float64) *Chromium
- func (r *Chromium) Param(key, value string) *Chromium
- func (r *Chromium) PreferCssPageSize() *Chromium
- func (r *Chromium) PrintBackground() *Chromium
- func (r *Chromium) Scale(value float64) *Chromium
- func (r *Chromium) ScreenshotClip(clip bool) *Chromium
- func (r *Chromium) ScreenshotFormat(format string) *Chromium
- func (r *Chromium) ScreenshotHTML(ctx context.Context, html io.Reader) *Chromium
- func (r *Chromium) ScreenshotHeight(height int) *Chromium
- func (r *Chromium) ScreenshotMarkdown(ctx context.Context, html io.Reader) *Chromium
- func (r *Chromium) ScreenshotOmitBackground(omit bool) *Chromium
- func (r *Chromium) ScreenshotOptimizeForSpeed(optimize bool) *Chromium
- func (r *Chromium) ScreenshotQuality(quality int) *Chromium
- func (r *Chromium) ScreenshotURL(ctx context.Context, url string) *Chromium
- func (r *Chromium) ScreenshotWidth(width int) *Chromium
- func (r *Chromium) Send() (*gotenberg.Response, error)
- func (r *Chromium) SinglePage() *Chromium
- func (r *Chromium) Timeout(duration time.Duration) *Chromium
- func (r *Chromium) Trace(trace string) *Chromium
- func (r *Chromium) WaitDelay(value string) *Chromium
- func (r *Chromium) WaitForExpression(value string) *Chromium
- func (r *Chromium) WebhookErrorURL(url, method string) *Chromium
- func (r *Chromium) WebhookHeader(key, value string) *Chromium
- func (r *Chromium) WebhookURL(url, method string) *Chromium
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Chromium ¶
Chromium represents a Gotenberg conversion request builder.
func NewChromium ¶
func NewChromium(client *httpclient.Client) *Chromium
func (*Chromium) ConvertHTML ¶
ConvertHTML creates a request to convert HTML content to PDF. The html parameter should contain the HTML content to be converted.
func (*Chromium) ConvertMarkdown ¶
ConvertMarkdown creates a request to convert Markdown content to PDF.
func (*Chromium) ConvertURL ¶
ConvertURL creates a request to convert a web page at the given URL to PDF.
func (*Chromium) DownloadFrom ¶
DownloadFrom sets the downloadFrom parameter for downloading files from URLs. The data should be a slice of DownloadItem representing the download configuration.
func (*Chromium) GenerateDocumentOutline ¶
GenerateDocumentOutline sets whether the document outline should be embedded into the PDF.
func (*Chromium) GenerateTaggedPdf ¶
GenerateTaggedPdf sets whether to generate tagged (accessible) PDF.
func (*Chromium) MarginBottom ¶
MarginBottom sets the bottom margin in inches.
func (*Chromium) MarginLeft ¶
MarginLeft sets the left margin in inches.
func (*Chromium) MarginRight ¶
MarginRight sets the right margin in inches.
func (*Chromium) Margins ¶
Margins sets the page margins for the PDF in inches. Parameters are in order: top, right, bottom, left.
func (*Chromium) NativePageRanges ¶
NativePageRanges sets the page ranges to print, e.g., '1-5, 8, 11-13'.
func (*Chromium) OmitBackground ¶
OmitBackground hides the default white background and allows generating PDFs with transparency.
func (*Chromium) OutputFilename ¶
OutputFilename sets the output filename for the generated PDF.
func (*Chromium) PaperHeight ¶
PaperHeight sets the paper height in inches.
func (*Chromium) PaperSize ¶
PaperSize sets the paper size for the PDF using width and height in inches.
func (*Chromium) PaperSizeA4 ¶
PaperSizeA4 sets the paper size to A4 format.
func (*Chromium) PaperSizeA6 ¶
PaperSizeA6 sets the paper size to A6 format.
func (*Chromium) PaperSizeLetter ¶
PaperSizeLetter sets the paper size to Letter format.
func (*Chromium) PaperWidth ¶
PaperWidth sets the paper width in inches.
func (*Chromium) PreferCssPageSize ¶
PreferCssPageSize sets whether to prefer page size as defined by CSS.
func (*Chromium) PrintBackground ¶
PrintBackground sets whether to print the background graphics.
func (*Chromium) ScreenshotClip ¶
ScreenshotClip defines whether to clip the screenshot according to the device dimensions.
func (*Chromium) ScreenshotFormat ¶
ScreenshotFormat sets the image compression format.
func (*Chromium) ScreenshotHTML ¶
ScreenshotHTML creates a request to take a screenshot of HTML content.
func (*Chromium) ScreenshotHeight ¶
ScreenshotHeight sets the device screen height in pixels.
func (*Chromium) ScreenshotMarkdown ¶
ScreenshotMarkdown creates a request to take a screenshot of Markdown content.
func (*Chromium) ScreenshotOmitBackground ¶
ScreenshotOmitBackground hides the default white background and allows generating screenshots with transparency.
func (*Chromium) ScreenshotOptimizeForSpeed ¶
ScreenshotOptimizeForSpeed defines whether to optimize image encoding for speed, not for resulting size.
func (*Chromium) ScreenshotQuality ¶
ScreenshotQuality sets the compression quality from range 0 to 100 (jpeg only).
func (*Chromium) ScreenshotURL ¶
ScreenshotURL creates a request to take a screenshot of a web page at the given URL.
func (*Chromium) ScreenshotWidth ¶
ScreenshotWidth sets the device screen width in pixels.
func (*Chromium) Send ¶
Send executes the conversion request and returns the response. Returns an error if the request fails or the conversion cannot be completed.
func (*Chromium) SinglePage ¶
SinglePage sets whether to print the entire content in one single page.
func (*Chromium) Trace ¶
Trace sets the request trace identifier for debugging and monitoring. If not set, Gotenberg will assign a unique UUID trace.
func (*Chromium) WaitDelay ¶
WaitDelay sets the duration to wait when loading an HTML document before converting it into PDF.
func (*Chromium) WaitForExpression ¶
WaitForExpression sets the JavaScript expression to wait before converting an HTML document into PDF until it returns true.
func (*Chromium) WebhookErrorURL ¶
WebhookErrorURL sets the webhook URL and HTTP method for failed conversions.
func (*Chromium) WebhookHeader ¶
WebhookHeader adds a custom header to be sent with webhook requests. Multiple headers can be added by calling this method multiple times.
func (*Chromium) WebhookURL ¶
WebhookURL sets the webhook URL and HTTP method for successful conversions.