Documentation ¶
Overview ¶
Package gotenberg is a Go client for interacting with a Gotenberg API.
For more complete usages, head to the documentation: https://gotenberg.dev/
Index ¶
- Variables
- type Client
- func (c *Client) Screenshot(ctx context.Context, scr ScreenshotRequester) (*http.Response, error)
- func (c *Client) Send(ctx context.Context, req MainRequester) (*http.Response, error)
- func (c *Client) Store(ctx context.Context, req MainRequester, dest string) error
- func (c *Client) StoreScreenshot(ctx context.Context, req ScreenshotRequester, dest string) error
- type HTMLRequest
- func (req *HTMLRequest) Assets(assets ...document.Document)
- func (req HTMLRequest) Cookies(cookies []byte)
- func (req HTMLRequest) EmulatePrintMediaType()
- func (req HTMLRequest) EmulateScreenMediaType()
- func (req HTMLRequest) ExtraHTTPHeaders(headers []byte)
- func (req HTMLRequest) FailOnConsoleExceptions()
- func (req HTMLRequest) FailOnHTTPStatusCodes(statusCodes []byte)
- func (req HTMLRequest) Footer(footer document.Document)
- func (req HTMLRequest) Format(format ImageFormat)
- func (req HTMLRequest) Header(header document.Document)
- func (req HTMLRequest) Landscape()
- func (req HTMLRequest) Margins(margins PageMargins)
- func (req HTMLRequest) Metadata(jsonData []byte)
- func (req HTMLRequest) NativePageRanges(ranges string)
- func (req HTMLRequest) OmitBackground()
- func (req HTMLRequest) PaperSize(size PaperDimensions)
- func (req HTMLRequest) PdfA(pdfa PdfAFormat)
- func (req HTMLRequest) PdfUA()
- func (req HTMLRequest) PreferCSSPageSize()
- func (req HTMLRequest) PrintBackground()
- func (req HTMLRequest) Scale(factor float64)
- func (req HTMLRequest) ScreenshotClip()
- func (req HTMLRequest) ScreenshotHeight(height float64)
- func (req HTMLRequest) ScreenshotOptimizeForSpeed()
- func (req HTMLRequest) ScreenshotQuality(quality int)
- func (req HTMLRequest) ScreenshotWidth(width float64)
- func (req HTMLRequest) SinglePage()
- func (req HTMLRequest) SkipNetworkIdleEvent()
- func (req HTMLRequest) UserAgent(ua string)
- func (req HTMLRequest) WaitDelay(delay time.Duration)
- func (req HTMLRequest) WaitForExpression(expression string)
- type ImageFormat
- type MainRequester
- type MarkdownRequest
- func (req *MarkdownRequest) Assets(assets ...document.Document)
- func (req MarkdownRequest) Cookies(cookies []byte)
- func (req MarkdownRequest) EmulatePrintMediaType()
- func (req MarkdownRequest) EmulateScreenMediaType()
- func (req MarkdownRequest) ExtraHTTPHeaders(headers []byte)
- func (req MarkdownRequest) FailOnConsoleExceptions()
- func (req MarkdownRequest) FailOnHTTPStatusCodes(statusCodes []byte)
- func (req MarkdownRequest) Footer(footer document.Document)
- func (req MarkdownRequest) Format(format ImageFormat)
- func (req MarkdownRequest) Header(header document.Document)
- func (req MarkdownRequest) Landscape()
- func (req MarkdownRequest) Margins(margins PageMargins)
- func (req *MarkdownRequest) Metadata(jsonData []byte)
- func (req MarkdownRequest) NativePageRanges(ranges string)
- func (req MarkdownRequest) OmitBackground()
- func (req MarkdownRequest) PaperSize(size PaperDimensions)
- func (req MarkdownRequest) PdfA(pdfa PdfAFormat)
- func (req MarkdownRequest) PdfUA()
- func (req MarkdownRequest) PreferCSSPageSize()
- func (req MarkdownRequest) PrintBackground()
- func (req MarkdownRequest) Scale(factor float64)
- func (req MarkdownRequest) ScreenshotClip()
- func (req MarkdownRequest) ScreenshotHeight(height float64)
- func (req MarkdownRequest) ScreenshotOptimizeForSpeed()
- func (req MarkdownRequest) ScreenshotQuality(quality int)
- func (req MarkdownRequest) ScreenshotWidth(width float64)
- func (req MarkdownRequest) SinglePage()
- func (req MarkdownRequest) SkipNetworkIdleEvent()
- func (req MarkdownRequest) UserAgent(ua string)
- func (req MarkdownRequest) WaitDelay(delay time.Duration)
- func (req MarkdownRequest) WaitForExpression(expression string)
- type MergeRequest
- func (br MergeRequest) DownloadFrom(downloads map[string]map[string]string)
- func (req *MergeRequest) Metadata(md []byte)
- func (br MergeRequest) OutputFilename(filename string)
- func (req *MergeRequest) PdfA(pdfa PdfAFormat)
- func (req *MergeRequest) PdfUA()
- func (br MergeRequest) SetWebhookErrorMethod(method string)
- func (br MergeRequest) SetWebhookExtraHeaders(headers []byte)
- func (br MergeRequest) SetWebhookMethod(method string)
- func (br MergeRequest) Trace(trace string)
- func (br MergeRequest) UseBasicAuth(username, password string)
- func (br MergeRequest) UseWebhook(hookURL string, errorURL string)
- type OfficeRequest
- func (req *OfficeRequest) AddOriginalDocumentAsStream()
- func (req *OfficeRequest) AllowDuplicateFieldNames()
- func (req *OfficeRequest) ConvertOooTargetToPdfTarget()
- func (br OfficeRequest) DownloadFrom(downloads map[string]map[string]string)
- func (req *OfficeRequest) ExportBookmarks(export bool)
- func (req *OfficeRequest) ExportBookmarksToPdfDestination()
- func (req *OfficeRequest) ExportFormFields(export bool)
- func (req *OfficeRequest) ExportHiddenSlides()
- func (req *OfficeRequest) ExportLinksRelativeFsys()
- func (req *OfficeRequest) ExportNotes()
- func (req *OfficeRequest) ExportNotesInMargin()
- func (req *OfficeRequest) ExportNotesPages()
- func (req *OfficeRequest) ExportOnlyNotesPages()
- func (req *OfficeRequest) ExportPlaceholders()
- func (req *OfficeRequest) Landscape()
- func (req *OfficeRequest) LosslessImageCompression()
- func (req *OfficeRequest) MaxImageResolution(res int)
- func (req *OfficeRequest) Merge()
- func (req *OfficeRequest) Metadata(md []byte)
- func (req *OfficeRequest) NativePageRanges(ranges string)
- func (br OfficeRequest) OutputFilename(filename string)
- func (req *OfficeRequest) Password(password string)
- func (req *OfficeRequest) PdfA(pdfa PdfAFormat)
- func (req *OfficeRequest) PdfUA()
- func (req *OfficeRequest) Quality(quality int)
- func (req *OfficeRequest) ReduceImageResolution()
- func (br OfficeRequest) SetWebhookErrorMethod(method string)
- func (br OfficeRequest) SetWebhookExtraHeaders(headers []byte)
- func (br OfficeRequest) SetWebhookMethod(method string)
- func (req *OfficeRequest) SinglePageSheets()
- func (req *OfficeRequest) SkipEmptyPages()
- func (br OfficeRequest) Trace(trace string)
- func (br OfficeRequest) UseBasicAuth(username, password string)
- func (br OfficeRequest) UseWebhook(hookURL string, errorURL string)
- type PageMargins
- type PaperDimensions
- type PdfAFormat
- type ReadMetadataRequest
- func (br ReadMetadataRequest) DownloadFrom(downloads map[string]map[string]string)
- func (br ReadMetadataRequest) OutputFilename(filename string)
- func (br ReadMetadataRequest) SetWebhookErrorMethod(method string)
- func (br ReadMetadataRequest) SetWebhookExtraHeaders(headers []byte)
- func (br ReadMetadataRequest) SetWebhookMethod(method string)
- func (br ReadMetadataRequest) Trace(trace string)
- func (br ReadMetadataRequest) UseBasicAuth(username, password string)
- func (br ReadMetadataRequest) UseWebhook(hookURL string, errorURL string)
- type ScreenshotRequester
- type SizeUnit
- type URLRequest
- func (req URLRequest) Cookies(cookies []byte)
- func (req URLRequest) EmulatePrintMediaType()
- func (req URLRequest) EmulateScreenMediaType()
- func (req URLRequest) ExtraHTTPHeaders(headers []byte)
- func (req URLRequest) FailOnConsoleExceptions()
- func (req URLRequest) FailOnHTTPStatusCodes(statusCodes []byte)
- func (req URLRequest) Footer(footer document.Document)
- func (req URLRequest) Format(format ImageFormat)
- func (req URLRequest) Header(header document.Document)
- func (req URLRequest) Landscape()
- func (req URLRequest) Margins(margins PageMargins)
- func (req *URLRequest) Metadata(jsonData []byte)
- func (req URLRequest) NativePageRanges(ranges string)
- func (req URLRequest) OmitBackground()
- func (req URLRequest) PaperSize(size PaperDimensions)
- func (req URLRequest) PdfA(pdfa PdfAFormat)
- func (req URLRequest) PdfUA()
- func (req URLRequest) PreferCSSPageSize()
- func (req URLRequest) PrintBackground()
- func (req URLRequest) Scale(factor float64)
- func (req URLRequest) ScreenshotClip()
- func (req URLRequest) ScreenshotHeight(height float64)
- func (req URLRequest) ScreenshotOptimizeForSpeed()
- func (req URLRequest) ScreenshotQuality(quality int)
- func (req URLRequest) ScreenshotWidth(width float64)
- func (req URLRequest) SinglePage()
- func (req URLRequest) SkipNetworkIdleEvent()
- func (req URLRequest) UserAgent(ua string)
- func (req URLRequest) WaitDelay(delay time.Duration)
- func (req URLRequest) WaitForExpression(expression string)
- type WriteMetadataRequest
- func (br WriteMetadataRequest) DownloadFrom(downloads map[string]map[string]string)
- func (wmd *WriteMetadataRequest) Metadata(md []byte)
- func (br WriteMetadataRequest) OutputFilename(filename string)
- func (br WriteMetadataRequest) SetWebhookErrorMethod(method string)
- func (br WriteMetadataRequest) SetWebhookExtraHeaders(headers []byte)
- func (br WriteMetadataRequest) SetWebhookMethod(method string)
- func (br WriteMetadataRequest) Trace(trace string)
- func (br WriteMetadataRequest) UseBasicAuth(username, password string)
- func (br WriteMetadataRequest) UseWebhook(hookURL string, errorURL string)
Constants ¶
This section is empty.
Variables ¶
var ( // A0 paper size. A0 = PaperDimensions{ Height: 46.8, Width: 33.1, Unit: IN, } // A1 paper size. A1 = PaperDimensions{ Height: 33.1, Width: 23.4, Unit: IN, } // A2 paper size. A2 = PaperDimensions{ Height: 23.4, Width: 16.5, Unit: IN, } // A3 paper size. A3 = PaperDimensions{ Height: 16.5, Width: 11.7, Unit: IN, } // A4 paper size. A4 = PaperDimensions{ Height: 11.7, Width: 8.27, Unit: IN, } // A5 paper size. A5 = PaperDimensions{ Height: 8.3, Width: 5.8, Unit: IN, } // A6 paper size. A6 = PaperDimensions{ Height: 5.8, Width: 4.1, Unit: IN, } // Letter paper size. Letter = PaperDimensions{ Height: 11, Width: 8.5, Unit: IN, } // Legal paper size. Legal = PaperDimensions{ Height: 14, Width: 8.5, Unit: IN, } // Tabloid paper size. Tabloid = PaperDimensions{ Height: 17, Width: 11, Unit: IN, } // Ledger paper size. Ledger = PaperDimensions{ Height: 17, Width: 11, Unit: IN, } )
nolint: gochecknoglobals
var ( // NoMargins removes margins. NoMargins = PageMargins{ Top: 0, Bottom: 0, Left: 0, Right: 0, Unit: IN, } // NormalMargins uses 1-inch margins. NormalMargins = PageMargins{ Top: 1, Bottom: 1, Left: 1, Right: 1, Unit: IN, } // LargeMargins uses 2 inch margins. LargeMargins = PageMargins{ Top: 2, Bottom: 2, Left: 2, Right: 2, Unit: IN, } )
nolint: gochecknoglobals
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client facilitates interacting with the Gotenberg API.
func (*Client) Screenshot ¶
func (*Client) StoreScreenshot ¶
type HTMLRequest ¶
type HTMLRequest struct {
// contains filtered or unexported fields
}
HTMLRequest facilitates HTML conversion with the Gotenberg API.
func NewHTMLRequest ¶
func NewHTMLRequest(index document.Document) *HTMLRequest
func (*HTMLRequest) Assets ¶
func (req *HTMLRequest) Assets(assets ...document.Document)
Assets sets assets form files.
func (HTMLRequest) Cookies ¶
func (req HTMLRequest) Cookies(cookies []byte)
Cookies to store in the Chromium cookie jar (JSON array format).
func (HTMLRequest) EmulatePrintMediaType ¶
func (req HTMLRequest) EmulatePrintMediaType()
EmulatePrintMediaType forces Chromium to emulate the media type "print".
func (HTMLRequest) EmulateScreenMediaType ¶
func (req HTMLRequest) EmulateScreenMediaType()
EmulateScreenMediaType forces Chromium to emulate the media type "screen".
func (HTMLRequest) ExtraHTTPHeaders ¶
func (req HTMLRequest) ExtraHTTPHeaders(headers []byte)
ExtraHTTPHeaders sets extra HTTP headers that Chromium will send when loading the HTML document.
func (HTMLRequest) FailOnConsoleExceptions ¶
func (req HTMLRequest) FailOnConsoleExceptions()
FailOnConsoleExceptions forces Gotenberg to return a 409 Conflict response if there are exceptions in the Chromium console.
func (HTMLRequest) FailOnHTTPStatusCodes ¶
func (req HTMLRequest) FailOnHTTPStatusCodes(statusCodes []byte)
FailOnHTTPStatusCodes forces Gotenberg to return a 409 Conflict response if the HTTP status code from the main page is not acceptable.
func (HTMLRequest) Format ¶
func (req HTMLRequest) Format(format ImageFormat)
Format sets the image compression format, either PNG, JPEG or WEBP. Default is PNG.
func (HTMLRequest) Landscape ¶
func (req HTMLRequest) Landscape()
Landscape sets the paper orientation to landscape.
func (HTMLRequest) Margins ¶
func (req HTMLRequest) Margins(margins PageMargins)
Margins sets marginTop, marginBottom, marginLeft and marginRight form fields. Default unit is inches.
func (HTMLRequest) Metadata ¶
func (req HTMLRequest) Metadata(jsonData []byte)
Metadata sets the metadata to write.
func (HTMLRequest) NativePageRanges ¶
func (req HTMLRequest) NativePageRanges(ranges string)
NativePageRanges sets the page ranges to print, e.g., "1-5, 8, 11-13". Empty means all pages.
func (HTMLRequest) OmitBackground ¶
func (req HTMLRequest) OmitBackground()
OmitBackground hides default white background and allows generating PDFs with transparency.
func (HTMLRequest) PaperSize ¶
func (req HTMLRequest) PaperSize(size PaperDimensions)
PaperSize sets paperWidth and paperHeight form fields with the provided unit. If unit is empty, it defaults to inches. Default is Letter (8.5 x 11 inches).
func (HTMLRequest) PdfA ¶
func (req HTMLRequest) PdfA(pdfa PdfAFormat)
PdfA sets the PDF/A format of the resulting PDF.
func (HTMLRequest) PdfUA ¶
func (req HTMLRequest) PdfUA()
PdfUA enables PDF for Universal Access for optimal accessibility.
func (HTMLRequest) PreferCSSPageSize ¶
func (req HTMLRequest) PreferCSSPageSize()
PreferCSSPageSize forces page size as defined by CSS.
func (HTMLRequest) PrintBackground ¶
func (req HTMLRequest) PrintBackground()
PrintBackground prints the background graphics.
func (HTMLRequest) Scale ¶
func (req HTMLRequest) Scale(factor float64)
Scale overrides the default scale of the page rendering (i.e., 1.0).
func (HTMLRequest) ScreenshotClip ¶
func (req HTMLRequest) ScreenshotClip()
ScreenshotClip defines whether to clip the screenshot according to the device dimensions.
func (HTMLRequest) ScreenshotHeight ¶
func (req HTMLRequest) ScreenshotHeight(height float64)
ScreenshotHeight sets the device screen height in pixels.
func (HTMLRequest) ScreenshotOptimizeForSpeed ¶
func (req HTMLRequest) ScreenshotOptimizeForSpeed()
ScreenshotOptimizeForSpeed defines whether to optimize image encoding for speed, not for resulting size.
func (HTMLRequest) ScreenshotQuality ¶
func (req HTMLRequest) ScreenshotQuality(quality int)
ScreenshotQuality sets the compression quality from range 0 to 100 (jpeg only).
func (HTMLRequest) ScreenshotWidth ¶
func (req HTMLRequest) ScreenshotWidth(width float64)
ScreenshotWidth Width sets the device screen width in pixels.
func (HTMLRequest) SinglePage ¶
func (req HTMLRequest) SinglePage()
SinglePage defines whether to print the entire content in one single page.
func (HTMLRequest) SkipNetworkIdleEvent ¶
func (req HTMLRequest) SkipNetworkIdleEvent()
SkipNetworkIdleEvent specifies whether Chromium have to wait or not for its network to be idle. Enabled by default in Gotenberg >= 8.11.0.
func (HTMLRequest) UserAgent ¶
func (req HTMLRequest) UserAgent(ua string)
UserAgent overrides the default User-Agent HTTP header.
func (HTMLRequest) WaitDelay ¶
WaitDelay sets the duration (i.e., "1s", "2ms", etc.) to wait when loading an HTML document before converting it to PDF.
func (HTMLRequest) WaitForExpression ¶
func (req HTMLRequest) WaitForExpression(expression string)
WaitForExpression sets the JavaScript expression to wait before converting an HTML document into PDF until it returns true.
type ImageFormat ¶
type ImageFormat string
const ( PNG ImageFormat = "png" JPEG ImageFormat = "jpeg" WebP ImageFormat = "webp" )
type MainRequester ¶
type MainRequester interface {
// contains filtered or unexported methods
}
MainRequester is a type for sending form fields and form files (documents) to the Gotenberg API.
type MarkdownRequest ¶
type MarkdownRequest struct {
// contains filtered or unexported fields
}
MarkdownRequest facilitates Markdown conversion with the Gotenberg API.
func NewMarkdownRequest ¶
func NewMarkdownRequest(index document.Document, markdowns ...document.Document) *MarkdownRequest
func (*MarkdownRequest) Assets ¶
func (req *MarkdownRequest) Assets(assets ...document.Document)
Assets sets assets form files.
func (MarkdownRequest) Cookies ¶
func (req MarkdownRequest) Cookies(cookies []byte)
Cookies to store in the Chromium cookie jar (JSON array format).
func (MarkdownRequest) EmulatePrintMediaType ¶
func (req MarkdownRequest) EmulatePrintMediaType()
EmulatePrintMediaType forces Chromium to emulate the media type "print".
func (MarkdownRequest) EmulateScreenMediaType ¶
func (req MarkdownRequest) EmulateScreenMediaType()
EmulateScreenMediaType forces Chromium to emulate the media type "screen".
func (MarkdownRequest) ExtraHTTPHeaders ¶
func (req MarkdownRequest) ExtraHTTPHeaders(headers []byte)
ExtraHTTPHeaders sets extra HTTP headers that Chromium will send when loading the HTML document.
func (MarkdownRequest) FailOnConsoleExceptions ¶
func (req MarkdownRequest) FailOnConsoleExceptions()
FailOnConsoleExceptions forces Gotenberg to return a 409 Conflict response if there are exceptions in the Chromium console.
func (MarkdownRequest) FailOnHTTPStatusCodes ¶
func (req MarkdownRequest) FailOnHTTPStatusCodes(statusCodes []byte)
FailOnHTTPStatusCodes forces Gotenberg to return a 409 Conflict response if the HTTP status code from the main page is not acceptable.
func (MarkdownRequest) Format ¶
func (req MarkdownRequest) Format(format ImageFormat)
Format sets the image compression format, either PNG, JPEG or WEBP. Default is PNG.
func (MarkdownRequest) Landscape ¶
func (req MarkdownRequest) Landscape()
Landscape sets the paper orientation to landscape.
func (MarkdownRequest) Margins ¶
func (req MarkdownRequest) Margins(margins PageMargins)
Margins sets marginTop, marginBottom, marginLeft and marginRight form fields. Default unit is inches.
func (*MarkdownRequest) Metadata ¶
func (req *MarkdownRequest) Metadata(jsonData []byte)
func (MarkdownRequest) NativePageRanges ¶
func (req MarkdownRequest) NativePageRanges(ranges string)
NativePageRanges sets the page ranges to print, e.g., "1-5, 8, 11-13". Empty means all pages.
func (MarkdownRequest) OmitBackground ¶
func (req MarkdownRequest) OmitBackground()
OmitBackground hides default white background and allows generating PDFs with transparency.
func (MarkdownRequest) PaperSize ¶
func (req MarkdownRequest) PaperSize(size PaperDimensions)
PaperSize sets paperWidth and paperHeight form fields with the provided unit. If unit is empty, it defaults to inches. Default is Letter (8.5 x 11 inches).
func (MarkdownRequest) PdfA ¶
func (req MarkdownRequest) PdfA(pdfa PdfAFormat)
PdfA sets the PDF/A format of the resulting PDF.
func (MarkdownRequest) PdfUA ¶
func (req MarkdownRequest) PdfUA()
PdfUA enables PDF for Universal Access for optimal accessibility.
func (MarkdownRequest) PreferCSSPageSize ¶
func (req MarkdownRequest) PreferCSSPageSize()
PreferCSSPageSize forces page size as defined by CSS.
func (MarkdownRequest) PrintBackground ¶
func (req MarkdownRequest) PrintBackground()
PrintBackground prints the background graphics.
func (MarkdownRequest) Scale ¶
func (req MarkdownRequest) Scale(factor float64)
Scale overrides the default scale of the page rendering (i.e., 1.0).
func (MarkdownRequest) ScreenshotClip ¶
func (req MarkdownRequest) ScreenshotClip()
ScreenshotClip defines whether to clip the screenshot according to the device dimensions.
func (MarkdownRequest) ScreenshotHeight ¶
func (req MarkdownRequest) ScreenshotHeight(height float64)
ScreenshotHeight sets the device screen height in pixels.
func (MarkdownRequest) ScreenshotOptimizeForSpeed ¶
func (req MarkdownRequest) ScreenshotOptimizeForSpeed()
ScreenshotOptimizeForSpeed defines whether to optimize image encoding for speed, not for resulting size.
func (MarkdownRequest) ScreenshotQuality ¶
func (req MarkdownRequest) ScreenshotQuality(quality int)
ScreenshotQuality sets the compression quality from range 0 to 100 (jpeg only).
func (MarkdownRequest) ScreenshotWidth ¶
func (req MarkdownRequest) ScreenshotWidth(width float64)
ScreenshotWidth Width sets the device screen width in pixels.
func (MarkdownRequest) SinglePage ¶
func (req MarkdownRequest) SinglePage()
SinglePage defines whether to print the entire content in one single page.
func (MarkdownRequest) SkipNetworkIdleEvent ¶
func (req MarkdownRequest) SkipNetworkIdleEvent()
SkipNetworkIdleEvent specifies whether Chromium have to wait or not for its network to be idle. Enabled by default in Gotenberg >= 8.11.0.
func (MarkdownRequest) UserAgent ¶
func (req MarkdownRequest) UserAgent(ua string)
UserAgent overrides the default User-Agent HTTP header.
func (MarkdownRequest) WaitDelay ¶
WaitDelay sets the duration (i.e., "1s", "2ms", etc.) to wait when loading an HTML document before converting it to PDF.
func (MarkdownRequest) WaitForExpression ¶
func (req MarkdownRequest) WaitForExpression(expression string)
WaitForExpression sets the JavaScript expression to wait before converting an HTML document into PDF until it returns true.
type MergeRequest ¶
type MergeRequest struct {
// contains filtered or unexported fields
}
MergeRequest facilitates work with PDF files with the Gotenberg API.
func NewMergeRequest ¶
func NewMergeRequest(pdfs ...document.Document) *MergeRequest
func (MergeRequest) DownloadFrom ¶
DownloadFrom sets the URLs to download files from. This method accepts a JSON string e.g., [{"url":"http://localhost:80/","extraHttpHeaders":{"X-Foo":"Bar"}}]. For Go, this is equivalent to map[string]map[string]string, which this method accepts, but headers map can be nil.
URLs MUST return a Content-Disposition header with a filename parameter.
func (*MergeRequest) Metadata ¶
func (req *MergeRequest) Metadata(md []byte)
Metadata sets the metadata to write.
func (MergeRequest) OutputFilename ¶
func (br MergeRequest) OutputFilename(filename string)
OutputFilename overrides the default UUID output filename.
NOTE: Gotenberg adds the file extension automatically; you don't have to set it.
func (*MergeRequest) PdfA ¶
func (req *MergeRequest) PdfA(pdfa PdfAFormat)
PdfA sets the PDF/A format of the resulting PDF.
func (*MergeRequest) PdfUA ¶
func (req *MergeRequest) PdfUA()
PdfUA enables PDF for Universal Access for optimal accessibility.
func (MergeRequest) SetWebhookErrorMethod ¶
func (br MergeRequest) SetWebhookErrorMethod(method string)
SetWebhookErrorMethod overrides the default HTTP method that Gotenberg will use to call the error webhook.
func (MergeRequest) SetWebhookExtraHeaders ¶
func (br MergeRequest) SetWebhookExtraHeaders(headers []byte)
SetWebhookExtraHeaders sets the extra HTTP headers that Gotenberg will send alongside the request to the webhook and error webhook.
func (MergeRequest) SetWebhookMethod ¶
func (br MergeRequest) SetWebhookMethod(method string)
SetWebhookMethod Overrides the default HTTP method that Gotenberg will use to call the webhook.
func (MergeRequest) Trace ¶
func (br MergeRequest) Trace(trace string)
Trace overrides the default UUID trace, or request ID, that identifies a request in Gotenberg's logs.
func (MergeRequest) UseBasicAuth ¶
func (br MergeRequest) UseBasicAuth(username, password string)
UseBasicAuth sets the basic authentication credentials.
func (MergeRequest) UseWebhook ¶
UseWebhook sets the callback and error callback that Gotenberg will use to send respectively the output file and the error response.
type OfficeRequest ¶
type OfficeRequest struct {
// contains filtered or unexported fields
}
OfficeRequest facilitates LibreOffice documents conversion with the Gotenberg API.
func NewOfficeRequest ¶
func NewOfficeRequest(docs ...document.Document) *OfficeRequest
func (*OfficeRequest) AddOriginalDocumentAsStream ¶
func (req *OfficeRequest) AddOriginalDocumentAsStream()
AddOriginalDocumentAsStream specifies that a stream is inserted to the PDF file which contains the original document for archiving purposes.
func (*OfficeRequest) AllowDuplicateFieldNames ¶
func (req *OfficeRequest) AllowDuplicateFieldNames()
AllowDuplicateFieldNames specifies whether multiple form fields exported are allowed to have the same field name.
func (*OfficeRequest) ConvertOooTargetToPdfTarget ¶
func (req *OfficeRequest) ConvertOooTargetToPdfTarget()
ConvertOooTargetToPdfTarget specifies that the target documents with .od[tpgs] extension, will have that extension changed to .pdf when the link is exported to PDF. The source document remains untouched.
func (OfficeRequest) DownloadFrom ¶
DownloadFrom sets the URLs to download files from. This method accepts a JSON string e.g., [{"url":"http://localhost:80/","extraHttpHeaders":{"X-Foo":"Bar"}}]. For Go, this is equivalent to map[string]map[string]string, which this method accepts, but headers map can be nil.
URLs MUST return a Content-Disposition header with a filename parameter.
func (*OfficeRequest) ExportBookmarks ¶
func (req *OfficeRequest) ExportBookmarks(export bool)
ExportBookmarks specifies if bookmarks are exported to PDF.
func (*OfficeRequest) ExportBookmarksToPdfDestination ¶
func (req *OfficeRequest) ExportBookmarksToPdfDestination()
ExportBookmarksToPdfDestination specifies that the bookmarks contained in the source LibreOffice file should be exported to the PDF file as Named Destination.
func (*OfficeRequest) ExportFormFields ¶
func (req *OfficeRequest) ExportFormFields(export bool)
ExportFormFields specifies whether form fields are exported as widgets or only their fixed print representation is exported.
func (*OfficeRequest) ExportHiddenSlides ¶
func (req *OfficeRequest) ExportHiddenSlides()
ExportHiddenSlides exports, for LibreOffice Impress, slides that are not included in slide shows.
func (*OfficeRequest) ExportLinksRelativeFsys ¶
func (req *OfficeRequest) ExportLinksRelativeFsys()
ExportLinksRelativeFsys specifies that the file system related hyperlinks (file:// protocol) present in the document will be exported as relative to the source document location.
func (*OfficeRequest) ExportNotes ¶
func (req *OfficeRequest) ExportNotes()
ExportNotes specifies if notes are exported to PDF.
func (*OfficeRequest) ExportNotesInMargin ¶
func (req *OfficeRequest) ExportNotesInMargin()
ExportNotesInMargin specifies if notes in margin are exported to PDF.
func (*OfficeRequest) ExportNotesPages ¶
func (req *OfficeRequest) ExportNotesPages()
ExportNotesPages specifies if notes pages are exported to PDF. Notes pages are available in Impress documents only.
func (*OfficeRequest) ExportOnlyNotesPages ¶
func (req *OfficeRequest) ExportOnlyNotesPages()
ExportOnlyNotesPages specifies, if the form field exportNotesPages is set to true, if only notes pages are exported to PDF.
func (*OfficeRequest) ExportPlaceholders ¶
func (req *OfficeRequest) ExportPlaceholders()
ExportPlaceholders exports the placeholders fields visual markings only. The exported placeholder is ineffective.
func (*OfficeRequest) Landscape ¶
func (req *OfficeRequest) Landscape()
Landscape sets the paper orientation to landscape.
func (*OfficeRequest) LosslessImageCompression ¶
func (req *OfficeRequest) LosslessImageCompression()
LosslessImageCompression specifies if images are exported to PDF using a lossless compression format like PNG or compressed using the JPEG format.
func (*OfficeRequest) MaxImageResolution ¶
func (req *OfficeRequest) MaxImageResolution(res int)
MaxImageResolution If the form field reduceImageResolution is set to true, tells if all images will be reduced to the given value in DPI. Possible values are: 75, 150, 300, 600 and 1200.
func (*OfficeRequest) Metadata ¶
func (req *OfficeRequest) Metadata(md []byte)
Metadata sets the metadata to write.
func (*OfficeRequest) NativePageRanges ¶
func (req *OfficeRequest) NativePageRanges(ranges string)
NativePageRanges sets the page ranges to print, e.g., "1-4". Empty means all pages.
func (OfficeRequest) OutputFilename ¶
func (br OfficeRequest) OutputFilename(filename string)
OutputFilename overrides the default UUID output filename.
NOTE: Gotenberg adds the file extension automatically; you don't have to set it.
func (*OfficeRequest) Password ¶
func (req *OfficeRequest) Password(password string)
Password sets the password for opening the source file.
func (*OfficeRequest) PdfA ¶
func (req *OfficeRequest) PdfA(pdfa PdfAFormat)
PdfA sets the PDF/A format of the resulting PDF.
func (*OfficeRequest) PdfUA ¶
func (req *OfficeRequest) PdfUA()
PdfUA enables PDF for Universal Access for optimal accessibility.
func (*OfficeRequest) Quality ¶
func (req *OfficeRequest) Quality(quality int)
Quality specifies the quality of the JPG export. A higher value produces a higher-quality image and a larger file. Between 1 and 100.
func (*OfficeRequest) ReduceImageResolution ¶
func (req *OfficeRequest) ReduceImageResolution()
ReduceImageResolution Specifies if the resolution of each image is reduced to the resolution specified by the form field maxImageResolution.
func (OfficeRequest) SetWebhookErrorMethod ¶
func (br OfficeRequest) SetWebhookErrorMethod(method string)
SetWebhookErrorMethod overrides the default HTTP method that Gotenberg will use to call the error webhook.
func (OfficeRequest) SetWebhookExtraHeaders ¶
func (br OfficeRequest) SetWebhookExtraHeaders(headers []byte)
SetWebhookExtraHeaders sets the extra HTTP headers that Gotenberg will send alongside the request to the webhook and error webhook.
func (OfficeRequest) SetWebhookMethod ¶
func (br OfficeRequest) SetWebhookMethod(method string)
SetWebhookMethod Overrides the default HTTP method that Gotenberg will use to call the webhook.
func (*OfficeRequest) SinglePageSheets ¶
func (req *OfficeRequest) SinglePageSheets()
SinglePageSheets ignores each sheet’s paper size, print ranges and shown/hidden status and puts every sheet (even hidden sheets) on exactly one page.
func (*OfficeRequest) SkipEmptyPages ¶
func (req *OfficeRequest) SkipEmptyPages()
SkipEmptyPages Specifies that automatically inserted empty pages are suppressed. This option is active only if storing Writer documents.
func (OfficeRequest) Trace ¶
func (br OfficeRequest) Trace(trace string)
Trace overrides the default UUID trace, or request ID, that identifies a request in Gotenberg's logs.
func (OfficeRequest) UseBasicAuth ¶
func (br OfficeRequest) UseBasicAuth(username, password string)
UseBasicAuth sets the basic authentication credentials.
func (OfficeRequest) UseWebhook ¶
UseWebhook sets the callback and error callback that Gotenberg will use to send respectively the output file and the error response.
type PageMargins ¶
type PaperDimensions ¶
type PdfAFormat ¶
type PdfAFormat string
const ( // Deprecated: Beginning with version 7.6, LibreOffice has discontinued support for PDF/A-1a. PdfA1b PdfAFormat = "PDF/A-1b" PdfA2b PdfAFormat = "PDF/A-2b" PdfA3b PdfAFormat = "PDF/A-3b" )
type ReadMetadataRequest ¶
type ReadMetadataRequest struct {
// contains filtered or unexported fields
}
func NewReadMetadataRequest ¶
func NewReadMetadataRequest(pdfs ...document.Document) *ReadMetadataRequest
func (ReadMetadataRequest) DownloadFrom ¶
DownloadFrom sets the URLs to download files from. This method accepts a JSON string e.g., [{"url":"http://localhost:80/","extraHttpHeaders":{"X-Foo":"Bar"}}]. For Go, this is equivalent to map[string]map[string]string, which this method accepts, but headers map can be nil.
URLs MUST return a Content-Disposition header with a filename parameter.
func (ReadMetadataRequest) OutputFilename ¶
func (br ReadMetadataRequest) OutputFilename(filename string)
OutputFilename overrides the default UUID output filename.
NOTE: Gotenberg adds the file extension automatically; you don't have to set it.
func (ReadMetadataRequest) SetWebhookErrorMethod ¶
func (br ReadMetadataRequest) SetWebhookErrorMethod(method string)
SetWebhookErrorMethod overrides the default HTTP method that Gotenberg will use to call the error webhook.
func (ReadMetadataRequest) SetWebhookExtraHeaders ¶
func (br ReadMetadataRequest) SetWebhookExtraHeaders(headers []byte)
SetWebhookExtraHeaders sets the extra HTTP headers that Gotenberg will send alongside the request to the webhook and error webhook.
func (ReadMetadataRequest) SetWebhookMethod ¶
func (br ReadMetadataRequest) SetWebhookMethod(method string)
SetWebhookMethod Overrides the default HTTP method that Gotenberg will use to call the webhook.
func (ReadMetadataRequest) Trace ¶
func (br ReadMetadataRequest) Trace(trace string)
Trace overrides the default UUID trace, or request ID, that identifies a request in Gotenberg's logs.
func (ReadMetadataRequest) UseBasicAuth ¶
func (br ReadMetadataRequest) UseBasicAuth(username, password string)
UseBasicAuth sets the basic authentication credentials.
func (ReadMetadataRequest) UseWebhook ¶
UseWebhook sets the callback and error callback that Gotenberg will use to send respectively the output file and the error response.
type ScreenshotRequester ¶
type ScreenshotRequester interface {
// contains filtered or unexported methods
}
type URLRequest ¶
type URLRequest struct {
// contains filtered or unexported fields
}
URLRequest facilitates remote URL conversion with the Gotenberg API.
func NewURLRequest ¶
func NewURLRequest(url string) *URLRequest
func (URLRequest) Cookies ¶
func (req URLRequest) Cookies(cookies []byte)
Cookies to store in the Chromium cookie jar (JSON array format).
func (URLRequest) EmulatePrintMediaType ¶
func (req URLRequest) EmulatePrintMediaType()
EmulatePrintMediaType forces Chromium to emulate the media type "print".
func (URLRequest) EmulateScreenMediaType ¶
func (req URLRequest) EmulateScreenMediaType()
EmulateScreenMediaType forces Chromium to emulate the media type "screen".
func (URLRequest) ExtraHTTPHeaders ¶
func (req URLRequest) ExtraHTTPHeaders(headers []byte)
ExtraHTTPHeaders sets extra HTTP headers that Chromium will send when loading the HTML document.
func (URLRequest) FailOnConsoleExceptions ¶
func (req URLRequest) FailOnConsoleExceptions()
FailOnConsoleExceptions forces Gotenberg to return a 409 Conflict response if there are exceptions in the Chromium console.
func (URLRequest) FailOnHTTPStatusCodes ¶
func (req URLRequest) FailOnHTTPStatusCodes(statusCodes []byte)
FailOnHTTPStatusCodes forces Gotenberg to return a 409 Conflict response if the HTTP status code from the main page is not acceptable.
func (URLRequest) Format ¶
func (req URLRequest) Format(format ImageFormat)
Format sets the image compression format, either PNG, JPEG or WEBP. Default is PNG.
func (URLRequest) Landscape ¶
func (req URLRequest) Landscape()
Landscape sets the paper orientation to landscape.
func (URLRequest) Margins ¶
func (req URLRequest) Margins(margins PageMargins)
Margins sets marginTop, marginBottom, marginLeft and marginRight form fields. Default unit is inches.
func (*URLRequest) Metadata ¶
func (req *URLRequest) Metadata(jsonData []byte)
func (URLRequest) NativePageRanges ¶
func (req URLRequest) NativePageRanges(ranges string)
NativePageRanges sets the page ranges to print, e.g., "1-5, 8, 11-13". Empty means all pages.
func (URLRequest) OmitBackground ¶
func (req URLRequest) OmitBackground()
OmitBackground hides default white background and allows generating PDFs with transparency.
func (URLRequest) PaperSize ¶
func (req URLRequest) PaperSize(size PaperDimensions)
PaperSize sets paperWidth and paperHeight form fields with the provided unit. If unit is empty, it defaults to inches. Default is Letter (8.5 x 11 inches).
func (URLRequest) PdfA ¶
func (req URLRequest) PdfA(pdfa PdfAFormat)
PdfA sets the PDF/A format of the resulting PDF.
func (URLRequest) PdfUA ¶
func (req URLRequest) PdfUA()
PdfUA enables PDF for Universal Access for optimal accessibility.
func (URLRequest) PreferCSSPageSize ¶
func (req URLRequest) PreferCSSPageSize()
PreferCSSPageSize forces page size as defined by CSS.
func (URLRequest) PrintBackground ¶
func (req URLRequest) PrintBackground()
PrintBackground prints the background graphics.
func (URLRequest) Scale ¶
func (req URLRequest) Scale(factor float64)
Scale overrides the default scale of the page rendering (i.e., 1.0).
func (URLRequest) ScreenshotClip ¶
func (req URLRequest) ScreenshotClip()
ScreenshotClip defines whether to clip the screenshot according to the device dimensions.
func (URLRequest) ScreenshotHeight ¶
func (req URLRequest) ScreenshotHeight(height float64)
ScreenshotHeight sets the device screen height in pixels.
func (URLRequest) ScreenshotOptimizeForSpeed ¶
func (req URLRequest) ScreenshotOptimizeForSpeed()
ScreenshotOptimizeForSpeed defines whether to optimize image encoding for speed, not for resulting size.
func (URLRequest) ScreenshotQuality ¶
func (req URLRequest) ScreenshotQuality(quality int)
ScreenshotQuality sets the compression quality from range 0 to 100 (jpeg only).
func (URLRequest) ScreenshotWidth ¶
func (req URLRequest) ScreenshotWidth(width float64)
ScreenshotWidth Width sets the device screen width in pixels.
func (URLRequest) SinglePage ¶
func (req URLRequest) SinglePage()
SinglePage defines whether to print the entire content in one single page.
func (URLRequest) SkipNetworkIdleEvent ¶
func (req URLRequest) SkipNetworkIdleEvent()
SkipNetworkIdleEvent specifies whether Chromium have to wait or not for its network to be idle. Enabled by default in Gotenberg >= 8.11.0.
func (URLRequest) UserAgent ¶
func (req URLRequest) UserAgent(ua string)
UserAgent overrides the default User-Agent HTTP header.
func (URLRequest) WaitDelay ¶
WaitDelay sets the duration (i.e., "1s", "2ms", etc.) to wait when loading an HTML document before converting it to PDF.
func (URLRequest) WaitForExpression ¶
func (req URLRequest) WaitForExpression(expression string)
WaitForExpression sets the JavaScript expression to wait before converting an HTML document into PDF until it returns true.
type WriteMetadataRequest ¶
type WriteMetadataRequest struct {
// contains filtered or unexported fields
}
func NewWriteMetadataRequest ¶
func NewWriteMetadataRequest(pdfs ...document.Document) *WriteMetadataRequest
func (WriteMetadataRequest) DownloadFrom ¶
DownloadFrom sets the URLs to download files from. This method accepts a JSON string e.g., [{"url":"http://localhost:80/","extraHttpHeaders":{"X-Foo":"Bar"}}]. For Go, this is equivalent to map[string]map[string]string, which this method accepts, but headers map can be nil.
URLs MUST return a Content-Disposition header with a filename parameter.
func (*WriteMetadataRequest) Metadata ¶
func (wmd *WriteMetadataRequest) Metadata(md []byte)
func (WriteMetadataRequest) OutputFilename ¶
func (br WriteMetadataRequest) OutputFilename(filename string)
OutputFilename overrides the default UUID output filename.
NOTE: Gotenberg adds the file extension automatically; you don't have to set it.
func (WriteMetadataRequest) SetWebhookErrorMethod ¶
func (br WriteMetadataRequest) SetWebhookErrorMethod(method string)
SetWebhookErrorMethod overrides the default HTTP method that Gotenberg will use to call the error webhook.
func (WriteMetadataRequest) SetWebhookExtraHeaders ¶
func (br WriteMetadataRequest) SetWebhookExtraHeaders(headers []byte)
SetWebhookExtraHeaders sets the extra HTTP headers that Gotenberg will send alongside the request to the webhook and error webhook.
func (WriteMetadataRequest) SetWebhookMethod ¶
func (br WriteMetadataRequest) SetWebhookMethod(method string)
SetWebhookMethod Overrides the default HTTP method that Gotenberg will use to call the webhook.
func (WriteMetadataRequest) Trace ¶
func (br WriteMetadataRequest) Trace(trace string)
Trace overrides the default UUID trace, or request ID, that identifies a request in Gotenberg's logs.
func (WriteMetadataRequest) UseBasicAuth ¶
func (br WriteMetadataRequest) UseBasicAuth(username, password string)
UseBasicAuth sets the basic authentication credentials.
func (WriteMetadataRequest) UseWebhook ¶
UseWebhook sets the callback and error callback that Gotenberg will use to send respectively the output file and the error response.