mirror of
https://github.com/michaelrsweet/pdfio.git
synced 2025-04-30 20:36:46 +02:00
Compare commits
No commits in common. "6b5c30b4bebf647883ad4d23823e4e8f108e2261" and "16c8b830b8b22ee7a6ee549e6ca72e104e57c60d" have entirely different histories.
6b5c30b4be
...
16c8b830b8
@ -43,17 +43,14 @@ Contents
|
||||
Build System
|
||||
------------
|
||||
|
||||
The build system uses [GNU autoconf][AUTOCONF] to create a simple POSIX makefile
|
||||
to build static and/or shared libraries. To improve portability, makefiles
|
||||
*must not* make use of features unique to GNU make. See the
|
||||
[Makefile Guidelines](#makefile-guidelines) section for a description of the
|
||||
allowed make features and makefile guidelines.
|
||||
The build system uses a simple POSIX makefile to build a static or shared
|
||||
library. To improve portability, makefiles *must not* make use of features
|
||||
unique to GNU make. See the [Makefile Guidelines](#makefile-guidelines) section
|
||||
for a description of the allowed make features and makefile guidelines.
|
||||
|
||||
An Xcode project is provided for macOS/iOS developers, and a Visual Studio
|
||||
solution and projects for Windows developers.
|
||||
|
||||
[AUTOCONF]: https://www.gnu.org/software/autoconf/
|
||||
|
||||
|
||||
Version Numbering
|
||||
-----------------
|
||||
@ -376,15 +373,14 @@ The following variables are defined in the makefile:
|
||||
- `CC`; the C compiler command,
|
||||
- `CFLAGS`; options for the C compiler,
|
||||
- `CODESIGN_IDENTITY`: the code signing identity,
|
||||
- `COMMONFLAGS`; common compiler optimization options,
|
||||
- `CPPFLAGS`; options for the C preprocessor,
|
||||
- `DESTDIR`/`DSTROOT`: the destination root directory when installing.
|
||||
- `DSO`; the shared library building command,
|
||||
- `DSOFLAGS`; options for the shared library building command,
|
||||
- `DSONAME`: the root name of the shared library
|
||||
- `LDFLAGS`; options for the linker,
|
||||
- `LIBPDFIO`: the name of the primary (shared or static) library
|
||||
- `LIBPDFIO_STATIC`: the name of the secondary (static) library
|
||||
- `LIBS`; libraries for all programs,
|
||||
- `OPTIM`; common compiler optimization options,
|
||||
- `prefix`; the installation prefix directory,
|
||||
- `RANLIB`; the static library indexing command,
|
||||
- `SHELL`; the sh (POSIX shell) command,
|
||||
@ -393,7 +389,12 @@ The following variables are defined in the makefile:
|
||||
The following standard targets are defined in the makefile:
|
||||
|
||||
- `all`; creates the static library and unit test program.
|
||||
- `all-shared`; creates a shared library appropriate for the local system.
|
||||
- `clean`; removes all target programs libraries, documentation files, and
|
||||
object files,
|
||||
- `debug`: creates a clean build of the static library and unit test program
|
||||
with debug printfs and the clang address sanitizer enabled.
|
||||
- `install`; installs all distribution files in their corresponding locations.
|
||||
- `install-shared`; same as `install` but also installs the shared library.
|
||||
- `macos`; same as `all` but creates a Universal Binary (X64 + ARM64).
|
||||
- `test`; runs the unit test program, building it as needed.
|
||||
|
19
doc/pdfio.3
19
doc/pdfio.3
@ -400,7 +400,7 @@ The PDF content helper functions provide additional functions for writing specif
|
||||
When you are done writing the stream, call pdfioStreamCLose to close both the stream and the object.
|
||||
.SS PDF Content Helper Functions
|
||||
.PP
|
||||
PDFio includes many helper functions for embedding or writing specific kinds of content to a PDF file. These functions can be roughly grouped into five categories:
|
||||
PDFio includes many helper functions for embedding or writing specific kinds of content to a PDF file. These functions can be roughly grouped into ??? categories:
|
||||
.IP \(bu 5
|
||||
.PP
|
||||
Color Space Functions
|
||||
@ -552,7 +552,6 @@ will embed an OpenSans Regular TrueType font using the Windows CP1252 subset of
|
||||
will embed the NotoSansJP Regular OpenType font with full support for Unicode.
|
||||
.PP
|
||||
Note: Not all fonts support Unicode.
|
||||
|
||||
.PP
|
||||
Image Object Functions
|
||||
.PP
|
||||
@ -800,15 +799,7 @@ pdfioContentTextMoveTo moves within the current line in a text block
|
||||
|
||||
.IP \(bu 5
|
||||
.PP
|
||||
pdfioContentTextNewLine moves to the beginning of the next line in a text block
|
||||
|
||||
.IP \(bu 5
|
||||
.PP
|
||||
pdfioContentTextNewLineShow moves to the beginning of the next line in a text block and shows literal text with optional word and character spacing
|
||||
|
||||
.IP \(bu 5
|
||||
.PP
|
||||
pdfioContentTextNewLineShowf moves to the beginning of the next line in a text block and shows formatted text with optional word and character spacing
|
||||
pdfioContentTextNextLine moves to the beginning of the next line in a text block
|
||||
|
||||
.IP \(bu 5
|
||||
.PP
|
||||
@ -3118,6 +3109,12 @@ PDF value types
|
||||
.nf
|
||||
typedef enum pdfio_valtype_e pdfio_valtype_t;
|
||||
.fi
|
||||
.SS state_t[4][4]
|
||||
4x4 AES state table
|
||||
.PP
|
||||
.nf
|
||||
typedef uint8_t state_t[4][4];
|
||||
.fi
|
||||
.SH AUTHOR
|
||||
.PP
|
||||
Michael R Sweet
|
||||
|
@ -467,6 +467,7 @@ span.string {
|
||||
<li><a href="#pdfio_stream_t">pdfio_stream_t</a></li>
|
||||
<li><a href="#pdfio_textrendering_t">pdfio_textrendering_t</a></li>
|
||||
<li><a href="#pdfio_valtype_t">pdfio_valtype_t</a></li>
|
||||
<li><a href="#state_t[4][4]">state_t[4][4]</a></li>
|
||||
</ul></li>
|
||||
<li><a href="#STRUCTURES">Structures</a><ul class="subcontents">
|
||||
<li><a href="#pdfio_rect_s">pdfio_rect_s</a></li>
|
||||
@ -718,7 +719,7 @@ pdfio_stream_t *st = pdfioFileCreatePage(pdf, dict);
|
||||
<p>The <a href="#pdf-content-helper-functions">PDF content helper functions</a> provide additional functions for writing specific PDF page stream commands.</p>
|
||||
<p>When you are done writing the stream, call <a href="#pdfioStreamCLose"><code>pdfioStreamCLose</code></a> to close both the stream and the object.</p>
|
||||
<h3 class="title" id="pdf-content-helper-functions">PDF Content Helper Functions</h3>
|
||||
<p>PDFio includes many helper functions for embedding or writing specific kinds of content to a PDF file. These functions can be roughly grouped into five categories:</p>
|
||||
<p>PDFio includes many helper functions for embedding or writing specific kinds of content to a PDF file. These functions can be roughly grouped into ??? categories:</p>
|
||||
<ul>
|
||||
<li><p><a href="#color-space-functions">Color Space Functions</a></p>
|
||||
</li>
|
||||
@ -804,9 +805,7 @@ pdfio_obj_t *arial = pdfioFileCreateFontObjFromFile(pdf, <span class="string">&q
|
||||
pdfio_obj_t *arial = pdfioFileCreateFontObjFromFile(pdf, <span class="string">"NotoSansJP-Regular.otf"</span>, <span class="reserved">true</span>);
|
||||
</code></pre>
|
||||
<p>will embed the NotoSansJP Regular OpenType font with full support for Unicode.</p>
|
||||
<blockquote>
|
||||
<p>Note: Not all fonts support Unicode.</p>
|
||||
</blockquote>
|
||||
<h4 id="image-object-functions">Image Object Functions</h4>
|
||||
<p>PDF supports images with many different color spaces and bit depths with optional transparency. PDFio provides two helper functions for creating image objects that can be referenced in page streams. The first function is <a href="#pdfioFileCreateImageObjFromData"><code>pdfioFileCreateImageObjFromData</code></a> which creates an image object from data in memory, for example:</p>
|
||||
<pre><code class="language-c">pdfio_file_t *pdf = pdfioFileCreate(...);
|
||||
@ -937,11 +936,7 @@ pdfio_obj_t *img = pdfioFileCreateImageObjFromFile(pdf, <span class="string">&qu
|
||||
</li>
|
||||
<li><p><a href="#pdfioContentTextMoveTo"><code>pdfioContentTextMoveTo</code></a> moves within the current line in a text block</p>
|
||||
</li>
|
||||
<li><p><a href="#pdfioContentTextNewLine"><code>pdfioContentTextNewLine</code></a> moves to the beginning of the next line in a text block</p>
|
||||
</li>
|
||||
<li><p><a href="#pdfioContentTextNewLineShow"><code>pdfioContentTextNewLineShow</code></a> moves to the beginning of the next line in a text block and shows literal text with optional word and character spacing</p>
|
||||
</li>
|
||||
<li><p><a href="#pdfioContentTextNewLineShowf"><code>pdfioContentTextNewLineShowf</code></a> moves to the beginning of the next line in a text block and shows formatted text with optional word and character spacing</p>
|
||||
<li><p><a href="#pdfioContentTextNextLine"><code>pdfioContentTextNextLine</code></a> moves to the beginning of the next line in a text block</p>
|
||||
</li>
|
||||
<li><p><a href="#pdfioContentTextShow"><code>pdfioContentTextShow</code></a> draws a literal string in a text block</p>
|
||||
</li>
|
||||
@ -3763,6 +3758,11 @@ typedef enum <a href="#pdfio_textrendering_e">pdfio_textrendering_e</a> pdfio_te
|
||||
<p class="code">
|
||||
typedef enum <a href="#pdfio_valtype_e">pdfio_valtype_e</a> pdfio_valtype_t;
|
||||
</p>
|
||||
<h3 class="typedef"><a id="state_t[4][4]">state_t[4][4]</a></h3>
|
||||
<p class="description">4x4 AES state table</p>
|
||||
<p class="code">
|
||||
typedef uint8_t state_t[4][4];
|
||||
</p>
|
||||
<h2 class="title"><a id="STRUCTURES">Structures</a></h2>
|
||||
<h3 class="struct"><a id="pdfio_rect_s">pdfio_rect_s</a></h3>
|
||||
<p class="description">PDF rectangle</p>
|
||||
@ -3797,6 +3797,7 @@ typedef enum <a href="#pdfio_valtype_e">pdfio_valtype_e</a> pdfio_valtype_t;
|
||||
<h4 class="constants">Constants</h4>
|
||||
<table class="list"><tbody>
|
||||
<tr><th>PDFIO_ENCRYPTION_AES_128 </th><td class="description">128-bit AES encryption (PDF 1.6)</td></tr>
|
||||
<tr><th>PDFIO_ENCRYPTION_AES_256 </th><td class="description">256-bit AES encryption (PDF 2.0)</td></tr>
|
||||
<tr><th>PDFIO_ENCRYPTION_NONE </th><td class="description">No encryption</td></tr>
|
||||
<tr><th>PDFIO_ENCRYPTION_RC4_128 </th><td class="description">128-bit RC4 encryption (PDF 1.4)</td></tr>
|
||||
<tr><th>PDFIO_ENCRYPTION_RC4_40 </th><td class="description">40-bit RC4 encryption (PDF 1.3)</td></tr>
|
||||
|
10
doc/pdfio.md
10
doc/pdfio.md
@ -361,7 +361,7 @@ PDF Content Helper Functions
|
||||
----------------------------
|
||||
|
||||
PDFio includes many helper functions for embedding or writing specific kinds of
|
||||
content to a PDF file. These functions can be roughly grouped into five
|
||||
content to a PDF file. These functions can be roughly grouped into ???
|
||||
categories:
|
||||
|
||||
- [Color Space Functions](@)
|
||||
@ -455,7 +455,7 @@ pdfio_obj_t *arial = pdfioFileCreateFontObjFromFile(pdf, "NotoSansJP-Regular.otf
|
||||
|
||||
will embed the NotoSansJP Regular OpenType font with full support for Unicode.
|
||||
|
||||
> Note: Not all fonts support Unicode.
|
||||
Note: Not all fonts support Unicode.
|
||||
|
||||
|
||||
### Image Object Functions
|
||||
@ -584,12 +584,8 @@ escaping, as needed:
|
||||
- [`pdfioContentTextMoveLine`](@@) moves to the next line with an offset in a
|
||||
text block
|
||||
- [`pdfioContentTextMoveTo`](@@) moves within the current line in a text block
|
||||
- [`pdfioContentTextNewLine`](@@) moves to the beginning of the next line in a
|
||||
- [`pdfioContentTextNextLine`](@@) moves to the beginning of the next line in a
|
||||
text block
|
||||
- [`pdfioContentTextNewLineShow`](@@) moves to the beginning of the next line in a
|
||||
text block and shows literal text with optional word and character spacing
|
||||
- [`pdfioContentTextNewLineShowf`](@@) moves to the beginning of the next line in a
|
||||
text block and shows formatted text with optional word and character spacing
|
||||
- [`pdfioContentTextShow`](@@) draws a literal string in a text block
|
||||
- [`pdfioContentTextShowf`](@@) draws a formatted string in a text block
|
||||
- [`pdfioContentTextShowJustified`](@@) draws an array of literal strings with
|
||||
|
@ -10,6 +10,10 @@
|
||||
// (<https://github.com/kokke/tiny-AES-c>)
|
||||
//
|
||||
|
||||
//
|
||||
// Include necessary headers...
|
||||
//
|
||||
|
||||
#include "pdfio-private.h"
|
||||
|
||||
|
||||
@ -17,7 +21,7 @@
|
||||
// Local types...
|
||||
//
|
||||
|
||||
typedef uint8_t state_t[4][4]; // 4x4 AES state table @private@
|
||||
typedef uint8_t state_t[4][4]; // 4x4 AES state table
|
||||
|
||||
|
||||
//
|
||||
|
@ -7,6 +7,10 @@
|
||||
// information.
|
||||
//
|
||||
|
||||
//
|
||||
// Include necessary headers...
|
||||
//
|
||||
|
||||
#include "pdfio-private.h"
|
||||
|
||||
|
||||
|
@ -7,6 +7,10 @@
|
||||
// information.
|
||||
//
|
||||
|
||||
//
|
||||
// Include necessary headers...
|
||||
//
|
||||
|
||||
#include "pdfio-private.h"
|
||||
|
||||
|
||||
|
@ -1198,20 +1198,6 @@ pdfioContentTextNewLine(
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// 'pdfioContentTextNextLine()' - Legacy function name preserved for binary compatibility.
|
||||
//
|
||||
// @private@
|
||||
//
|
||||
|
||||
bool // O - `true` on success, `false` on failure
|
||||
pdfioContentTextNextLine(
|
||||
pdfio_stream_t *st) // I - Stream
|
||||
{
|
||||
return (pdfioStreamPuts(st, "T*\n"));
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// 'pdfioContentTextNewLineShow()' - Move to the next line and show text.
|
||||
//
|
||||
|
@ -121,7 +121,6 @@ extern bool pdfioContentTextMoveTo(pdfio_stream_t *st, double tx, double ty) _P
|
||||
extern bool pdfioContentTextNewLine(pdfio_stream_t *st) _PDFIO_PUBLIC;
|
||||
extern bool pdfioContentTextNewLineShow(pdfio_stream_t *st, double ws, double cs, bool unicode, const char *s) _PDFIO_PUBLIC;
|
||||
extern bool pdfioContentTextNewLineShowf(pdfio_stream_t *st, double ws, double cs, bool unicode, const char *format, ...) _PDFIO_PUBLIC _PDFIO_FORMAT(5,6);
|
||||
extern bool pdfioContentTextNextLine(pdfio_stream_t *st) _PDFIO_PUBLIC;
|
||||
extern bool pdfioContentTextShow(pdfio_stream_t *st, bool unicode, const char *s) _PDFIO_PUBLIC;
|
||||
extern bool pdfioContentTextShowf(pdfio_stream_t *st, bool unicode, const char *format, ...) _PDFIO_PUBLIC _PDFIO_FORMAT(3,4);
|
||||
extern bool pdfioContentTextShowJustified(pdfio_stream_t *st, bool unicode, size_t num_fragments, const double *offsets, const char * const *fragments) _PDFIO_PUBLIC;
|
||||
|
@ -7,6 +7,10 @@
|
||||
// information.
|
||||
//
|
||||
|
||||
//
|
||||
// Include necessary headers...
|
||||
//
|
||||
|
||||
#include "pdfio-private.h"
|
||||
#if _WIN32
|
||||
# include <windows.h>
|
||||
|
@ -7,6 +7,10 @@
|
||||
// information.
|
||||
//
|
||||
|
||||
//
|
||||
// Include necessary headers...
|
||||
//
|
||||
|
||||
#include "pdfio-private.h"
|
||||
|
||||
|
||||
|
@ -7,6 +7,10 @@
|
||||
// information.
|
||||
//
|
||||
|
||||
//
|
||||
// Include necessary headers...
|
||||
//
|
||||
|
||||
#include "pdfio-private.h"
|
||||
#ifndef O_BINARY
|
||||
# define O_BINARY 0
|
||||
|
@ -7,6 +7,10 @@
|
||||
// information.
|
||||
//
|
||||
|
||||
//
|
||||
// Include necessary headers...
|
||||
//
|
||||
|
||||
#include "pdfio-private.h"
|
||||
|
||||
|
||||
|
@ -7,6 +7,10 @@
|
||||
// information.
|
||||
//
|
||||
|
||||
//
|
||||
// Include necessary headers...
|
||||
//
|
||||
|
||||
#include "pdfio-private.h"
|
||||
|
||||
|
||||
|
@ -7,6 +7,10 @@
|
||||
// information.
|
||||
//
|
||||
|
||||
//
|
||||
// Include necessary headers...
|
||||
//
|
||||
|
||||
#include "pdfio-private.h"
|
||||
|
||||
|
||||
|
@ -7,6 +7,10 @@
|
||||
// information.
|
||||
//
|
||||
|
||||
//
|
||||
// Include necessary headers...
|
||||
//
|
||||
|
||||
#include "pdfio-private.h"
|
||||
|
||||
|
||||
|
@ -7,6 +7,10 @@
|
||||
// information.
|
||||
//
|
||||
|
||||
//
|
||||
// Include necessary headers...
|
||||
//
|
||||
|
||||
#include "pdfio-private.h"
|
||||
|
||||
|
||||
|
4
pdfio.h
4
pdfio.h
@ -33,11 +33,9 @@ extern "C" {
|
||||
# if defined(__has_extension) || defined(__GNUC__)
|
||||
# define _PDFIO_PUBLIC __attribute__ ((visibility("default")))
|
||||
# define _PDFIO_FORMAT(a,b) __attribute__ ((__format__(__printf__, a,b)))
|
||||
# define _PDFIO_DEPRECATED __attribute__ ((deprecated)) _PDFIO_PUBLIC
|
||||
# else
|
||||
# define _PDFIO_PUBLIC
|
||||
# define _PDFIO_FORMAT(a,b)
|
||||
# define _PDFIO_DEPRECATED
|
||||
# endif // __has_extension || __GNUC__
|
||||
|
||||
|
||||
@ -65,7 +63,7 @@ typedef enum pdfio_encryption_e // PDF encryption modes
|
||||
PDFIO_ENCRYPTION_RC4_40, // 40-bit RC4 encryption (PDF 1.3)
|
||||
PDFIO_ENCRYPTION_RC4_128, // 128-bit RC4 encryption (PDF 1.4)
|
||||
PDFIO_ENCRYPTION_AES_128, // 128-bit AES encryption (PDF 1.6)
|
||||
PDFIO_ENCRYPTION_AES_256 // 256-bit AES encryption (PDF 2.0) @exclude all@
|
||||
PDFIO_ENCRYPTION_AES_256 // 256-bit AES encryption (PDF 2.0)
|
||||
} pdfio_encryption_t;
|
||||
typedef enum pdfio_filter_e // Compression/decompression filters for streams
|
||||
{
|
||||
|
@ -144,7 +144,6 @@ pdfioContentTextMoveTo
|
||||
pdfioContentTextNewLine
|
||||
pdfioContentTextNewLineShow
|
||||
pdfioContentTextNewLineShowf
|
||||
pdfioContentTextNextLine
|
||||
pdfioContentTextShow
|
||||
pdfioContentTextShowJustified
|
||||
pdfioContentTextShowf
|
||||
|
@ -1,7 +1,7 @@
|
||||
//
|
||||
// Test program for PDFio.
|
||||
//
|
||||
// Copyright © 2021-2023 by Michael R Sweet.
|
||||
// Copyright © 2021 by Michael R Sweet.
|
||||
//
|
||||
// Licensed under Apache License v2.0. See the file "LICENSE" for more
|
||||
// information.
|
||||
@ -10,7 +10,11 @@
|
||||
//
|
||||
// ./testpdfio
|
||||
//
|
||||
// ./testpdfio [--verbose] FILENAME [OBJECT-NUMBER] [FILENAME [OBJECT-NUMBER]] ...
|
||||
// ./testpdfio FILENAME [OBJECT-NUMBER] [FILENAME [OBJECT-NUMBER]] ...
|
||||
//
|
||||
|
||||
//
|
||||
// Include necessary headers...
|
||||
//
|
||||
|
||||
#include "pdfio-private.h"
|
||||
|
Loading…
x
Reference in New Issue
Block a user