Skip to content

Commit

Permalink
Update documentation and examples makefile.
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelrsweet committed Dec 26, 2024
1 parent e96f9bf commit 6d65a60
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
8 changes: 5 additions & 3 deletions doc/pdfio.3
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH pdfio 3 "pdf read/write library" "2024-12-22" "pdf read/write library"
.TH pdfio 3 "pdf read/write library" "2024-12-26" "pdf read/write library"
.SH NAME
pdfio \- pdf read/write library
.SH Introduction
Expand Down Expand Up @@ -1028,6 +1028,8 @@ pdfioContentTextShowJustified draws an array of literal strings with offsets bet


.SH Examples
.PP
PDFio includes several example programs that are typically installed to the /usr/share/doc/pdfio/examples or /usr/local/share/doc/pdfio/examples directories. A makefile is included to build them.
.SS Read PDF Metadata
.PP
The pdfioinfo.c example program opens a PDF file and prints the title, author, creation date, and number of pages:
Expand Down Expand Up @@ -2068,13 +2070,13 @@ We then loops through the fragments for the current line, drawing checkboxes, im
doclink_t *l = dd\->links + dd\->num_links;
// Pointer to this link record

if (!strcmp(frag\->url, "@"))
if (!strcmp(frag\->url, "@"))
{
// Use mapped text as link target...
char targetlink[129]; // Targeted link

targetlink[0] = '#';
make_target_name(targetlink + 1, frag\->text, sNzeof(targetlink) \- 1);
make_target_name(targetlink + 1, frag\->text, sizeof(targetlink) \- 1);

l\->url = pdfioStringCreate(dd\->pdf, targetlink);
}
Expand Down
5 changes: 3 additions & 2 deletions doc/pdfio.html
Original file line number Diff line number Diff line change
Expand Up @@ -1148,6 +1148,7 @@ <h4 id="page-stream-functions">Page Stream Functions</h4>
</li>
</ul>
<h2 class="title" id="examples">Examples</h2>
<p>PDFio includes several example programs that are typically installed to the <code>/usr/share/doc/pdfio/examples</code> or <code>/usr/local/share/doc/pdfio/examples</code> directories. A makefile is included to build them.</p>
<h3 class="title" id="read-pdf-metadata">Read PDF Metadata</h3>
<p>The <code>pdfioinfo.c</code> example program opens a PDF file and prints the title, author, creation date, and number of pages:</p>
<pre><code class="language-c"><span class="directive">#include &lt;pdfio.h&gt;</span>
Expand Down Expand Up @@ -2027,13 +2028,13 @@ <h5 id="rendering-a-line-in-a-paragraph-heading-or-table-cell">Rendering a Line
doclink_t *l = dd-&gt;links + dd-&gt;num_links;
<span class="comment">// Pointer to this link record</span>

<span class="reserved">if</span> (!strcmp(frag-&gt;url, <span class="string">&quot;@&quot;</span>))
ï<span class="reserved">if</span> (!strcmp(frag-&gt;url, <span class="string">&quot;@&quot;</span>))
{
<span class="comment">// Use mapped text as link target...</span>
<span class="reserved">char</span> targetlink[<span class="number">129</span>]; <span class="comment">// Targeted link</span>

targetlink[<span class="number">0</span>] = <span class="string">'#'</span>;
make_target_name(targetlink + <span class="number">1</span>, frag-&gt;text, s¾zeof(targetlink) - <span class="number">1</span>);
make_target_name(targetlink + <span class="number">1</span>, frag-&gt;text, <span class="reserved">sizeof</span>(targetlink) - <span class="number">1</span>);

l-&gt;url = pdfioStringCreate(dd-&gt;pdf, targetlink);
}
Expand Down
4 changes: 4 additions & 0 deletions doc/pdfio.md
Original file line number Diff line number Diff line change
Expand Up @@ -864,6 +864,10 @@ escaping, as needed:
Examples
========

PDFio includes several example programs that are typically installed to the
`/usr/share/doc/pdfio/examples` or `/usr/local/share/doc/pdfio/examples`
directories. A makefile is included to build them.


Read PDF Metadata
-----------------
Expand Down
8 changes: 4 additions & 4 deletions examples/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@


# Common options
#CFLAGS = -g $(CPPFLAGS)
CFLAGS = -g -fsanitize=address $(CPPFLAGS)
CPPFLAGS = -I..
LIBS = -L.. -lpdfio -lz
CFLAGS = -g $(CPPFLAGS)
#CFLAGS = -g -fsanitize=address $(CPPFLAGS)
CPPFLAGS = -I.. -I/usr/local/include
LIBS = -L.. -L/usr/local/lib -lpdfio -lz


# Targets
Expand Down

0 comments on commit 6d65a60

Please sign in to comment.