Skip to content

Commit

Permalink
Merge pull request #511 from KnpLabs/v2-unstable-wkhtmltopdf-page-opt…
Browse files Browse the repository at this point in the history
…ions

feat(page-options): add page options classes for wkhtmltopdf
  • Loading branch information
alexpozzi authored Oct 17, 2024
2 parents fc1e374 + ffa4ace commit c94f35b
Show file tree
Hide file tree
Showing 44 changed files with 986 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/Backend/WkHtmlToPdf/ExtraOption/Allow.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

declare(strict_types=1);

namespace KNPLabs\Snappy\Backend\WkHtmlToPdf\ExtraOption;

use KNPLabs\Snappy\Backend\WkHtmlToPdf\ExtraOption;

class Allow implements ExtraOption
{
public function __construct(private readonly string $path)
{
}

public function isRepeatable(): bool
{
return true;
}

public function compile(): array
{
return ['--allow', $this->path];
}
}
24 changes: 24 additions & 0 deletions src/Backend/WkHtmlToPdf/ExtraOption/BypassProxyFor.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

declare(strict_types=1);

namespace KNPLabs\Snappy\Backend\WkHtmlToPdf\ExtraOption;

use KNPLabs\Snappy\Backend\WkHtmlToPdf\ExtraOption;

class BypassProxyFor implements ExtraOption
{
public function __construct(private readonly string $value)
{
}

public function isRepeatable(): bool
{
return true;
}

public function compile(): array
{
return ['--bypass-proxy-for', $this->value];
}
}
24 changes: 24 additions & 0 deletions src/Backend/WkHtmlToPdf/ExtraOption/CacheDir.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

declare(strict_types=1);

namespace KNPLabs\Snappy\Backend\WkHtmlToPdf\ExtraOption;

use KNPLabs\Snappy\Backend\WkHtmlToPdf\ExtraOption;

class CacheDir implements ExtraOption
{
public function __construct(private readonly string $path)
{
}

public function isRepeatable(): bool
{
return false;
}

public function compile(): array
{
return ['--cache-dir', $this->path];
}
}
24 changes: 24 additions & 0 deletions src/Backend/WkHtmlToPdf/ExtraOption/CheckBoxSvg.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

declare(strict_types=1);

namespace KNPLabs\Snappy\Backend\WkHtmlToPdf\ExtraOption;

use KNPLabs\Snappy\Backend\WkHtmlToPdf\ExtraOption;

class CheckBoxSvg implements ExtraOption
{
public function __construct(private readonly string $path)
{
}

public function isRepeatable(): bool
{
return false;
}

public function compile(): array
{
return ['--checkbox-svg', $this->path];
}
}
24 changes: 24 additions & 0 deletions src/Backend/WkHtmlToPdf/ExtraOption/CheckboxCheckedSvg.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

declare(strict_types=1);

namespace KNPLabs\Snappy\Backend\WkHtmlToPdf\ExtraOption;

use KNPLabs\Snappy\Backend\WkHtmlToPdf\ExtraOption;

class CheckboxCheckedSvg implements ExtraOption
{
public function __construct(private readonly string $path)
{
}

public function isRepeatable(): bool
{
return false;
}

public function compile(): array
{
return ['--checkbox-checked-svg', $this->path];
}
}
24 changes: 24 additions & 0 deletions src/Backend/WkHtmlToPdf/ExtraOption/Cookie.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

declare(strict_types=1);

namespace KNPLabs\Snappy\Backend\WkHtmlToPdf\ExtraOption;

use KNPLabs\Snappy\Backend\WkHtmlToPdf\ExtraOption;

class Cookie implements ExtraOption
{
public function __construct(private readonly string $name, private readonly string $value)
{
}

public function isRepeatable(): bool
{
return true;
}

public function compile(): array
{
return ['--cookie', $this->name, $this->value];
}
}
24 changes: 24 additions & 0 deletions src/Backend/WkHtmlToPdf/ExtraOption/CustomHeader.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

declare(strict_types=1);

namespace KNPLabs\Snappy\Backend\WkHtmlToPdf\ExtraOption;

use KNPLabs\Snappy\Backend\WkHtmlToPdf\ExtraOption;

class CustomHeader implements ExtraOption
{
public function __construct(private readonly string $name, private readonly string $value)
{
}

public function isRepeatable(): bool
{
return true;
}

public function compile(): array
{
return ['--custom-header', $this->name, $this->value];
}
}
20 changes: 20 additions & 0 deletions src/Backend/WkHtmlToPdf/ExtraOption/CustomHeaderPropagation.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

declare(strict_types=1);

