Compare View
Commits (2)
Diff
Showing 1 changed file Side-by-side Diff
table_demo
View file @
ab54ad1
... | ... | @@ -37,6 +37,11 @@ try { |
37 | 37 | // set up some PDFlib options |
38 | 38 | $pdf->set_option("errorpolicy=return"); |
39 | 39 | $pdf->set_option("stringformat=utf8"); |
40 | + // all paths in 'searchpath' need to be inside curly braces | |
41 | + // multiple curly-braced paths in $searchpath need to be separated with | |
42 | + // space characters | |
43 | + $searchpath = '{/usr/share/fonts/dejavu/}{' . __DIR__ . '/fonts}'; | |
44 | + $pdf->set_option("searchpath={" . $searchpath . "}"); | |
40 | 45 | |
41 | 46 | if ($pdf->begin_document($outfile, "") == 0) |
42 | 47 | throw new Exception("Error: " . $pdf->get_errmsg()); |
... | ... | @@ -48,11 +53,11 @@ try { |
48 | 53 | $pdf->set_info('Subject', 'IODP Proposals'); |
49 | 54 | $pdf->set_info('Keywords', 'IODP proposal ocean drilling core expedition'); |
50 | 55 | |
51 | - $textOpts = "fontname={Helvetica} embedding fontsize=20 " | |
56 | + $textOpts = "fontname={FreeSans} embedding fontsize=20 " | |
52 | 57 | . "encoding=unicode "; |
53 | 58 | |
54 | 59 | // START PAGE 1 |
55 | - $pdf->begin_page_ext(612, 792, ''); | |
60 | + $pdf->begin_page_ext(0, 0, 'width=letter.width, height=letter.height'); | |
56 | 61 | |
57 | 62 | // create bookmarks first thing |
58 | 63 | $action = $pdf->create_action("GoTo", "destination={page=1}"); |
... | ... | @@ -63,7 +68,6 @@ try { |
63 | 68 | // bookmark |
64 | 69 | $pdf->create_bookmark("Page 2", " action={activate= " . $action . "}"); |
65 | 70 | |
66 | - | |
67 | 71 | // text/image |
68 | 72 | $pdf->fit_textline("Jump to SSF for SHACK-10A", 20, 750, |
69 | 73 | $textOpts . " underline=true matchbox={name=to_second_page}"); |
... | ... | @@ -98,6 +102,9 @@ try { |
98 | 102 | $pdf->close_pdi_document($ssfPDF); |
99 | 103 | |
100 | 104 | // write some text on to the page |
105 | + // for landscape mode... | |
106 | + //$pdf->fit_textline("Back to Top", 20, 570, | |
107 | + //$linkOpts = linkAttribs(1, 750); | |
101 | 108 | $action = $pdf->create_action("GoTo", "destination={page=1}"); |
102 | 109 | $pdf->fit_textline("Back to Top", 20, $ssfHeight - 30, |
103 | 110 | $textOpts . " underline=true matchbox={name=to_first_page}"); |
... | ... | @@ -111,20 +118,23 @@ try { |
111 | 118 | $pdf->end_page_ext(''); |
112 | 119 | |
113 | 120 | // START PAGE 3 |
114 | - $pdf->begin_page_ext(612, 792, ''); | |
121 | + $pdf->begin_page_ext(0, 0, 'width=letter.width, height=letter.height'); | |
115 | 122 | |
116 | 123 | // END PAGE 3 |
117 | 124 | $pdf->end_page_ext(''); |
118 | 125 | |
119 | 126 | // close the document |
120 | 127 | $pdf->end_document(''); |
128 | +} | |
129 | + | |
130 | +catch (PDFlibException $e) { | |
131 | + die("PDFlib exception occurred in sample:\n" . | |
132 | + "[" . $e->get_errnum() . "] " . $e->get_apiname() . ": " . | |
133 | + $e->get_errmsg() . "\n"); | |
134 | +} | |
121 | 135 | |
122 | -} catch (PDFlibException $e) { | |
123 | - die("PDFlib exception occurred\n" | |
124 | - . "[" . $e->get_errnum() . "] " . $e->get_apiname() . ": " | |
125 | - . $e->get_errmsg() . "\n"); | |
126 | -} catch (Exception $e) { | |
127 | - die($e); | |
136 | +catch (Exception $e) { | |
137 | + die($e); | |
128 | 138 | } |
129 | 139 | |
130 | 140 | // vim: expandtab filetype=php shiftwidth=3 tabstop=3 |