feat: add Go, PHP, and Laravel SDKs
Some checks failed
Build & Deploy to Staging / Build & Deploy to Staging (push) Has been cancelled
Some checks failed
Build & Deploy to Staging / Build & Deploy to Staging (push) Has been cancelled
- Go SDK: zero deps, functional options pattern, full endpoint coverage - PHP SDK: PHP 8.1+, curl-based, PdfOptions class, PSR-4 autoloading - Laravel package: ServiceProvider, Facade, config publishing - All SDKs document complete PDF options including new v0.4.5 params
This commit is contained in:
parent
1545df9a7b
commit
bc67c52d3a
13 changed files with 1133 additions and 0 deletions
65
sdk/php/src/PdfOptions.php
Normal file
65
sdk/php/src/PdfOptions.php
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DocFast;
|
||||
|
||||
/**
|
||||
* PDF generation options.
|
||||
*/
|
||||
class PdfOptions
|
||||
{
|
||||
/** Page size: A4, Letter, Legal, A3, A5, Tabloid. Ignored if width/height set. */
|
||||
public ?string $format = null;
|
||||
|
||||
/** Landscape orientation. */
|
||||
public ?bool $landscape = null;
|
||||
|
||||
/** Page margins using CSS units (e.g. "20mm"). */
|
||||
public ?array $margin = null;
|
||||
|
||||
/** Print background graphics and colors. */
|
||||
public ?bool $printBackground = null;
|
||||
|
||||
/** Suggested filename for the PDF download. */
|
||||
public ?string $filename = null;
|
||||
|
||||
/** HTML template for page header. Requires displayHeaderFooter: true. */
|
||||
public ?string $headerTemplate = null;
|
||||
|
||||
/** HTML template for page footer. */
|
||||
public ?string $footerTemplate = null;
|
||||
|
||||
/** Show header and footer templates. */
|
||||
public ?bool $displayHeaderFooter = null;
|
||||
|
||||
/** Scale of webpage rendering (0.1 to 2.0). */
|
||||
public ?float $scale = null;
|
||||
|
||||
/** Paper ranges to print, e.g. "1-3,5". */
|
||||
public ?string $pageRanges = null;
|
||||
|
||||
/** Give CSS @page size priority over format. */
|
||||
public ?bool $preferCSSPageSize = null;
|
||||
|
||||
/** Paper width with units (e.g. "8.5in"). Overrides format. */
|
||||
public ?string $width = null;
|
||||
|
||||
/** Paper height with units (e.g. "11in"). Overrides format. */
|
||||
public ?string $height = null;
|
||||
|
||||
public function toArray(): array
|
||||
{
|
||||
$data = [];
|
||||
foreach ([
|
||||
'format', 'landscape', 'margin', 'printBackground', 'filename',
|
||||
'headerTemplate', 'footerTemplate', 'displayHeaderFooter',
|
||||
'scale', 'pageRanges', 'preferCSSPageSize', 'width', 'height',
|
||||
] as $key) {
|
||||
if ($this->$key !== null) {
|
||||
$data[$key] = $this->$key;
|
||||
}
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue