From 3c0f907a9caec5dd9af931cb93265dc4a82b0992 Mon Sep 17 00:00:00 2001
From: Brian Manning <brian@xaoc.org>
Date: Wed, 18 May 2016 09:44:12 -0700
Subject: [PATCH] table_demo: added new relative font path to GNU FreeFonts

---
 table_demo | 32 ++++++++++++++++++--------------
 1 file changed, 18 insertions(+), 14 deletions(-)

diff --git a/table_demo b/table_demo
index 2ff7d88..0f9e3f6 100755
--- a/table_demo
+++ b/table_demo
@@ -37,6 +37,11 @@ try {
    // set up some PDFlib options
    $pdf->set_option("errorpolicy=return");
    $pdf->set_option("stringformat=utf8");
+   // all paths in 'searchpath' need to be inside curly braces
+   // multiple curly-braced paths in $searchpath need to be separated with
+   // space characters
+   $searchpath = '{/usr/share/fonts/dejavu/}{' . __DIR__ . '/fonts}';
+   $pdf->set_option("searchpath={" . $searchpath . "}");
 
    if ($pdf->begin_document($outfile, "") == 0)
       throw new Exception("Error: " . $pdf->get_errmsg());
@@ -48,7 +53,7 @@ try {
    $pdf->set_info('Subject', 'IODP Proposals');
    $pdf->set_info('Keywords', 'IODP proposal ocean drilling core expedition');
 
-   $textOpts = "fontname={Helvetica} embedding fontsize=20 "
+   $textOpts = "fontname={FreeSans} embedding fontsize=20 "
       . "encoding=unicode ";
 
    // START PAGE 1
@@ -63,7 +68,6 @@ try {
    // bookmark
    $pdf->create_bookmark("Page 2", " action={activate= " . $action . "}");
 
-
    // text/image
    $pdf->fit_textline("Jump to SSF for SHACK-10A", 20, 750,
       $textOpts . " underline=true matchbox={name=to_second_page}");
@@ -98,6 +102,9 @@ try {
    $pdf->close_pdi_document($ssfPDF);
 
    // write some text on to the page
+   // for landscape mode...
+   //$pdf->fit_textline("Back to Top", 20, 570,
+   //$linkOpts = linkAttribs(1, 750);
    $action = $pdf->create_action("GoTo", "destination={page=1}");
    $pdf->fit_textline("Back to Top", 20, $ssfHeight - 30,
       $textOpts . " underline=true matchbox={name=to_first_page}");
@@ -110,21 +117,18 @@ try {
    // END PAGE 2
    $pdf->end_page_ext('');
 
-   // START PAGE 3
-   $pdf->begin_page_ext(612, 792, '');
-
-   // END PAGE 3
-   $pdf->end_page_ext('');
-
    // close the document
    $pdf->end_document('');
+}
+
+catch (PDFlibException $e) {
+       die("PDFlib exception occurred in sample:\n" .
+               "[" . $e->get_errnum() . "] " . $e->get_apiname() . ": " .
+                       $e->get_errmsg() . "\n");
+}
 
-} catch (PDFlibException $e) {
-   die("PDFlib exception occurred\n"
-      . "[" . $e->get_errnum() . "] " . $e->get_apiname() . ": "
-      . $e->get_errmsg() . "\n");
-} catch (Exception $e) {
-   die($e);
+catch (Exception $e) {
+       die($e);
 }
 
 // vim: expandtab filetype=php shiftwidth=3 tabstop=3
-- 
1.9.1