Skip to main content
Use AvraAPI::utilities() for the four released Utility operations. Image and binary-PDF modes return BinaryResponse; Base64 modes return ApiResponse. Choose the response type before you write application handling code. The Laravel package discovers the AvraAPI Facade alias automatically. Import Avraapi\Laravel\Facades\AvraAPI when you prefer an explicit dependency for IDE and static-analysis support.
Generated output can contain customer or business data. Keep Utility calls and generated media in your backend. Use AvraAPI::utilities()->withPrivacyMode() immediately before an operation when the request needs the shared AvraAPI privacy guarantee. It sends X-Privacy-Mode: 1 only for the next request and then clears automatically. Existing privacyMode: true method arguments remain supported.

Generate a QR code

generateQr() accepts text, a URL, or a vCard value. Its complete signature is: SDK function
Copy the SDK call
Optional format, size, colour, logo, and privacy settings are available in the full signature below.
Use png (the default) or svg for BinaryResponse; use base64 for an ApiResponse containing a PNG data URI.
Return a styled PNG QR code from Laravel

PNG or SVG response

For png, the success body is the PNG bytes with Content-Type: image/png. For svg, it is SVG media with Content-Type: image/svg+xml. The SDK exposes the exact body in $response->body, MIME type in $response->contentType, byte count in $response->size, and the optional request trace in $response->requestId.
Read a Base64 QR response

Base64 response

logoUrl must be a public HTTP or HTTPS image that AvraAPI can fetch. It is applied to PNG and Base64 output; SVG does not include the logo. See Generate a QR code for validation and media-response details.

Generate a barcode

generateBarcode() always returns BinaryResponse; barcode generation has no Base64 SDK response mode. SDK function
Copy the SDK call
Optional barcode type, media format, dimensions, and privacy settings are available in the full signature below.
The SDK exposes the type, format, height, widthFactor, and privacyMode options shown above. C128 and png are the defaults.
Return a barcode image from Laravel

PNG or SVG response

For png, the successful response body is barcode media with Content-Type: image/png; for svg, it is image/svg+xml. Do not try to read the media body as JSON. Use saveAs(), send $response->body into your own image response, or use toDataUri() when your backend needs to embed it. The full barcode type list and type-specific validation rules are in Generate a barcode.

Generate a PDF from HTML

generatePdf() renders HTML to a PDF. Use binary (the default) for BinaryResponse, or base64 for JSON with Base64 PDF bytes. SDK function
Copy the SDK call
Optional response type, page, margin, encoding, and privacy settings are available in the full signature below.
$margins accepts top, right, bottom, and left values in millimetres. When $isBase64 is true, pass a Base64-encoded HTML value as $html.
Return a binary PDF from Laravel

Binary PDF response

With responseType: 'binary', the success body is PDF media with Content-Type: application/pdf. The BinaryResponse exposes the raw PDF as body; it is not a JSON object.
Read a Base64 PDF response

Base64 response

The Base64 value is document data, not a download URL. Decode and store or stream it only in a protected application context. See Generate a PDF for the complete HTML, privacy, and response contract.

Generate a PDF from raw HTML with Base64 transport

generatePdfFromBase64() is a convenience wrapper for complex HTML. Pass raw, unencoded HTML; the SDK Base64-encodes it and calls generatePdf() with isBase64: true. SDK function
Copy the SDK call
Optional response type, page, margin, and privacy settings are available in the full signature below.
Render complex HTML without manual encoding

Response

The response follows the same documented binary or Base64 shapes as generatePdf(), selected by responseType. Use the binary PDF handling or Base64 JSON handling above; do not Base64-encode the HTML yourself before calling this convenience method.

Handle Utility errors

All Utility methods throw typed SDK exceptions for non-success responses. Keep the request ID when available, avoid placing generated customer data into logs, and use the shared pattern in Laravel Overview and setup.
Last modified on October 1, 2026