Compare View

switch
from
...
to
 
Commits (2)

Diff

Showing 1 changed file Side-by-side Diff

... ... @@ -52,14 +52,31 @@ try {
52 52 $pdf->set_info('Subject', 'IODP Proposals');
53 53 $pdf->set_info('Keywords', 'IODP proposal ocean drilling core expedition');
54 54  
  55 + $textOpts = "fontname={Helvetica} embedding fontsize=20 "
  56 + . "encoding=unicode ";
  57 +
55 58 // START PAGE 1
56 59 $pdf->begin_page_ext(612, 792, '');
57 60  
58   - $textOpts = "fontname={Helvetica} embedding fontsize=20 "
59   - . "encoding=unicode ";
  61 + // create bookmarks first thing
  62 + $action = $pdf->create_action("GoTo", "destination={page=1}");
  63 + $pdf->create_bookmark("Page 1", " action={activate= " . $action . "}");
60 64  
  65 + // action
  66 + $action = $pdf->create_action("GoTo", "destination={page=2}");
  67 + // bookmark
  68 + $pdf->create_bookmark("Page 2", " action={activate= " . $action . "}");
  69 +
  70 +
  71 + // text/image
61 72 $pdf->fit_textline("Jump to SSF for SHACK-10A", 20, 750,
62   - $textOpts . " underline=true");
  73 + $textOpts . " underline=true matchbox={name=to_second_page}");
  74 + // annotation; reuse the "page 2" action above
  75 + $optlist = "action={activate " . $action . "} linewidth=0 " .
  76 + "usematchbox={to_second_page}";
  77 + $pdf->create_annotation(0, 0, 0, 0, "Link", $optlist);
  78 +
  79 + // the rest of the text on page 1
63 80 $pdf->fit_textline("This is some text on the first page; ", 20, 720,
64 81 $textOpts);
65 82 $pdf->fit_textline("Привет! Этот немного текста.", 20, 690, $textOpts);
... ... @@ -76,6 +93,7 @@ try {
76 93 $ssfPage = $pdf->open_pdi_page($ssfPDF, 1, '');
77 94 $ssfWidth = $pdf->pcos_get_number($ssfPDF, "pages[0]/width");
78 95 $ssfHeight = $pdf->pcos_get_number($ssfPDF, "pages[0]/height");
  96 + //print "Page width/height: $ssfWidth x $ssfHeight\n";
79 97  
80 98 $pdf->begin_page_ext($ssfWidth, $ssfHeight, '');
81 99  
... ... @@ -87,17 +105,20 @@ try {
87 105 // for landscape mode...
88 106 //$pdf->fit_textline("Back to Top", 20, 570,
89 107 //$linkOpts = linkAttribs(1, 750);
90   - $optList = "destination={page=1 type=fixed left=0 top=750}";
91   - $action = $p->create_action("GoTo", $optList);
92   - print_r($linkOpts);
93   - $pdf->fit_textline("Back to Top", 20, 750, $linkOpts);
  108 + $action = $pdf->create_action("GoTo", "destination={page=1}");
  109 + $pdf->fit_textline("Back to Top", 20, $ssfHeight - 30,
  110 + $textOpts . " underline=true matchbox={name=to_first_page}");
  111 +
  112 + // call create_annotation here
  113 + $optlist = "action={activate " . $action . "} linewidth=0 " .
  114 + "usematchbox={to_first_page}";
  115 + $pdf->create_annotation(0, 0, 0, 0, "Link", $optlist);
94 116  
95 117 // END PAGE 2
96 118 $pdf->end_page_ext('');
97 119  
98 120 // close the document
99 121 $pdf->end_document('');
100   -
101 122 }
102 123  
103 124 catch (PDFlibException $e) {