namespace KNPLabs\Snappy\Backend\WkHtmlToPdf\ExtraOption;

use KNPLabs\Snappy\Backend\WkHtmlToPdf\ExtraOption;

class CustomHeaderPropagation implements ExtraOption
{
public function isRepeatable(): bool
{
return false;
}

public function compile(): array
{
return ['--custom-header-propagation'];
}
}
20 changes: 20 additions & 0 deletions src/Backend/WkHtmlToPdf/ExtraOption/DefaultHeader.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

declare(strict_types=1);

namespace KNPLabs\Snappy\Backend\WkHtmlToPdf\ExtraOption;

use KNPLabs\Snappy\Backend\WkHtmlToPdf\ExtraOption;

class DefaultHeader implements ExtraOption
{
public function isRepeatable(): bool
{
return false;
}

public function compile(): array
{
return ['--default-header'];
}
}
20 changes: 20 additions & 0 deletions src/Backend/WkHtmlToPdf/ExtraOption/DisableExternalLinks.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

declare(strict_types=1);

namespace KNPLabs\Snappy\Backend\WkHtmlToPdf\ExtraOption;

use KNPLabs\Snappy\Backend\WkHtmlToPdf\ExtraOption;

class DisableExternalLinks implements ExtraOption
{
public function isRepeatable(): bool
{
return false;
}

public function compile(): array
{
return ['--disable-external-links'];
}
}
20 changes: 20 additions & 0 deletions src/Backend/WkHtmlToPdf/ExtraOption/DisableInternalLinks.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

declare(strict_types=1);

namespace KNPLabs\Snappy\Backend\WkHtmlToPdf\ExtraOption;

use KNPLabs\Snappy\Backend\WkHtmlToPdf\ExtraOption;

class DisableInternalLinks implements ExtraOption
{
public function isRepeatable(): bool
{
return false;
}

public function compile(): array
{
return ['--disable-internal-links'];
}
}
20 changes: 20 additions & 0 deletions src/Backend/WkHtmlToPdf/ExtraOption/DisableJavascript.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

declare(strict_types=1);

namespace KNPLabs\Snappy\Backend\WkHtmlToPdf\ExtraOption;

use KNPLabs\Snappy\Backend\WkHtmlToPdf\ExtraOption;

class DisableJavascript implements ExtraOption
{
public function isRepeatable(): bool
{
return false;
}

public function compile(): array
{
return ['--disable-javascript'];
}
}
20 changes: 20 additions & 0 deletions src/Backend/WkHtmlToPdf/ExtraOption/DisableSmartShrinking.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

declare(strict_types=1);

namespace KNPLabs\Snappy\Backend\WkHtmlToPdf\ExtraOption;

use KNPLabs\Snappy\Backend\WkHtmlToPdf\ExtraOption;

class DisableSmartShrinking implements ExtraOption
{
public function isRepeatable(): bool
{
return false;
}

public function compile(): array
{
return ['--disable-smart-shrinking'];
}
}
20 changes: 20 additions & 0 deletions src/Backend/WkHtmlToPdf/ExtraOption/EnableForms.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

declare(strict_types=1);

namespace KNPLabs\Snappy\Backend\WkHtmlToPdf\ExtraOption;

use KNPLabs\Snappy\Backend\WkHtmlToPdf\ExtraOption;

class EnableForms implements ExtraOption
{
public function isRepeatable(): bool
{
return false;
}

public function compile(): array
{
return ['--enable-forms'];
}
}
20 changes: 20 additions & 0 deletions src/Backend/WkHtmlToPdf/ExtraOption/EnableLocalFileAccess.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

declare(strict_types=1);

namespace KNPLabs\Snappy\Backend\WkHtmlToPdf\ExtraOption;

use KNPLabs\Snappy\Backend\WkHtmlToPdf\ExtraOption;

class EnableLocalFileAccess implements ExtraOption
{
public function isRepeatable(): bool
{
return false;
}

public function compile(): array
{
return ['--enable-local-file-access'];
}
}
20 changes: 20 additions & 0 deletions src/Backend/WkHtmlToPdf/ExtraOption/EnablePlugins.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

declare(strict_types=1);

namespace KNPLabs\Snappy\Backend\WkHtmlToPdf\ExtraOption;

use KNPLabs\Snappy\Backend\WkHtmlToPdf\ExtraOption;

class EnablePlugins implements ExtraOption
{
public function isRepeatable(): bool
{
return false;
}

public function compile(): array
{
return ['--enable-plugins'];
}
}
Loading

0 comments on commit c94f35b

Please sign in to comment.