Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
21 / 21 |
|
100.00% |
9 / 9 |
CRAP | |
100.00% |
1 / 1 |
| PdfXProfile | |
100.00% |
21 / 21 |
|
100.00% |
9 / 9 |
21 | |
100.00% |
1 / 1 |
| getFamily | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getLevel | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getPdfVersion | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
3 | |||
| getXmpNamespace | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getXmpPrefix | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getXmpProperties | |
100.00% |
7 / 7 |
|
100.00% |
1 / 1 |
7 | |||
| prohibitsTransparency | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
3 | |||
| getOutputIntentSubtype | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| supportsReferenceXObjects | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
3 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Phpdftk\Pdf\Conformance\Profile; |
| 6 | |
| 7 | use Phpdftk\Pdf\Core\PdfVersion; |
| 8 | |
| 9 | /** |
| 10 | * PDF/X conformance profiles (ISO 15930). |
| 11 | * |
| 12 | * PDF/X-1a:2003 (ISO 15930-4): CMYK+spot only, no transparency, PDF 1.3 |
| 13 | * PDF/X-3:2003 (ISO 15930-6): ICC-based color allowed, PDF 1.3 |
| 14 | * PDF/X-4 (ISO 15930-7): transparency allowed, PDF 1.6 |
| 15 | * PDF/X-5g (ISO 15930-8): external graphical content, PDF 1.6 |
| 16 | * PDF/X-5pg (ISO 15930-8): partial external graphical content, PDF 1.6 |
| 17 | * PDF/X-5n (ISO 15930-9): n-color external content, PDF 1.6 |
| 18 | */ |
| 19 | enum PdfXProfile: string implements ConformanceProfile |
| 20 | { |
| 21 | case X1a2003 = 'X-1a:2003'; |
| 22 | case X32003 = 'X-3:2003'; |
| 23 | case X4 = 'X-4'; |
| 24 | case X5g = 'X-5g'; |
| 25 | case X5pg = 'X-5pg'; |
| 26 | case X5n = 'X-5n'; |
| 27 | |
| 28 | public function getFamily(): string |
| 29 | { |
| 30 | return 'PDF/X'; |
| 31 | } |
| 32 | |
| 33 | public function getLevel(): string |
| 34 | { |
| 35 | return $this->value; |
| 36 | } |
| 37 | |
| 38 | public function getPdfVersion(): PdfVersion |
| 39 | { |
| 40 | return match ($this) { |
| 41 | self::X1a2003, self::X32003 => PdfVersion::V1_3, |
| 42 | self::X4, self::X5g, self::X5pg, self::X5n => PdfVersion::V1_6, |
| 43 | }; |
| 44 | } |
| 45 | |
| 46 | public function getXmpNamespace(): string |
| 47 | { |
| 48 | return 'http://www.npes.org/pdfx/ns/id/'; |
| 49 | } |
| 50 | |
| 51 | public function getXmpPrefix(): string |
| 52 | { |
| 53 | return 'pdfxid'; |
| 54 | } |
| 55 | |
| 56 | public function getXmpProperties(): array |
| 57 | { |
| 58 | return ['GTS_PDFXVersion' => match ($this) { |
| 59 | self::X1a2003 => 'PDF/X-1a:2003', |
| 60 | self::X32003 => 'PDF/X-3:2003', |
| 61 | self::X4 => 'PDF/X-4', |
| 62 | self::X5g => 'PDF/X-5g', |
| 63 | self::X5pg => 'PDF/X-5pg', |
| 64 | self::X5n => 'PDF/X-5n', |
| 65 | }]; |
| 66 | } |
| 67 | |
| 68 | /** Whether this profile prohibits transparency. */ |
| 69 | public function prohibitsTransparency(): bool |
| 70 | { |
| 71 | return match ($this) { |
| 72 | self::X1a2003, self::X32003 => true, |
| 73 | self::X4, self::X5g, self::X5pg, self::X5n => false, |
| 74 | }; |
| 75 | } |
| 76 | |
| 77 | /** The required OutputIntent /S subtype value. */ |
| 78 | public function getOutputIntentSubtype(): string |
| 79 | { |
| 80 | return 'GTS_PDFX'; |
| 81 | } |
| 82 | |
| 83 | /** Whether this profile supports reference XObjects for external content. */ |
| 84 | public function supportsReferenceXObjects(): bool |
| 85 | { |
| 86 | return match ($this) { |
| 87 | self::X5g, self::X5pg, self::X5n => true, |
| 88 | default => false, |
| 89 | }; |
| 90 | } |
| 91 | } |