« lib/PDF/FromHTML/Template/Container/Row.pm
↑ Summary
lib/PDF/FromHTML/Template/Container/Always.pm »
| 1 | package PDF::FromHTML::Template::Constants; | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | |||
| 5 | BEGIN { | ||
| 6 | use Exporter (); | ||
| 7 | |||
| 8 | use vars qw(@ISA @EXPORT_OK); | ||
| 9 | |||
| 10 | @ISA = qw(Exporter); | ||
| 11 | |||
| 12 | @EXPORT_OK = qw( | ||
| 13 | %PointsPer | ||
| 14 | %Verify | ||
| 15 | ); | ||
| 16 | } | ||
| 17 | |||
| 18 | # This is a list of conversions from various units of measure to points. | ||
| 19 | # The key will be the first letter of the unit. | ||
| 20 | our %PointsPer = ( | ||
| 21 | I => 72.27, # Inches | ||
| 22 | P => 1, # Points | ||
| 23 | ); | ||
| 24 | $PointsPer{C} = ($PointsPer{I} / 2.54); # Centimeters | ||
| 25 | |||
| 26 | #GGG Add: | ||
| 27 | # PDFTemplate properties (to go with %NoSetProperty) | ||
| 28 | |||
| 29 | our %Verify = ( | ||
| 30 | |||
| 31 | #GGG This also needs improvement ... Not all available fonts are listed | ||
| 32 | 'FACE' => { | ||
| 33 | '__DEFAULT__' => 'Times-Bold', | ||
| 34 | ( map { $_ => 1 } qw( | ||
| 35 | Courier Courier-Bold Courier-Oblique Courier-BoldOblique | ||
| 36 | Helvetica Helvetica-Bold Helvetica-Oblique Helvetica-BoldOblique | ||
| 37 | Times-Roman Times-Bold Times-Italic Times-BoldItalic | ||
| 38 | Symbol ZapfDingbats | ||
| 39 | )), | ||
| 40 | }, | ||
| 41 | |||
| 42 | 'ALIGN' => { | ||
| 43 | '__DEFAULT__' => 'left', | ||
| 44 | #GGG Add a full-justify option - this requires a lot of coding prowess | ||
| 45 | ( map { $_ => 1 } qw( | ||
| 46 | center left right | ||
| 47 | )), | ||
| 48 | }, | ||
| 49 | |||
| 50 | 'OPENACTION' => { | ||
| 51 | '__DEFAULT__' => 'fitpage', | ||
| 52 | ( map { $_ => 1 } qw( | ||
| 53 | fitbox fitheight fitpage fitwidth retain | ||
| 54 | )), | ||
| 55 | }, | ||
| 56 | |||
| 57 | 'OPENMODE' => { | ||
| 58 | '__DEFAULT__' => 'none', | ||
| 59 | ( map { $_ => 1 } qw( | ||
| 60 | bookmarks fullscreen none thumbnails | ||
| 61 | )), | ||
| 62 | }, | ||
| 63 | |||
| 64 | # Pagesize is specified in points | ||
| 65 | 'PAGESIZE' => { | ||
| 66 | '__DEFAULT__' => 'Letter', | ||
| 67 | 'Letter' => { | ||
| 68 | PAGE_WIDTH => 8.5 * $PointsPer{I}, | ||
| 69 | PAGE_HEIGHT => 11 * $PointsPer{I}, | ||
| 70 | }, | ||
| 71 | 'Legal' => { | ||
| 72 | PAGE_WIDTH => 8.5 * $PointsPer{I}, | ||
| 73 | PAGE_HEIGHT => 14 * $PointsPer{I}, | ||
| 74 | }, | ||
| 75 | 'A0' => { | ||
| 76 | PAGE_WIDTH => 2380, | ||
| 77 | PAGE_HEIGHT => 3368, | ||
| 78 | }, | ||
| 79 | 'A1' => { | ||
| 80 | PAGE_WIDTH => 1684, | ||
| 81 | PAGE_HEIGHT => 2380, | ||
| 82 | }, | ||
| 83 | 'A2' => { | ||
| 84 | PAGE_WIDTH => 1190, | ||
| 85 | PAGE_HEIGHT => 1684, | ||
| 86 | }, | ||
| 87 | 'A3' => { | ||
| 88 | PAGE_WIDTH => 842, | ||
| 89 | PAGE_HEIGHT => 1190, | ||
| 90 | }, | ||
| 91 | 'A4' => { | ||
| 92 | PAGE_WIDTH => 595, | ||
| 93 | PAGE_HEIGHT => 842, | ||
| 94 | }, | ||
| 95 | }, | ||
| 96 | ); | ||
| 97 | |||
| 98 | 1; | ||
| 99 | __END__ |