mirror of
https://github.com/michaelrsweet/pdfio.git
synced 2025-07-16 05:49:58 +02:00
Compare commits
15 Commits
53967552df
...
v1.4.0
Author | SHA1 | Date | |
---|---|---|---|
6d65a609e5 | |||
e96f9bfa6b | |||
10c15fc281 | |||
fd8427d68a | |||
ed1421287f | |||
aa91b141a8 | |||
5dc68f3285 | |||
52b508bdd2 | |||
41ebe39f3b | |||
62df5f5c78 | |||
a1237db52c | |||
a24fdee335 | |||
e4081f2ba3 | |||
5bc7ebee2c | |||
b872df5a1e |
4
.gitignore
vendored
4
.gitignore
vendored
@ -12,14 +12,16 @@
|
|||||||
/configure~
|
/configure~
|
||||||
/doc/pdfio.epub
|
/doc/pdfio.epub
|
||||||
/examples/code128
|
/examples/code128
|
||||||
|
/examples/image2pdf
|
||||||
/examples/md2pdf
|
/examples/md2pdf
|
||||||
|
/examples/pdf2text
|
||||||
|
/examples/pdfioinfo
|
||||||
/Makefile
|
/Makefile
|
||||||
/packages
|
/packages
|
||||||
/pdfio.pc
|
/pdfio.pc
|
||||||
/pdfio.xcodeproj/xcshareddata
|
/pdfio.xcodeproj/xcshareddata
|
||||||
/pdfio-*.tar.gz*
|
/pdfio-*.tar.gz*
|
||||||
/pdfio-*.zip*
|
/pdfio-*.zip*
|
||||||
/pdfiototext
|
|
||||||
/testpdfio
|
/testpdfio
|
||||||
/testpdfio-*.pdf
|
/testpdfio-*.pdf
|
||||||
/testttf
|
/testttf
|
||||||
|
@ -14,6 +14,7 @@ v1.4.0 - YYYY-MM-DD
|
|||||||
with `pdfioFileCreateFontObjFromBase` (Issue #84)
|
with `pdfioFileCreateFontObjFromBase` (Issue #84)
|
||||||
- Fixed reading of PDF files whose trailer is missing a newline (Issue #80)
|
- Fixed reading of PDF files whose trailer is missing a newline (Issue #80)
|
||||||
- Fixed builds with some versions of VC++ (Issue #81)
|
- Fixed builds with some versions of VC++ (Issue #81)
|
||||||
|
- Fixed validation of date/time values (Issue #83)
|
||||||
|
|
||||||
|
|
||||||
v1.3.2 - 2024-08-15
|
v1.3.2 - 2024-08-15
|
||||||
|
37
Makefile.in
37
Makefile.in
@ -103,15 +103,33 @@ LIBOBJS = \
|
|||||||
ttf.o
|
ttf.o
|
||||||
OBJS = \
|
OBJS = \
|
||||||
$(LIBOBJS) \
|
$(LIBOBJS) \
|
||||||
pdfiototext.o \
|
|
||||||
testpdfio.o \
|
testpdfio.o \
|
||||||
testttf.o
|
testttf.o
|
||||||
TARGETS = \
|
TARGETS = \
|
||||||
$(LIBPDFIO) \
|
$(LIBPDFIO) \
|
||||||
$(LIBPDFIO_STATIC) \
|
$(LIBPDFIO_STATIC) \
|
||||||
pdfiototext \
|
|
||||||
testpdfio \
|
testpdfio \
|
||||||
testttf
|
testttf
|
||||||
|
DOCFILES = \
|
||||||
|
doc/pdfio.html \
|
||||||
|
doc/pdfio-512.png \
|
||||||
|
LICENSE \
|
||||||
|
NOTICE
|
||||||
|
EXAMPLES = \
|
||||||
|
examples/Makefile \
|
||||||
|
examples/Roboto-Bold.ttf \
|
||||||
|
examples/Roboto-Italic.ttf \
|
||||||
|
examples/Roboto-Regular.ttf \
|
||||||
|
examples/RobotoMono-Regular.ttf \
|
||||||
|
examples/code128.c \
|
||||||
|
examples/code128.ttf \
|
||||||
|
examples/image2pdf.c \
|
||||||
|
examples/md2pdf.c \
|
||||||
|
examples/md2pdf.md \
|
||||||
|
examples/mmd.c \
|
||||||
|
examples/mmd.h \
|
||||||
|
examples/pdf2text.c \
|
||||||
|
examples/pdfioinfo.c
|
||||||
|
|
||||||
|
|
||||||
# Make everything
|
# Make everything
|
||||||
@ -152,8 +170,13 @@ install: $(TARGETS)
|
|||||||
$(INSTALL) -c -m 644 pdfio.pc $(BUILDROOT)$(libdir)/pkgconfig
|
$(INSTALL) -c -m 644 pdfio.pc $(BUILDROOT)$(libdir)/pkgconfig
|
||||||
echo Installing documentation to $(BUILDROOT)$(datadir)/doc/pdfio...
|
echo Installing documentation to $(BUILDROOT)$(datadir)/doc/pdfio...
|
||||||
$(INSTALL) -d -m 755 $(BUILDROOT)$(datadir)/doc/pdfio
|
$(INSTALL) -d -m 755 $(BUILDROOT)$(datadir)/doc/pdfio
|
||||||
for file in doc/pdfio.html doc/pdfio-512.png LICENSE NOTICE; do \
|
for file in $(DOCFILES); do \
|
||||||
$(INSTALL) -c -m 644 $$file $(BUILDROOT)$(datadir)/doc/pdfio; \
|
$(INSTALL) -c -m 644 $$file $(BUILDROOT)$(datadir)/doc/pdfio; \
|
||||||
|
done
|
||||||
|
echo Installing examples to $(BUILDROOT)$(datadir)/doc/pdfio/examples...
|
||||||
|
$(INSTALL) -d -m 755 $(BUILDROOT)$(datadir)/doc/pdfio/examples
|
||||||
|
for file in $(EXAMPLES); do \
|
||||||
|
$(INSTALL) -c -m 644 $$file $(BUILDROOT)$(datadir)/doc/pdfio/examples; \
|
||||||
done
|
done
|
||||||
echo Installing man page to $(BUILDROOT)$(mandir)/man3...
|
echo Installing man page to $(BUILDROOT)$(mandir)/man3...
|
||||||
$(INSTALL) -d -m 755 $(BUILDROOT)$(mandir)/man3
|
$(INSTALL) -d -m 755 $(BUILDROOT)$(mandir)/man3
|
||||||
@ -201,12 +224,6 @@ pdfio1.def: $(LIBOBJS) Makefile
|
|||||||
grep -v '^_ttf' | sed -e '1,$$s/^_//' | sort >>$@
|
grep -v '^_ttf' | sed -e '1,$$s/^_//' | sort >>$@
|
||||||
|
|
||||||
|
|
||||||
# pdfio text extraction (demo, doesn't handle a lot of things yet)
|
|
||||||
pdfiototext: pdfiototext.o libpdfio.a
|
|
||||||
echo Linking $@...
|
|
||||||
$(CC) $(LDFLAGS) -o $@ pdfiototext.o libpdfio.a $(LIBS)
|
|
||||||
|
|
||||||
|
|
||||||
# pdfio test program
|
# pdfio test program
|
||||||
testpdfio: testpdfio.o libpdfio.a
|
testpdfio: testpdfio.o libpdfio.a
|
||||||
echo Linking $@...
|
echo Linking $@...
|
||||||
|
1214
doc/pdfio.3
1214
doc/pdfio.3
File diff suppressed because it is too large
Load Diff
1066
doc/pdfio.html
1066
doc/pdfio.html
File diff suppressed because it is too large
Load Diff
1061
doc/pdfio.md
1061
doc/pdfio.md
File diff suppressed because it is too large
Load Diff
@ -13,14 +13,18 @@
|
|||||||
|
|
||||||
# Common options
|
# Common options
|
||||||
CFLAGS = -g $(CPPFLAGS)
|
CFLAGS = -g $(CPPFLAGS)
|
||||||
CPPFLAGS = -I..
|
#CFLAGS = -g -fsanitize=address $(CPPFLAGS)
|
||||||
LIBS = -L.. -lpdfio -lz
|
CPPFLAGS = -I.. -I/usr/local/include
|
||||||
|
LIBS = -L.. -L/usr/local/lib -lpdfio -lz
|
||||||
|
|
||||||
|
|
||||||
# Targets
|
# Targets
|
||||||
TARGETS = \
|
TARGETS = \
|
||||||
code128 \
|
code128 \
|
||||||
md2pdf
|
image2pdf \
|
||||||
|
md2pdf \
|
||||||
|
pdf2text \
|
||||||
|
pdfioinfo
|
||||||
|
|
||||||
|
|
||||||
# Make everything
|
# Make everything
|
||||||
@ -37,10 +41,25 @@ code128: code128.c
|
|||||||
$(CC) $(CFLAGS) -o $@ code128.c $(LIBS)
|
$(CC) $(CFLAGS) -o $@ code128.c $(LIBS)
|
||||||
|
|
||||||
|
|
||||||
|
# image2pdf
|
||||||
|
image2pdf: image2pdf.c
|
||||||
|
$(CC) $(CFLAGS) -o $@ image2pdf.c $(LIBS)
|
||||||
|
|
||||||
|
|
||||||
# md2pdf
|
# md2pdf
|
||||||
md2pdf: md2pdf.c mmd.c mmd.h
|
md2pdf: md2pdf.c mmd.c mmd.h
|
||||||
$(CC) $(CFLAGS) -o $@ md2pdf.c mmd.c $(LIBS)
|
$(CC) $(CFLAGS) -o $@ md2pdf.c mmd.c $(LIBS)
|
||||||
|
|
||||||
|
|
||||||
|
# pdfio text extraction (demo, doesn't handle a lot of things yet)
|
||||||
|
pdf2text: pdf2text.c
|
||||||
|
$(CC) $(CFLAGS) -o $@ pdf2text.c $(LIBS)
|
||||||
|
|
||||||
|
|
||||||
|
# pdfioinfo
|
||||||
|
pdfioinfo: pdfioinfo.c
|
||||||
|
$(CC) $(CFLAGS) -o $@ pdfioinfo.c $(LIBS)
|
||||||
|
|
||||||
|
|
||||||
# Common dependencies...
|
# Common dependencies...
|
||||||
$(TARGETS): Makefile ../pdfio.h ../pdfio-content.h
|
$(TARGETS): Makefile ../pdfio.h ../pdfio-content.h
|
||||||
|
139
examples/image2pdf.c
Normal file
139
examples/image2pdf.c
Normal file
@ -0,0 +1,139 @@
|
|||||||
|
//
|
||||||
|
// Image example for PDFio.
|
||||||
|
//
|
||||||
|
// Copyright © 2023-2024 by Michael R Sweet.
|
||||||
|
//
|
||||||
|
// Licensed under Apache License v2.0. See the file "LICENSE" for more
|
||||||
|
// information.
|
||||||
|
//
|
||||||
|
// Usage:
|
||||||
|
//
|
||||||
|
// ./image2pdf FILENAME.{jpg,png} FILENAME.pdf ["TEXT"]
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <pdfio.h>
|
||||||
|
#include <pdfio-content.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// 'create_pdf_image_file()' - Create a PDF file of an image with optional caption.
|
||||||
|
//
|
||||||
|
|
||||||
|
bool // O - True on success, false on failure
|
||||||
|
create_pdf_image_file(
|
||||||
|
const char *pdfname, // I - PDF filename
|
||||||
|
const char *imagename, // I - Image filename
|
||||||
|
const char *caption) // I - Caption filename
|
||||||
|
{
|
||||||
|
pdfio_file_t *pdf; // PDF file
|
||||||
|
pdfio_obj_t *font; // Caption font
|
||||||
|
pdfio_obj_t *image; // Image
|
||||||
|
pdfio_dict_t *dict; // Page dictionary
|
||||||
|
pdfio_stream_t *page; // Page stream
|
||||||
|
double width, height; // Width and height of image
|
||||||
|
double swidth, sheight; // Scaled width and height on page
|
||||||
|
double tx, ty; // Position on page
|
||||||
|
|
||||||
|
|
||||||
|
// Create the PDF file...
|
||||||
|
pdf = pdfioFileCreate(pdfname, /*version*/NULL, /*media_box*/NULL,
|
||||||
|
/*crop_box*/NULL, /*error_cb*/NULL,
|
||||||
|
/*error_cbdata*/NULL);
|
||||||
|
if (!pdf)
|
||||||
|
return (false);
|
||||||
|
|
||||||
|
// Create a Courier base font for the caption
|
||||||
|
font = pdfioFileCreateFontObjFromBase(pdf, "Courier");
|
||||||
|
|
||||||
|
if (!font)
|
||||||
|
{
|
||||||
|
pdfioFileClose(pdf);
|
||||||
|
return (false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create an image object from the JPEG/PNG image file...
|
||||||
|
image = pdfioFileCreateImageObjFromFile(pdf, imagename, true);
|
||||||
|
|
||||||
|
if (!image)
|
||||||
|
{
|
||||||
|
pdfioFileClose(pdf);
|
||||||
|
return (false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create a page dictionary with the font and image...
|
||||||
|
dict = pdfioDictCreate(pdf);
|
||||||
|
pdfioPageDictAddFont(dict, "F1", font);
|
||||||
|
pdfioPageDictAddImage(dict, "IM1", image);
|
||||||
|
|
||||||
|
// Create the page and its content stream...
|
||||||
|
page = pdfioFileCreatePage(pdf, dict);
|
||||||
|
|
||||||
|
// Position and scale the image on the page...
|
||||||
|
width = pdfioImageGetWidth(image);
|
||||||
|
height = pdfioImageGetHeight(image);
|
||||||
|
|
||||||
|
// Default media_box is "universal" 595.28x792 points (8.27x11in or
|
||||||
|
// 210x279mm). Use margins of 36 points (0.5in or 12.7mm) with another
|
||||||
|
// 36 points for the caption underneath...
|
||||||
|
swidth = 595.28 - 72.0;
|
||||||
|
sheight = swidth * height / width;
|
||||||
|
if (sheight > (792.0 - 36.0 - 72.0))
|
||||||
|
{
|
||||||
|
sheight = 792.0 - 36.0 - 72.0;
|
||||||
|
swidth = sheight * width / height;
|
||||||
|
}
|
||||||
|
|
||||||
|
tx = 0.5 * (595.28 - swidth);
|
||||||
|
ty = 0.5 * (792 - 36 - sheight);
|
||||||
|
|
||||||
|
pdfioContentDrawImage(page, "IM1", tx, ty + 36.0, swidth, sheight);
|
||||||
|
|
||||||
|
// Draw the caption in black...
|
||||||
|
pdfioContentSetFillColorDeviceGray(page, 0.0);
|
||||||
|
|
||||||
|
// Compute the starting point for the text - Courier is monospaced
|
||||||
|
// with a nominal width of 0.6 times the text height...
|
||||||
|
tx = 0.5 * (595.28 - 18.0 * 0.6 * strlen(caption));
|
||||||
|
|
||||||
|
// Position and draw the caption underneath...
|
||||||
|
pdfioContentTextBegin(page);
|
||||||
|
pdfioContentSetTextFont(page, "F1", 18.0);
|
||||||
|
pdfioContentTextMoveTo(page, tx, ty);
|
||||||
|
pdfioContentTextShow(page, /*unicode*/false, caption);
|
||||||
|
pdfioContentTextEnd(page);
|
||||||
|
|
||||||
|
// Close the page stream and the PDF file...
|
||||||
|
pdfioStreamClose(page);
|
||||||
|
pdfioFileClose(pdf);
|
||||||
|
|
||||||
|
return (true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// 'main()' - Produce a single-page file from an image.
|
||||||
|
//
|
||||||
|
|
||||||
|
int // O - Exit status
|
||||||
|
main(int argc, // I - Number of command-line arguments
|
||||||
|
char *argv[]) // I - Command-line arguments
|
||||||
|
{
|
||||||
|
const char *imagefile, // Image filename
|
||||||
|
*pdffile, // PDF filename
|
||||||
|
*caption; // Caption text
|
||||||
|
|
||||||
|
|
||||||
|
// Get the image file, PDF file, and optional caption text from the command-line...
|
||||||
|
if (argc < 3 || argc > 4)
|
||||||
|
{
|
||||||
|
fputs("Usage: image2pdf FILENAME.{jpg,png} FILENAME.pdf [\"TEXT\"]\n", stderr);
|
||||||
|
return (1);
|
||||||
|
}
|
||||||
|
|
||||||
|
imagefile = argv[1];
|
||||||
|
pdffile = argv[2];
|
||||||
|
caption = argv[3];
|
||||||
|
|
||||||
|
return (create_pdf_image_file(imagefile, pdffile, caption) ? 0 : 1);
|
||||||
|
}
|
@ -89,17 +89,37 @@ typedef struct doctarget_s // Document target info
|
|||||||
|
|
||||||
#define DOCTARGET_MAX 1000 // Maximum number of targets per document
|
#define DOCTARGET_MAX 1000 // Maximum number of targets per document
|
||||||
|
|
||||||
|
typedef struct doctoc_s // Document table-of-contents entry
|
||||||
|
{
|
||||||
|
int level; // Level
|
||||||
|
int count; // Total number of child entries
|
||||||
|
pdfio_obj_t *obj; // Dictionary object
|
||||||
|
pdfio_dict_t *dict; // Dictionary value
|
||||||
|
} doctoc_t;
|
||||||
|
|
||||||
|
#define DOCTOC_MAX 1000 // Maximum number of TOC entries
|
||||||
|
|
||||||
typedef struct docdata_s // Document formatting data
|
typedef struct docdata_s // Document formatting data
|
||||||
{
|
{
|
||||||
|
// State for the whole document
|
||||||
pdfio_file_t *pdf; // PDF file
|
pdfio_file_t *pdf; // PDF file
|
||||||
pdfio_rect_t media_box; // Media (page) box
|
pdfio_rect_t media_box; // Media (page) box
|
||||||
pdfio_rect_t crop_box; // Crop box (for margins)
|
pdfio_rect_t crop_box; // Crop box (for margins)
|
||||||
pdfio_rect_t art_box; // Art box (for markdown content)
|
pdfio_rect_t art_box; // Art box (for markdown content)
|
||||||
pdfio_obj_t *fonts[DOCFONT_MAX]; // Embedded fonts
|
pdfio_obj_t *fonts[DOCFONT_MAX]; // Embedded fonts
|
||||||
|
double font_space; // Unit width of a space
|
||||||
size_t num_images; // Number of embedded images
|
size_t num_images; // Number of embedded images
|
||||||
docimage_t images[DOCIMAGE_MAX]; // Embedded images
|
docimage_t images[DOCIMAGE_MAX]; // Embedded images
|
||||||
const char *title; // Document title
|
const char *title; // Document title
|
||||||
char *heading; // Current document heading
|
char *heading; // Current document heading
|
||||||
|
size_t num_actions; // Number of actions for this document
|
||||||
|
docaction_t actions[DOCACTION_MAX]; // Actions for this document
|
||||||
|
size_t num_targets; // Number of targets for this document
|
||||||
|
doctarget_t targets[DOCTARGET_MAX]; // Targets for this document
|
||||||
|
size_t num_toc; // Number of table-of-contents entries
|
||||||
|
doctoc_t toc[DOCTOC_MAX]; // Table-of-contents entries
|
||||||
|
|
||||||
|
// State for the current page
|
||||||
pdfio_stream_t *st; // Current page stream
|
pdfio_stream_t *st; // Current page stream
|
||||||
double y; // Current position on page
|
double y; // Current position on page
|
||||||
docfont_t font; // Current font
|
docfont_t font; // Current font
|
||||||
@ -109,10 +129,6 @@ typedef struct docdata_s // Document formatting data
|
|||||||
pdfio_obj_t *annots_obj; // Annotations object (for links)
|
pdfio_obj_t *annots_obj; // Annotations object (for links)
|
||||||
size_t num_links; // Number of links for this page
|
size_t num_links; // Number of links for this page
|
||||||
doclink_t links[DOCLINK_MAX]; // Links for this page
|
doclink_t links[DOCLINK_MAX]; // Links for this page
|
||||||
size_t num_actions; // Number of actions for this document
|
|
||||||
docaction_t actions[DOCACTION_MAX]; // Actions for this document
|
|
||||||
size_t num_targets; // Number of targets for this document
|
|
||||||
doctarget_t targets[DOCTARGET_MAX]; // Targets for this document
|
|
||||||
} docdata_t;
|
} docdata_t;
|
||||||
|
|
||||||
typedef struct linefrag_s // Line fragment
|
typedef struct linefrag_s // Line fragment
|
||||||
@ -193,10 +209,17 @@ static const char * const docfont_names[] =
|
|||||||
"FM"
|
"FM"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define BQ_PADDING 18.0 // Padding for block quotes
|
||||||
|
#define BQ_THICKNESS 3.0 // Thickness of block quote bar
|
||||||
|
|
||||||
|
#define CODE_PADDING 4.5 // Padding for code blocks
|
||||||
|
|
||||||
#define IMAGE_PPI 100.0 // Pixels per inch for images
|
#define IMAGE_PPI 100.0 // Pixels per inch for images
|
||||||
|
|
||||||
#define LINE_HEIGHT 1.4 // Multiplier for line height
|
#define LINE_HEIGHT 1.4 // Multiplier for line height
|
||||||
|
|
||||||
|
#define LIST_PADDING 36.0 // Padding/indentation for lists
|
||||||
|
|
||||||
#define SIZE_BODY 11.0 // Size of body text (points)
|
#define SIZE_BODY 11.0 // Size of body text (points)
|
||||||
#define SIZE_CODEBLOCK 10.0 // Size of code block text (points)
|
#define SIZE_CODEBLOCK 10.0 // Size of code block text (points)
|
||||||
#define SIZE_HEADFOOT 9.0 // Size of header/footer text (points)
|
#define SIZE_HEADFOOT 9.0 // Size of header/footer text (points)
|
||||||
@ -239,11 +262,12 @@ static double measure_cell(docdata_t *dd, mmd_t *cell, tablecol_t *col);
|
|||||||
static mmd_t *mmd_walk_next(mmd_t *top, mmd_t *node);
|
static mmd_t *mmd_walk_next(mmd_t *top, mmd_t *node);
|
||||||
static void new_page(docdata_t *dd);
|
static void new_page(docdata_t *dd);
|
||||||
static ssize_t output_cb(void *output_cbdata, const void *buffer, size_t bytes);
|
static ssize_t output_cb(void *output_cbdata, const void *buffer, size_t bytes);
|
||||||
static void render_line(docdata_t *dd, double margin_left, double margin_top, double need_bottom, double lineheight, size_t num_frags, linefrag_t *frags);
|
static void render_line(docdata_t *dd, double margin_left, double need_bottom, double lineheight, size_t num_frags, linefrag_t *frags);
|
||||||
static void render_row(docdata_t *dd, size_t num_cols, tablecol_t *cols, tablerow_t *row);
|
static void render_row(docdata_t *dd, size_t num_cols, tablecol_t *cols, tablerow_t *row);
|
||||||
static void set_color(docdata_t *dd, doccolor_t color);
|
static void set_color(docdata_t *dd, doccolor_t color);
|
||||||
static void set_font(docdata_t *dd, docfont_t font, double fsize);
|
static void set_font(docdata_t *dd, docfont_t font, double fsize);
|
||||||
static void write_actions(docdata_t *dd);
|
static void write_actions(docdata_t *dd);
|
||||||
|
static void write_toc(docdata_t *dd);
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -289,7 +313,8 @@ main(int argc, // I - Number of command-line arguments
|
|||||||
dd.art_box.x2 = PAGE_RIGHT;
|
dd.art_box.x2 = PAGE_RIGHT;
|
||||||
dd.art_box.y2 = PAGE_TOP;
|
dd.art_box.y2 = PAGE_TOP;
|
||||||
|
|
||||||
dd.title = mmdGetMetadata(doc, "title");
|
if ((dd.title = mmdGetMetadata(doc, "title")) == NULL)
|
||||||
|
dd.art_box.y2 = PAGE_HEADER; // No header if there is no title
|
||||||
|
|
||||||
if (argc == 2)
|
if (argc == 2)
|
||||||
{
|
{
|
||||||
@ -332,6 +357,8 @@ main(int argc, // I - Number of command-line arguments
|
|||||||
#endif // USE_TRUETYPE
|
#endif // USE_TRUETYPE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dd.font_space = pdfioContentTextMeasure(dd.fonts[DOCFONT_REGULAR], " ", 1.0);
|
||||||
|
|
||||||
// Add images...
|
// Add images...
|
||||||
add_images(&dd, doc);
|
add_images(&dd, doc);
|
||||||
|
|
||||||
@ -344,7 +371,12 @@ main(int argc, // I - Number of command-line arguments
|
|||||||
pdfioStreamClose(dd.st);
|
pdfioStreamClose(dd.st);
|
||||||
add_links(&dd);
|
add_links(&dd);
|
||||||
}
|
}
|
||||||
|
|
||||||
write_actions(&dd);
|
write_actions(&dd);
|
||||||
|
|
||||||
|
if (dd.num_toc > 0)
|
||||||
|
write_toc(&dd);
|
||||||
|
|
||||||
pdfioFileClose(dd.pdf);
|
pdfioFileClose(dd.pdf);
|
||||||
|
|
||||||
mmdFree(doc);
|
mmdFree(doc);
|
||||||
@ -548,7 +580,6 @@ format_block(docdata_t *dd, // I - Document data
|
|||||||
width, // Width of current fragment
|
width, // Width of current fragment
|
||||||
wswidth, // Width of whitespace
|
wswidth, // Width of whitespace
|
||||||
margin_left, // Left margin
|
margin_left, // Left margin
|
||||||
margin_top, // Top margin
|
|
||||||
need_bottom, // Space needed after this block
|
need_bottom, // Space needed after this block
|
||||||
height, // Height of current fragment
|
height, // Height of current fragment
|
||||||
lineheight; // Height of current line
|
lineheight; // Height of current line
|
||||||
@ -556,11 +587,6 @@ format_block(docdata_t *dd, // I - Document data
|
|||||||
|
|
||||||
blocktype = mmdGetType(block);
|
blocktype = mmdGetType(block);
|
||||||
|
|
||||||
if ((blocktype >= MMD_TYPE_TABLE_HEADER_CELL && blocktype <= MMD_TYPE_TABLE_BODY_CELL_RIGHT) || blocktype == MMD_TYPE_LIST_ITEM)
|
|
||||||
margin_top = 0.0;
|
|
||||||
else
|
|
||||||
margin_top = fsize * LINE_HEIGHT;
|
|
||||||
|
|
||||||
if (mmdGetNextSibling(block))
|
if (mmdGetNextSibling(block))
|
||||||
need_bottom = 3.0 * SIZE_BODY * LINE_HEIGHT;
|
need_bottom = 3.0 * SIZE_BODY * LINE_HEIGHT;
|
||||||
else
|
else
|
||||||
@ -569,12 +595,16 @@ format_block(docdata_t *dd, // I - Document data
|
|||||||
if (leader)
|
if (leader)
|
||||||
{
|
{
|
||||||
// Add leader text on first line...
|
// Add leader text on first line...
|
||||||
frags[0].width = pdfioContentTextMeasure(dd->fonts[deffont], leader, fsize);
|
frags[0].type = MMD_TYPE_NORMAL_TEXT;
|
||||||
frags[0].height = fsize;
|
frags[0].width = pdfioContentTextMeasure(dd->fonts[deffont], leader, fsize);
|
||||||
frags[0].x = left - frags[0].width;
|
frags[0].height = fsize;
|
||||||
frags[0].text = leader;
|
frags[0].x = left - frags[0].width;
|
||||||
frags[0].font = deffont;
|
frags[0].imagenum = 0;
|
||||||
frags[0].color = DOCCOLOR_BLACK;
|
frags[0].text = leader;
|
||||||
|
frags[0].url = NULL;
|
||||||
|
frags[0].ws = false;
|
||||||
|
frags[0].font = deffont;
|
||||||
|
frags[0].color = DOCCOLOR_BLACK;
|
||||||
|
|
||||||
num_frags = 1;
|
num_frags = 1;
|
||||||
lineheight = fsize * LINE_HEIGHT;
|
lineheight = fsize * LINE_HEIGHT;
|
||||||
@ -598,7 +628,7 @@ format_block(docdata_t *dd, // I - Document data
|
|||||||
imagenum = 0;
|
imagenum = 0;
|
||||||
url = mmdGetURL(current);
|
url = mmdGetURL(current);
|
||||||
ws = mmdGetWhitespace(current);
|
ws = mmdGetWhitespace(current);
|
||||||
wswidth = 0.0;
|
wswidth = ws ? dd->font_space * fsize : 0.0;
|
||||||
next = mmd_walk_next(block, current);
|
next = mmd_walk_next(block, current);
|
||||||
|
|
||||||
// Process the node...
|
// Process the node...
|
||||||
@ -635,25 +665,20 @@ format_block(docdata_t *dd, // I - Document data
|
|||||||
else
|
else
|
||||||
margin_left = 0.0;
|
margin_left = 0.0;
|
||||||
|
|
||||||
render_line(dd, margin_left, margin_top, need_bottom, lineheight, num_frags, frags);
|
render_line(dd, margin_left, need_bottom, lineheight, num_frags, frags);
|
||||||
|
|
||||||
if (deffont == DOCFONT_ITALIC)
|
if (deffont == DOCFONT_ITALIC)
|
||||||
{
|
{
|
||||||
// Add an orange bar to the left of block quotes...
|
// Add an orange bar to the left of block quotes...
|
||||||
set_color(dd, DOCCOLOR_ORANGE);
|
set_color(dd, DOCCOLOR_ORANGE);
|
||||||
pdfioContentSave(dd->st);
|
pdfioContentPathRect(dd->st, left - BQ_PADDING, dd->y - (LINE_HEIGHT - 1.0) * fsize - BQ_THICKNESS, BQ_THICKNESS, lineheight + 2.0 * BQ_THICKNESS);
|
||||||
pdfioContentSetLineWidth(dd->st, 3.0);
|
pdfioContentFill(dd->st, /*even_odd*/false);
|
||||||
pdfioContentPathMoveTo(dd->st, left - 6.0, dd->y - (LINE_HEIGHT - 1.0) * fsize);
|
|
||||||
pdfioContentPathLineTo(dd->st, left - 6.0, dd->y + fsize);
|
|
||||||
pdfioContentStroke(dd->st);
|
|
||||||
pdfioContentRestore(dd->st);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
num_frags = 0;
|
num_frags = 0;
|
||||||
frag = frags;
|
frag = frags;
|
||||||
x = left;
|
x = left;
|
||||||
lineheight = 0.0;
|
lineheight = 0.0;
|
||||||
margin_top = 0.0;
|
|
||||||
need_bottom = 0.0;
|
need_bottom = 0.0;
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
@ -688,9 +713,6 @@ format_block(docdata_t *dd, // I - Document data
|
|||||||
|
|
||||||
width = pdfioContentTextMeasure(dd->fonts[font], text, fsize);
|
width = pdfioContentTextMeasure(dd->fonts[font], text, fsize);
|
||||||
height = fsize * LINE_HEIGHT;
|
height = fsize * LINE_HEIGHT;
|
||||||
|
|
||||||
if (ws)
|
|
||||||
wswidth = pdfioContentTextMeasure(dd->fonts[font], " ", fsize);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// See if this node will fit on the current line...
|
// See if this node will fit on the current line...
|
||||||
@ -704,7 +726,13 @@ format_block(docdata_t *dd, // I - Document data
|
|||||||
else
|
else
|
||||||
margin_left = 0.0;
|
margin_left = 0.0;
|
||||||
|
|
||||||
render_line(dd, margin_left, margin_top, need_bottom, lineheight, num_frags, frags);
|
render_line(dd, margin_left, need_bottom, lineheight, num_frags, frags);
|
||||||
|
|
||||||
|
num_frags = 0;
|
||||||
|
frag = frags;
|
||||||
|
x = left;
|
||||||
|
lineheight = 0.0;
|
||||||
|
need_bottom = 0.0;
|
||||||
|
|
||||||
if (deffont == DOCFONT_ITALIC)
|
if (deffont == DOCFONT_ITALIC)
|
||||||
{
|
{
|
||||||
@ -717,18 +745,12 @@ format_block(docdata_t *dd, // I - Document data
|
|||||||
pdfioContentStroke(dd->st);
|
pdfioContentStroke(dd->st);
|
||||||
pdfioContentRestore(dd->st);
|
pdfioContentRestore(dd->st);
|
||||||
}
|
}
|
||||||
|
|
||||||
num_frags = 0;
|
|
||||||
frag = frags;
|
|
||||||
x = left;
|
|
||||||
lineheight = 0.0;
|
|
||||||
margin_top = 0.0;
|
|
||||||
need_bottom = 0.0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the current node to the fragment list
|
// Add the current node to the fragment list
|
||||||
if (num_frags == 0)
|
if (num_frags == 0)
|
||||||
{
|
{
|
||||||
|
// No leading whitespace at the start of the line
|
||||||
ws = false;
|
ws = false;
|
||||||
wswidth = 0.0;
|
wswidth = 0.0;
|
||||||
}
|
}
|
||||||
@ -760,7 +782,7 @@ format_block(docdata_t *dd, // I - Document data
|
|||||||
else
|
else
|
||||||
margin_left = 0.0;
|
margin_left = 0.0;
|
||||||
|
|
||||||
render_line(dd, margin_left, margin_top, need_bottom, lineheight, num_frags, frags);
|
render_line(dd, margin_left, need_bottom, lineheight, num_frags, frags);
|
||||||
|
|
||||||
if (deffont == DOCFONT_ITALIC)
|
if (deffont == DOCFONT_ITALIC)
|
||||||
{
|
{
|
||||||
@ -791,19 +813,27 @@ format_code(docdata_t *dd, // I - Document data
|
|||||||
double lineheight; // Line height
|
double lineheight; // Line height
|
||||||
|
|
||||||
|
|
||||||
|
// Compute line height...
|
||||||
|
lineheight = SIZE_CODEBLOCK * LINE_HEIGHT;
|
||||||
|
|
||||||
// Start a new page as needed...
|
// Start a new page as needed...
|
||||||
if (!dd->st)
|
if (!dd->st)
|
||||||
new_page(dd);
|
new_page(dd);
|
||||||
|
|
||||||
lineheight = SIZE_CODEBLOCK * LINE_HEIGHT;
|
dd->y -= lineheight + CODE_PADDING;
|
||||||
dd->y -= 2.0 * lineheight;
|
|
||||||
if ((dd->y - lineheight) < dd->art_box.y1)
|
if ((dd->y - lineheight) < dd->art_box.y1)
|
||||||
{
|
{
|
||||||
new_page(dd);
|
new_page(dd);
|
||||||
|
|
||||||
dd->y -= lineheight;
|
dd->y -= lineheight + CODE_PADDING;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Draw the top padding...
|
||||||
|
set_color(dd, DOCCOLOR_LTGRAY);
|
||||||
|
pdfioContentPathRect(dd->st, left - CODE_PADDING, dd->y + SIZE_CODEBLOCK, right - left + 2.0 * CODE_PADDING, CODE_PADDING);
|
||||||
|
pdfioContentFillAndStroke(dd->st, false);
|
||||||
|
|
||||||
// Start a code text block...
|
// Start a code text block...
|
||||||
set_font(dd, DOCFONT_MONOSPACE, SIZE_CODEBLOCK);
|
set_font(dd, DOCFONT_MONOSPACE, SIZE_CODEBLOCK);
|
||||||
pdfioContentTextBegin(dd->st);
|
pdfioContentTextBegin(dd->st);
|
||||||
@ -812,7 +842,7 @@ format_code(docdata_t *dd, // I - Document data
|
|||||||
for (code = mmdGetFirstChild(block); code; code = mmdGetNextSibling(code))
|
for (code = mmdGetFirstChild(block); code; code = mmdGetNextSibling(code))
|
||||||
{
|
{
|
||||||
set_color(dd, DOCCOLOR_LTGRAY);
|
set_color(dd, DOCCOLOR_LTGRAY);
|
||||||
pdfioContentPathRect(dd->st, left - 3.0, dd->y - (LINE_HEIGHT - 1.0) * SIZE_CODEBLOCK, right - left + 6.0, lineheight);
|
pdfioContentPathRect(dd->st, left - CODE_PADDING, dd->y - (LINE_HEIGHT - 1.0) * SIZE_CODEBLOCK, right - left + 2.0 * CODE_PADDING, lineheight);
|
||||||
pdfioContentFillAndStroke(dd->st, false);
|
pdfioContentFillAndStroke(dd->st, false);
|
||||||
|
|
||||||
set_color(dd, DOCCOLOR_RED);
|
set_color(dd, DOCCOLOR_RED);
|
||||||
@ -838,6 +868,11 @@ format_code(docdata_t *dd, // I - Document data
|
|||||||
// End the current text block...
|
// End the current text block...
|
||||||
pdfioContentTextEnd(dd->st);
|
pdfioContentTextEnd(dd->st);
|
||||||
dd->y += lineheight;
|
dd->y += lineheight;
|
||||||
|
|
||||||
|
// Draw the bottom padding...
|
||||||
|
set_color(dd, DOCCOLOR_LTGRAY);
|
||||||
|
pdfioContentPathRect(dd->st, left - CODE_PADDING, dd->y - CODE_PADDING - (LINE_HEIGHT - 1.0) * SIZE_CODEBLOCK, right - left + 2.0 * CODE_PADDING, CODE_PADDING);
|
||||||
|
pdfioContentFillAndStroke(dd->st, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -883,15 +918,14 @@ format_doc(docdata_t *dd, // I - Document data
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case MMD_TYPE_BLOCK_QUOTE :
|
case MMD_TYPE_BLOCK_QUOTE :
|
||||||
format_doc(dd, current, DOCFONT_ITALIC, left + 36.0, right - 36.0);
|
format_doc(dd, current, DOCFONT_ITALIC, left + BQ_PADDING, right - BQ_PADDING);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MMD_TYPE_ORDERED_LIST :
|
case MMD_TYPE_ORDERED_LIST :
|
||||||
case MMD_TYPE_UNORDERED_LIST :
|
case MMD_TYPE_UNORDERED_LIST :
|
||||||
if (dd->st)
|
dd->y -= SIZE_BODY * LINE_HEIGHT;
|
||||||
dd->y -= SIZE_BODY * LINE_HEIGHT;
|
|
||||||
|
|
||||||
format_doc(dd, current, deffont, left + 36.0, right);
|
format_doc(dd, current, deffont, left + LIST_PADDING, right);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MMD_TYPE_LIST_ITEM :
|
case MMD_TYPE_LIST_ITEM :
|
||||||
@ -912,13 +946,41 @@ format_doc(docdata_t *dd, // I - Document data
|
|||||||
case MMD_TYPE_HEADING_4 :
|
case MMD_TYPE_HEADING_4 :
|
||||||
case MMD_TYPE_HEADING_5 :
|
case MMD_TYPE_HEADING_5 :
|
||||||
case MMD_TYPE_HEADING_6 :
|
case MMD_TYPE_HEADING_6 :
|
||||||
if (dd->heading)
|
// Update the current heading
|
||||||
free(dd->heading);
|
free(dd->heading);
|
||||||
|
|
||||||
dd->heading = mmdCopyAllText(current);
|
dd->heading = mmdCopyAllText(current);
|
||||||
|
|
||||||
|
// Add a blank line before the heading...
|
||||||
|
dd->y -= heading_sizes[curtype - MMD_TYPE_HEADING_1] * LINE_HEIGHT;
|
||||||
|
|
||||||
|
// Format the heading...
|
||||||
format_block(dd, current, DOCFONT_BOLD, heading_sizes[curtype - MMD_TYPE_HEADING_1], left, right, /*leader*/NULL);
|
format_block(dd, current, DOCFONT_BOLD, heading_sizes[curtype - MMD_TYPE_HEADING_1], left, right, /*leader*/NULL);
|
||||||
|
|
||||||
|
// Add the heading to the table-of-contents...
|
||||||
|
if (dd->num_toc < DOCTOC_MAX)
|
||||||
|
{
|
||||||
|
doctoc_t *t = dd->toc + dd->num_toc;
|
||||||
|
// New TOC
|
||||||
|
pdfio_array_t *dest; // Destination array
|
||||||
|
|
||||||
|
t->level = curtype - MMD_TYPE_HEADING_1;
|
||||||
|
t->dict = pdfioDictCreate(dd->pdf);
|
||||||
|
t->obj = pdfioFileCreateObj(dd->pdf, t->dict);
|
||||||
|
dest = pdfioArrayCreate(dd->pdf);
|
||||||
|
|
||||||
|
pdfioArrayAppendObj(dest, pdfioFileGetPage(dd->pdf, pdfioFileGetNumPages(dd->pdf) - 1));
|
||||||
|
pdfioArrayAppendName(dest, "XYZ");
|
||||||
|
pdfioArrayAppendNumber(dest, PAGE_LEFT);
|
||||||
|
pdfioArrayAppendNumber(dest, dd->y + heading_sizes[curtype - MMD_TYPE_HEADING_1] * LINE_HEIGHT);
|
||||||
|
pdfioArrayAppendNumber(dest, 0.0);
|
||||||
|
|
||||||
|
pdfioDictSetArray(t->dict, "Dest", dest);
|
||||||
|
pdfioDictSetString(t->dict, "Title", pdfioStringCreate(dd->pdf, dd->heading));
|
||||||
|
|
||||||
|
dd->num_toc ++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add the heading to the list of link targets...
|
||||||
if (dd->num_targets < DOCTARGET_MAX)
|
if (dd->num_targets < DOCTARGET_MAX)
|
||||||
{
|
{
|
||||||
doctarget_t *t = dd->targets + dd->num_targets;
|
doctarget_t *t = dd->targets + dd->num_targets;
|
||||||
@ -933,15 +995,27 @@ format_doc(docdata_t *dd, // I - Document data
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case MMD_TYPE_PARAGRAPH :
|
case MMD_TYPE_PARAGRAPH :
|
||||||
|
// Add a blank line before the paragraph...
|
||||||
|
dd->y -= SIZE_BODY * LINE_HEIGHT;
|
||||||
|
|
||||||
|
// Format the paragraph...
|
||||||
format_block(dd, current, deffont, SIZE_BODY, left, right, /*leader*/NULL);
|
format_block(dd, current, deffont, SIZE_BODY, left, right, /*leader*/NULL);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MMD_TYPE_TABLE :
|
case MMD_TYPE_TABLE :
|
||||||
|
// Add a blank line before the paragraph...
|
||||||
|
dd->y -= SIZE_BODY * LINE_HEIGHT;
|
||||||
|
|
||||||
|
// Format the table...
|
||||||
format_table(dd, current, left, right);
|
format_table(dd, current, left, right);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MMD_TYPE_CODE_BLOCK :
|
case MMD_TYPE_CODE_BLOCK :
|
||||||
format_code(dd, current, left + 36.0, right - 36.0);
|
// Add a blank line before the code block...
|
||||||
|
dd->y -= SIZE_BODY * LINE_HEIGHT;
|
||||||
|
|
||||||
|
// Format the code block...
|
||||||
|
format_code(dd, current, left + CODE_PADDING, right - CODE_PADDING);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -975,14 +1049,10 @@ format_table(docdata_t *dd, // I - Document data
|
|||||||
|
|
||||||
|
|
||||||
// Find all of the rows and columns in the table...
|
// Find all of the rows and columns in the table...
|
||||||
num_cols = num_rows = 0;
|
|
||||||
|
|
||||||
memset(cols, 0, sizeof(cols));
|
memset(cols, 0, sizeof(cols));
|
||||||
memset(rows, 0, sizeof(rows));
|
memset(rows, 0, sizeof(rows));
|
||||||
|
|
||||||
rowptr = rows;
|
for (num_cols = 0, num_rows = 0, rowptr = rows, current = mmdGetFirstChild(table); current && num_rows < TABLEROW_MAX; current = next)
|
||||||
|
|
||||||
for (current = mmdGetFirstChild(table); current && num_rows < TABLEROW_MAX; current = next)
|
|
||||||
{
|
{
|
||||||
next = mmd_walk_next(table, current);
|
next = mmd_walk_next(table, current);
|
||||||
type = mmdGetType(current);
|
type = mmdGetType(current);
|
||||||
@ -1074,9 +1144,6 @@ format_table(docdata_t *dd, // I - Document data
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Render each table row...
|
// Render each table row...
|
||||||
if (dd->st)
|
|
||||||
dd->y -= SIZE_TABLE * LINE_HEIGHT;
|
|
||||||
|
|
||||||
for (row = 0, rowptr = rows; row < num_rows; row ++, rowptr ++)
|
for (row = 0, rowptr = rows; row < num_rows; row ++, rowptr ++)
|
||||||
render_row(dd, num_cols, cols, rowptr);
|
render_row(dd, num_cols, cols, rowptr);
|
||||||
}
|
}
|
||||||
@ -1298,15 +1365,15 @@ new_page(docdata_t *dd) // I - Document data
|
|||||||
|
|
||||||
// Prep the new page...
|
// Prep the new page...
|
||||||
page_dict = pdfioDictCreate(dd->pdf);
|
page_dict = pdfioDictCreate(dd->pdf);
|
||||||
|
|
||||||
dd->annots_array = pdfioArrayCreate(dd->pdf);
|
dd->annots_array = pdfioArrayCreate(dd->pdf);
|
||||||
dd->annots_obj = pdfioFileCreateArrayObj(dd->pdf, dd->annots_array);
|
dd->annots_obj = pdfioFileCreateArrayObj(dd->pdf, dd->annots_array);
|
||||||
|
pdfioDictSetObj(page_dict, "Annots", dd->annots_obj);
|
||||||
|
|
||||||
pdfioDictSetRect(page_dict, "MediaBox", &dd->media_box);
|
pdfioDictSetRect(page_dict, "MediaBox", &dd->media_box);
|
||||||
// pdfioDictSetRect(page_dict, "CropBox", &dd->crop_box);
|
// pdfioDictSetRect(page_dict, "CropBox", &dd->crop_box);
|
||||||
pdfioDictSetRect(page_dict, "ArtBox", &dd->art_box);
|
pdfioDictSetRect(page_dict, "ArtBox", &dd->art_box);
|
||||||
|
|
||||||
pdfioDictSetObj(page_dict, "Annots", dd->annots_obj);
|
|
||||||
|
|
||||||
for (fontface = DOCFONT_REGULAR; fontface < DOCFONT_MAX; fontface ++)
|
for (fontface = DOCFONT_REGULAR; fontface < DOCFONT_MAX; fontface ++)
|
||||||
pdfioPageDictAddFont(page_dict, docfont_names[fontface], dd->fonts[fontface]);
|
pdfioPageDictAddFont(page_dict, docfont_names[fontface], dd->fonts[fontface]);
|
||||||
|
|
||||||
@ -1403,7 +1470,6 @@ output_cb(void *output_cbdata, // I - Callback data (not used)
|
|||||||
static void
|
static void
|
||||||
render_line(docdata_t *dd, // I - Document data
|
render_line(docdata_t *dd, // I - Document data
|
||||||
double margin_left, // I - Left margin
|
double margin_left, // I - Left margin
|
||||||
double margin_top, // I - Top margin
|
|
||||||
double need_bottom, // I - How much space is needed after
|
double need_bottom, // I - How much space is needed after
|
||||||
double lineheight, // I - Height of line
|
double lineheight, // I - Height of line
|
||||||
size_t num_frags, // I - Number of line fragments
|
size_t num_frags, // I - Number of line fragments
|
||||||
@ -1415,12 +1481,9 @@ render_line(docdata_t *dd, // I - Document data
|
|||||||
|
|
||||||
|
|
||||||
if (!dd->st)
|
if (!dd->st)
|
||||||
{
|
|
||||||
new_page(dd);
|
new_page(dd);
|
||||||
margin_top = 0.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
dd->y -= margin_top + lineheight;
|
dd->y -= lineheight;
|
||||||
if ((dd->y - need_bottom) < dd->art_box.y1)
|
if ((dd->y - need_bottom) < dd->art_box.y1)
|
||||||
{
|
{
|
||||||
new_page(dd);
|
new_page(dd);
|
||||||
@ -1459,9 +1522,6 @@ render_line(docdata_t *dd, // I - Document data
|
|||||||
else if (frag->text)
|
else if (frag->text)
|
||||||
{
|
{
|
||||||
// Draw text
|
// Draw text
|
||||||
set_color(dd, frag->color);
|
|
||||||
set_font(dd, frag->font, frag->height);
|
|
||||||
|
|
||||||
if (!in_text)
|
if (!in_text)
|
||||||
{
|
{
|
||||||
pdfioContentTextBegin(dd->st);
|
pdfioContentTextBegin(dd->st);
|
||||||
@ -1470,10 +1530,19 @@ render_line(docdata_t *dd, // I - Document data
|
|||||||
in_text = true;
|
in_text = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (frag->ws)
|
if (frag->ws && frag->font == DOCFONT_MONOSPACE)
|
||||||
pdfioContentTextShowf(dd->st, UNICODE_VALUE, " %s", frag->text);
|
{
|
||||||
else
|
set_font(dd, DOCFONT_REGULAR, frag->height);
|
||||||
|
pdfioContentTextShow(dd->st, UNICODE_VALUE, " ");
|
||||||
|
}
|
||||||
|
|
||||||
|
set_color(dd, frag->color);
|
||||||
|
set_font(dd, frag->font, frag->height);
|
||||||
|
|
||||||
|
if (frag->font == DOCFONT_MONOSPACE)
|
||||||
pdfioContentTextShow(dd->st, UNICODE_VALUE, frag->text);
|
pdfioContentTextShow(dd->st, UNICODE_VALUE, frag->text);
|
||||||
|
else
|
||||||
|
pdfioContentTextShowf(dd->st, UNICODE_VALUE, "%s%s", frag->ws ? " " : "", frag->text);
|
||||||
|
|
||||||
if (frag->url && dd->num_links < DOCLINK_MAX)
|
if (frag->url && dd->num_links < DOCLINK_MAX)
|
||||||
{
|
{
|
||||||
@ -1690,3 +1759,107 @@ write_actions(docdata_t *dd) // I - Document data
|
|||||||
pdfioObjClose(a->obj);
|
pdfioObjClose(a->obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// 'write_toc()' - Write the table-of-contents outline.
|
||||||
|
//
|
||||||
|
|
||||||
|
static void
|
||||||
|
write_toc(docdata_t *dd) // I - Document data
|
||||||
|
{
|
||||||
|
size_t i, j; // Looping vars
|
||||||
|
doctoc_t *t, // Table-of-contents entry
|
||||||
|
*nt, // Next entry
|
||||||
|
*levels[6]; // Current entries for each level
|
||||||
|
int level; // Current level
|
||||||
|
pdfio_dict_t *dict; // Outline dictionary
|
||||||
|
pdfio_obj_t *obj; // Outline object
|
||||||
|
|
||||||
|
|
||||||
|
// Initialize the various TOC levels...
|
||||||
|
levels[0] = levels[1] = levels[2] = levels[3] = levels[4] = levels[5] = NULL;
|
||||||
|
|
||||||
|
// Scan the table of contents and finalize the dictionaries...
|
||||||
|
for (i = 0, t = dd->toc; i < dd->num_toc; i ++, t ++)
|
||||||
|
{
|
||||||
|
// Set parent, previous, and next entries...
|
||||||
|
if (t->level > 0 && levels[t->level - 1])
|
||||||
|
pdfioDictSetObj(t->dict, "Parent", levels[t->level - 1]->obj);
|
||||||
|
|
||||||
|
if (levels[t->level])
|
||||||
|
pdfioDictSetObj(t->dict, "Prev", levels[t->level]->obj);
|
||||||
|
|
||||||
|
for (j = i + 1, nt = t + 1; j < dd->num_toc; j ++, nt ++)
|
||||||
|
{
|
||||||
|
if (nt->level == t->level)
|
||||||
|
{
|
||||||
|
pdfioDictSetObj(t->dict, "Next", nt->obj);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else if (nt->level < t->level)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// First, last, and count...
|
||||||
|
for (level = 0; level < t->level; level ++)
|
||||||
|
levels[level]->count ++;
|
||||||
|
|
||||||
|
levels[t->level] = t;
|
||||||
|
|
||||||
|
if ((i + 1) < dd->num_toc && t[1].level > t->level)
|
||||||
|
pdfioDictSetObj(t->dict, "First", t[1].obj);
|
||||||
|
|
||||||
|
if ((i + 1) >= dd->num_toc)
|
||||||
|
{
|
||||||
|
// Close out all levels...
|
||||||
|
for (level = t->level; level > 0; level --)
|
||||||
|
{
|
||||||
|
pdfioDictSetObj(levels[level - 1]->dict, "Last", levels[level]->obj);
|
||||||
|
levels[level] = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (t->level > t[1].level)
|
||||||
|
{
|
||||||
|
// Close out N levels...
|
||||||
|
for (level = t->level; level > t[1].level; level --)
|
||||||
|
{
|
||||||
|
pdfioDictSetObj(levels[level - 1]->dict, "Last", levels[level]->obj);
|
||||||
|
levels[level] = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create the top-level outline object...
|
||||||
|
dict = pdfioDictCreate(dd->pdf);
|
||||||
|
obj = pdfioFileCreateObj(dd->pdf, dict);
|
||||||
|
|
||||||
|
pdfioDictSetName(dict, "Type", "Outline");
|
||||||
|
pdfioDictSetNumber(dict, "Count", dd->num_toc);
|
||||||
|
pdfioDictSetObj(dict, "First", dd->toc[0].obj);
|
||||||
|
|
||||||
|
// Close the objects for the entries...
|
||||||
|
for (i = 0, t = dd->toc; i < dd->num_toc; i ++, t ++)
|
||||||
|
{
|
||||||
|
if (t->level == 0)
|
||||||
|
pdfioDictSetObj(dict, "Last", t->obj);
|
||||||
|
|
||||||
|
if (t->count)
|
||||||
|
{
|
||||||
|
// Set Count value...
|
||||||
|
if (t->level == 0)
|
||||||
|
pdfioDictSetNumber(t->dict, "Count", t->count);
|
||||||
|
else
|
||||||
|
pdfioDictSetNumber(t->dict, "Count", -t->count);
|
||||||
|
}
|
||||||
|
|
||||||
|
pdfioObjClose(t->obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Close the outline object and add it to the document catalog...
|
||||||
|
pdfioObjClose(obj);
|
||||||
|
|
||||||
|
pdfioDictSetObj(pdfioFileGetCatalog(dd->pdf), "Outlines", obj);
|
||||||
|
}
|
||||||
|
@ -1,22 +1,10 @@
|
|||||||
---
|
---
|
||||||
title: Markdown to PDF Converter Example
|
title: Markdown to PDF Converter Test File
|
||||||
...
|
...
|
||||||
|
|
||||||
Markdown to PDF Converter Example
|
|
||||||
=================================
|
|
||||||
|
|
||||||
The `md2pdf` example program reads a markdown file and formats the content onto
|
Markdown to PDF Converter Test File
|
||||||
pages in a PDF file. It demonstrates how to:
|
===================================
|
||||||
|
|
||||||
- Embed base and TrueType fonts,
|
|
||||||
- Format text,
|
|
||||||
- Embed JPEG and PNG images,
|
|
||||||
- Add headers and footers, and
|
|
||||||
- Add hyperlinks.
|
|
||||||
|
|
||||||
|
|
||||||
Source Files
|
|
||||||
------------
|
|
||||||
|
|
||||||
The `md2pdf` program is organized into three source files: `md2pdf.c` which
|
The `md2pdf` program is organized into three source files: `md2pdf.c` which
|
||||||
contains the code to format the markdown content and `mmd.h` and `mmd.c` (from
|
contains the code to format the markdown content and `mmd.h` and `mmd.c` (from
|
||||||
@ -24,4 +12,73 @@ the [Miniature Markdown Library][MMD] project) which load the markdown content.
|
|||||||
|
|
||||||
[MMD]: https://www.msweet.org/mmd/
|
[MMD]: https://www.msweet.org/mmd/
|
||||||
|
|
||||||
|
This is a test file for `md2pdf`. Here is a bullet list:
|
||||||
|
|
||||||
|
- Embed base and TrueType fonts,
|
||||||
|
- Format text with embedded JPEG and PNG images and check boxes, with support
|
||||||
|
for wrapping, alignment in table cells, leader text (as used for lists), and
|
||||||
|
variable line height,
|
||||||
|
- Add headers and footers, and
|
||||||
|
- Add hyperlinks and document platform.
|
||||||
|
|
||||||
|
And here is an ordered list:
|
||||||
|
|
||||||
|
1. Embed base and TrueType fonts,
|
||||||
|
2. Format text with embedded JPEG and PNG images and check boxes, with support
|
||||||
|
for wrapping, alignment in table cells, leader text (as used for lists), and
|
||||||
|
variable line height,
|
||||||
|
3. Add headers and footers, and
|
||||||
|
4. Add hyperlinks and document platform.
|
||||||
|
|
||||||
|
|
||||||
|
Code Blocks
|
||||||
|
-----------
|
||||||
|
|
||||||
|
```
|
||||||
|
0 1 2 3 4 5 6 7 8
|
||||||
|
12345678901234567890123456789012345678901234567890123456789012345678901234567890
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
Images
|
||||||
|
------
|
||||||
|
|
||||||
|
PDFio book cover image:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
Tables
|
||||||
|
------
|
||||||
|
|
||||||
|
Table with leading/trailing pipes:
|
||||||
|
|
||||||
|
| Heading 1 | Heading 2 | Heading 3 |
|
||||||
|
| --------- | --------- | --------- |
|
||||||
|
| Cell 1,1 | Cell 1,2 | Cell 1,3 |
|
||||||
|
| Cell 2,1 | Cell 2,2 | Cell 2,3 |
|
||||||
|
| Cell 3,1 | Cell 3,2 | Cell 3,3 |
|
||||||
|
|
||||||
|
Table without leading/trailing pipes:
|
||||||
|
|
||||||
|
Heading 1 | Heading 2 | Heading 3
|
||||||
|
--------- | --------- | ---------
|
||||||
|
Cell 1,1 | Cell 1,2 | Cell 1,3
|
||||||
|
Cell 2,1 | Cell 2,2 | Cell 2,3
|
||||||
|
Cell 3,1 | Cell 3,2 | Cell 3,3
|
||||||
|
|
||||||
|
Table with alignment:
|
||||||
|
|
||||||
|
Left Alignment | Center Alignment | Right Alignment
|
||||||
|
:-------- | :-------: | --------:
|
||||||
|
Cell 1,1 | Cell 1,2 | 1
|
||||||
|
Cell 2,1 | Cell 2,2 | 12
|
||||||
|
Cell 3,1 | Cell 3,2 | 123
|
||||||
|
|
||||||
|
Table in block quote:
|
||||||
|
|
||||||
|
> Heading 1 | Heading 2 | Heading 3
|
||||||
|
> --------- | --------- | ---------
|
||||||
|
> Cell 1,1 | Cell 1,2 | Cell 1,3
|
||||||
|
> Cell 2,1 | Cell 2,2 | Cell 2,3
|
||||||
|
> Cell 3,1 | Cell 3,2 | Cell 3,3
|
||||||
|
@ -166,7 +166,7 @@ mmdCopyAllText(mmd_t *node) // I - Parent node
|
|||||||
char *all = NULL, // String buffer
|
char *all = NULL, // String buffer
|
||||||
*allptr = NULL, // Pointer into string buffer
|
*allptr = NULL, // Pointer into string buffer
|
||||||
*temp; // Temporary pointer
|
*temp; // Temporary pointer
|
||||||
size_t allsize = 0, // Size of "all" buffer
|
size_t allsize = 1, // Size of "all" buffer
|
||||||
textlen; // Length of "text" string
|
textlen; // Length of "text" string
|
||||||
mmd_t *current, // Current node
|
mmd_t *current, // Current node
|
||||||
*next; // Next node
|
*next; // Next node
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
//
|
//
|
||||||
// PDF to text program for PDFio.
|
// PDF to text program for PDFio.
|
||||||
//
|
//
|
||||||
// Copyright © 2022 by Michael R Sweet.
|
// Copyright © 2022-2024 by Michael R Sweet.
|
||||||
//
|
//
|
||||||
// Licensed under Apache License v2.0. See the file "LICENSE" for more
|
// Licensed under Apache License v2.0. See the file "LICENSE" for more
|
||||||
// information.
|
// information.
|
||||||
//
|
//
|
||||||
// Usage:
|
// Usage:
|
||||||
//
|
//
|
||||||
// ./pdfiototext FILENAME.pdf > FILENAME.txt
|
// ./pdf2text FILENAME.pdf > FILENAME.txt
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "pdfio.h"
|
#include <pdfio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
@ -36,16 +36,14 @@ main(int argc, // I - Number of command-line arguments
|
|||||||
// Verify command-line arguments...
|
// Verify command-line arguments...
|
||||||
if (argc != 2)
|
if (argc != 2)
|
||||||
{
|
{
|
||||||
puts("Usage: pdfiototext FILENAME.pdf > FILENAME.txt");
|
puts("Usage: pdf2text FILENAME.pdf > FILENAME.txt");
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Open the PDF file...
|
// Open the PDF file...
|
||||||
if ((file = pdfioFileOpen(argv[1], NULL, NULL, NULL, NULL)) == NULL)
|
if ((file = pdfioFileOpen(argv[1], /*password_cb*/NULL, /*password_data*/NULL, /*error_cb*/NULL, /*error_data*/NULL)) == NULL)
|
||||||
return (1);
|
return (1);
|
||||||
|
|
||||||
// printf("%s: %u pages\n", argv[1], (unsigned)pdfioFileGetNumPages(file));
|
|
||||||
|
|
||||||
// Try grabbing content from all of the pages...
|
// Try grabbing content from all of the pages...
|
||||||
for (i = 0, num_pages = pdfioFileGetNumPages(file); i < num_pages; i ++)
|
for (i = 0, num_pages = pdfioFileGetNumPages(file); i < num_pages; i ++)
|
||||||
{
|
{
|
||||||
@ -54,29 +52,28 @@ main(int argc, // I - Number of command-line arguments
|
|||||||
|
|
||||||
num_streams = pdfioPageGetNumStreams(obj);
|
num_streams = pdfioPageGetNumStreams(obj);
|
||||||
|
|
||||||
// printf("%s: page%u=%p, num_streams=%u\n", argv[1], (unsigned)i, obj, (unsigned)num_streams);
|
|
||||||
|
|
||||||
for (j = 0; j < num_streams; j ++)
|
for (j = 0; j < num_streams; j ++)
|
||||||
{
|
{
|
||||||
if ((st = pdfioPageOpenStream(obj, j, true)) == NULL)
|
if ((st = pdfioPageOpenStream(obj, j, true)) == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// printf("%s: page%u st%u=%p\n", argv[1], (unsigned)i, (unsigned)j, st);
|
// Read PDF tokens from the page stream...
|
||||||
|
|
||||||
first = true;
|
first = true;
|
||||||
while (pdfioStreamGetToken(st, buffer, sizeof(buffer)))
|
while (pdfioStreamGetToken(st, buffer, sizeof(buffer)))
|
||||||
{
|
{
|
||||||
if (buffer[0] == '(')
|
if (buffer[0] == '(')
|
||||||
{
|
{
|
||||||
|
// Text string using an 8-bit encoding
|
||||||
if (first)
|
if (first)
|
||||||
first = false;
|
first = false;
|
||||||
else
|
else if (buffer[1] != ' ')
|
||||||
putchar(' ');
|
putchar(' ');
|
||||||
|
|
||||||
fputs(buffer + 1, stdout);
|
fputs(buffer + 1, stdout);
|
||||||
}
|
}
|
||||||
else if (!strcmp(buffer, "Td") || !strcmp(buffer, "TD") || !strcmp(buffer, "T*") || !strcmp(buffer, "\'") || !strcmp(buffer, "\""))
|
else if (!strcmp(buffer, "Td") || !strcmp(buffer, "TD") || !strcmp(buffer, "T*") || !strcmp(buffer, "\'") || !strcmp(buffer, "\""))
|
||||||
{
|
{
|
||||||
|
// Text operators that advance to the next line in the block
|
||||||
putchar('\n');
|
putchar('\n');
|
||||||
first = true;
|
first = true;
|
||||||
}
|
}
|
65
examples/pdfioinfo.c
Normal file
65
examples/pdfioinfo.c
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
//
|
||||||
|
// PDF metadata example for PDFio.
|
||||||
|
//
|
||||||
|
// Copyright © 2023-2024 by Michael R Sweet.
|
||||||
|
//
|
||||||
|
// Licensed under Apache License v2.0. See the file "LICENSE" for more
|
||||||
|
// information.
|
||||||
|
//
|
||||||
|
// Usage:
|
||||||
|
//
|
||||||
|
// ./pdfioinfo FILENAME.pdf
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <pdfio.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// 'main()' - Open a PDF file and show its metadata.
|
||||||
|
//
|
||||||
|
|
||||||
|
int // O - Exit status
|
||||||
|
main(int argc, // I - Number of command-line arguments
|
||||||
|
char *argv[]) // Command-line arguments
|
||||||
|
{
|
||||||
|
const char *filename; // PDF filename
|
||||||
|
pdfio_file_t *pdf; // PDF file
|
||||||
|
time_t creation_date; // Creation date
|
||||||
|
struct tm *creation_tm; // Creation date/time information
|
||||||
|
char creation_text[256]; // Creation date/time as a string
|
||||||
|
|
||||||
|
|
||||||
|
// Get the filename from the command-line...
|
||||||
|
if (argc != 2)
|
||||||
|
{
|
||||||
|
fputs("Usage: ./pdfioinfo FILENAME.pdf\n", stderr);
|
||||||
|
return (1);
|
||||||
|
}
|
||||||
|
|
||||||
|
filename = argv[1];
|
||||||
|
|
||||||
|
// Open the PDF file with the default callbacks...
|
||||||
|
pdf = pdfioFileOpen(filename, /*password_cb*/NULL,
|
||||||
|
/*password_cbdata*/NULL, /*error_cb*/NULL,
|
||||||
|
/*error_cbdata*/NULL);
|
||||||
|
if (pdf == NULL)
|
||||||
|
return (1);
|
||||||
|
|
||||||
|
// Get the creation date and convert to a string...
|
||||||
|
creation_date = pdfioFileGetCreationDate(pdf);
|
||||||
|
creation_tm = localtime(&creation_date);
|
||||||
|
strftime(creation_text, sizeof(creation_text), "%c", creation_tm);
|
||||||
|
|
||||||
|
// Print file information to stdout...
|
||||||
|
printf("%s:\n", filename);
|
||||||
|
printf(" Title: %s\n", pdfioFileGetTitle(pdf));
|
||||||
|
printf(" Author: %s\n", pdfioFileGetAuthor(pdf));
|
||||||
|
printf(" Created On: %s\n", creation_text);
|
||||||
|
printf(" Number Pages: %u\n", (unsigned)pdfioFileGetNumPages(pdf));
|
||||||
|
|
||||||
|
// Close the PDF file...
|
||||||
|
pdfioFileClose(pdf);
|
||||||
|
|
||||||
|
return (0);
|
||||||
|
}
|
@ -1132,7 +1132,7 @@ pdfioContentTextMeasure(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (i < (sizeof(_pdfio_cp1252) / sizeof(_pdfio_cp1252[0])))
|
if (i < (sizeof(_pdfio_cp1252) / sizeof(_pdfio_cp1252[0])))
|
||||||
ch = i + 0x80; // Extra characters from 0x80 to 0x9f
|
ch = (int)(i + 0x80); // Extra characters from 0x80 to 0x9f
|
||||||
else
|
else
|
||||||
ch = '?'; // Unsupported chars map to ?
|
ch = '?'; // Unsupported chars map to ?
|
||||||
}
|
}
|
||||||
|
@ -755,6 +755,8 @@ get_date_time(const char *s) // I - PDF date/time value
|
|||||||
int offset; // Date offset
|
int offset; // Date offset
|
||||||
|
|
||||||
|
|
||||||
|
PDFIO_DEBUG("get_date_time(s=\"%s\")\n", s);
|
||||||
|
|
||||||
// Possible date value of the form:
|
// Possible date value of the form:
|
||||||
//
|
//
|
||||||
// (D:YYYYMMDDhhmmssZ)
|
// (D:YYYYMMDDhhmmssZ)
|
||||||
@ -772,10 +774,12 @@ get_date_time(const char *s) // I - PDF date/time value
|
|||||||
{
|
{
|
||||||
if (s[i] == 'Z')
|
if (s[i] == 'Z')
|
||||||
{
|
{
|
||||||
|
// UTC...
|
||||||
i ++;
|
i ++;
|
||||||
}
|
}
|
||||||
else if (s[i] == '-' || s[i] == '+')
|
else if (s[i] == '-' || s[i] == '+')
|
||||||
{
|
{
|
||||||
|
// Timezone offset from UTC...
|
||||||
if (isdigit(s[i + 1] & 255) && isdigit(s[i + 2] & 255) && s[i + 3] == '\'' && isdigit(s[i + 4] & 255) && isdigit(s[i + 5] & 255))
|
if (isdigit(s[i + 1] & 255) && isdigit(s[i + 2] & 255) && s[i + 3] == '\'' && isdigit(s[i + 4] & 255) && isdigit(s[i + 5] & 255))
|
||||||
{
|
{
|
||||||
i += 6;
|
i += 6;
|
||||||
@ -783,6 +787,11 @@ get_date_time(const char *s) // I - PDF date/time value
|
|||||||
i ++;
|
i ++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (!s[i])
|
||||||
|
{
|
||||||
|
// Missing zone info, invalid date string...
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s[i])
|
if (s[i])
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
archiveVersion = 1;
|
archiveVersion = 1;
|
||||||
classes = {
|
classes = {
|
||||||
};
|
};
|
||||||
objectVersion = 50;
|
objectVersion = 54;
|
||||||
objects = {
|
objects = {
|
||||||
|
|
||||||
/* Begin PBXBuildFile section */
|
/* Begin PBXBuildFile section */
|
||||||
@ -31,6 +31,7 @@
|
|||||||
27F2F0612710BE92008ECD36 /* pdfio-rc4.c in Sources */ = {isa = PBXBuildFile; fileRef = 27F2F05E2710BE92008ECD36 /* pdfio-rc4.c */; };
|
27F2F0612710BE92008ECD36 /* pdfio-rc4.c in Sources */ = {isa = PBXBuildFile; fileRef = 27F2F05E2710BE92008ECD36 /* pdfio-rc4.c */; };
|
||||||
27F2F0622710BE92008ECD36 /* pdfio-crypto.c in Sources */ = {isa = PBXBuildFile; fileRef = 27F2F05F2710BE92008ECD36 /* pdfio-crypto.c */; };
|
27F2F0622710BE92008ECD36 /* pdfio-crypto.c in Sources */ = {isa = PBXBuildFile; fileRef = 27F2F05F2710BE92008ECD36 /* pdfio-crypto.c */; };
|
||||||
27F2F0642711243D008ECD36 /* pdfio-sha256.c in Sources */ = {isa = PBXBuildFile; fileRef = 27F2F0632711243D008ECD36 /* pdfio-sha256.c */; };
|
27F2F0642711243D008ECD36 /* pdfio-sha256.c in Sources */ = {isa = PBXBuildFile; fileRef = 27F2F0632711243D008ECD36 /* pdfio-sha256.c */; };
|
||||||
|
27FCBDE42D19F9B300485EEE /* pdfio-base-font-widths.h in Headers */ = {isa = PBXBuildFile; fileRef = 27FCBDE32D19F9B300485EEE /* pdfio-base-font-widths.h */; };
|
||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
/* Begin PBXContainerItemProxy section */
|
/* Begin PBXContainerItemProxy section */
|
||||||
@ -89,6 +90,7 @@
|
|||||||
27F2F05E2710BE92008ECD36 /* pdfio-rc4.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "pdfio-rc4.c"; sourceTree = "<group>"; };
|
27F2F05E2710BE92008ECD36 /* pdfio-rc4.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "pdfio-rc4.c"; sourceTree = "<group>"; };
|
||||||
27F2F05F2710BE92008ECD36 /* pdfio-crypto.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "pdfio-crypto.c"; sourceTree = "<group>"; };
|
27F2F05F2710BE92008ECD36 /* pdfio-crypto.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "pdfio-crypto.c"; sourceTree = "<group>"; };
|
||||||
27F2F0632711243D008ECD36 /* pdfio-sha256.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "pdfio-sha256.c"; sourceTree = "<group>"; };
|
27F2F0632711243D008ECD36 /* pdfio-sha256.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "pdfio-sha256.c"; sourceTree = "<group>"; };
|
||||||
|
27FCBDE32D19F9B300485EEE /* pdfio-base-font-widths.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "pdfio-base-font-widths.h"; sourceTree = "<group>"; };
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
/* Begin PBXFrameworksBuildPhase section */
|
/* Begin PBXFrameworksBuildPhase section */
|
||||||
@ -162,6 +164,7 @@
|
|||||||
children = (
|
children = (
|
||||||
27CF90432711DFFE00E50FE4 /* pdfio-aes.c */,
|
27CF90432711DFFE00E50FE4 /* pdfio-aes.c */,
|
||||||
273440BA263D727800FBFD63 /* pdfio-array.c */,
|
273440BA263D727800FBFD63 /* pdfio-array.c */,
|
||||||
|
27FCBDE32D19F9B300485EEE /* pdfio-base-font-widths.h */,
|
||||||
273440BB263D727800FBFD63 /* pdfio-common.c */,
|
273440BB263D727800FBFD63 /* pdfio-common.c */,
|
||||||
271EA703265B2B1000ACDD39 /* pdfio-content.c */,
|
271EA703265B2B1000ACDD39 /* pdfio-content.c */,
|
||||||
27F2F05F2710BE92008ECD36 /* pdfio-crypto.c */,
|
27F2F05F2710BE92008ECD36 /* pdfio-crypto.c */,
|
||||||
@ -205,6 +208,7 @@
|
|||||||
isa = PBXHeadersBuildPhase;
|
isa = PBXHeadersBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
|
27FCBDE42D19F9B300485EEE /* pdfio-base-font-widths.h in Headers */,
|
||||||
273440CC263D727800FBFD63 /* pdfio.h in Headers */,
|
273440CC263D727800FBFD63 /* pdfio.h in Headers */,
|
||||||
271EA706265B2B1000ACDD39 /* pdfio-content.h in Headers */,
|
271EA706265B2B1000ACDD39 /* pdfio-content.h in Headers */,
|
||||||
273440C3263D727800FBFD63 /* pdfio-private.h in Headers */,
|
273440C3263D727800FBFD63 /* pdfio-private.h in Headers */,
|
||||||
@ -256,7 +260,8 @@
|
|||||||
273440A8263D6FE200FBFD63 /* Project object */ = {
|
273440A8263D6FE200FBFD63 /* Project object */ = {
|
||||||
isa = PBXProject;
|
isa = PBXProject;
|
||||||
attributes = {
|
attributes = {
|
||||||
LastUpgradeCheck = 1300;
|
BuildIndependentTargetsInParallel = YES;
|
||||||
|
LastUpgradeCheck = 1600;
|
||||||
TargetAttributes = {
|
TargetAttributes = {
|
||||||
273440AF263D6FE200FBFD63 = {
|
273440AF263D6FE200FBFD63 = {
|
||||||
CreatedOnToolsVersion = 12.5;
|
CreatedOnToolsVersion = 12.5;
|
||||||
@ -373,9 +378,11 @@
|
|||||||
CODE_SIGN_IDENTITY = "Apple Development";
|
CODE_SIGN_IDENTITY = "Apple Development";
|
||||||
COPY_PHASE_STRIP = NO;
|
COPY_PHASE_STRIP = NO;
|
||||||
CURRENT_PROJECT_VERSION = 1.1.2;
|
CURRENT_PROJECT_VERSION = 1.1.2;
|
||||||
|
DEAD_CODE_STRIPPING = YES;
|
||||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||||
ENABLE_TESTABILITY = YES;
|
ENABLE_TESTABILITY = YES;
|
||||||
|
ENABLE_USER_SCRIPT_SANDBOXING = YES;
|
||||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||||
GCC_NO_COMMON_BLOCKS = YES;
|
GCC_NO_COMMON_BLOCKS = YES;
|
||||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||||
@ -450,15 +457,15 @@
|
|||||||
CODE_SIGN_IDENTITY = "Apple Development";
|
CODE_SIGN_IDENTITY = "Apple Development";
|
||||||
COPY_PHASE_STRIP = NO;
|
COPY_PHASE_STRIP = NO;
|
||||||
CURRENT_PROJECT_VERSION = 1.1.2;
|
CURRENT_PROJECT_VERSION = 1.1.2;
|
||||||
|
DEAD_CODE_STRIPPING = YES;
|
||||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||||
ENABLE_HARDENED_RUNTIME = YES;
|
ENABLE_HARDENED_RUNTIME = YES;
|
||||||
ENABLE_NS_ASSERTIONS = NO;
|
ENABLE_NS_ASSERTIONS = NO;
|
||||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||||
|
ENABLE_USER_SCRIPT_SANDBOXING = YES;
|
||||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||||
GCC_NO_COMMON_BLOCKS = YES;
|
GCC_NO_COMMON_BLOCKS = YES;
|
||||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
GCC_PREPROCESSOR_DEFINITIONS = "$(inherited)";
|
||||||
"$(inherited)",
|
|
||||||
);
|
|
||||||
GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES;
|
GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES;
|
||||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||||
GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES;
|
GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES;
|
||||||
@ -486,6 +493,7 @@
|
|||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
|
DEAD_CODE_STRIPPING = YES;
|
||||||
DEVELOPMENT_TEAM = RU58A2256H;
|
DEVELOPMENT_TEAM = RU58A2256H;
|
||||||
EXECUTABLE_PREFIX = lib;
|
EXECUTABLE_PREFIX = lib;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
@ -497,6 +505,7 @@
|
|||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
|
DEAD_CODE_STRIPPING = YES;
|
||||||
DEVELOPMENT_TEAM = RU58A2256H;
|
DEVELOPMENT_TEAM = RU58A2256H;
|
||||||
EXECUTABLE_PREFIX = lib;
|
EXECUTABLE_PREFIX = lib;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
@ -509,6 +518,7 @@
|
|||||||
buildSettings = {
|
buildSettings = {
|
||||||
CODE_SIGN_IDENTITY = "-";
|
CODE_SIGN_IDENTITY = "-";
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
|
DEAD_CODE_STRIPPING = YES;
|
||||||
DEVELOPMENT_TEAM = "";
|
DEVELOPMENT_TEAM = "";
|
||||||
ENABLE_HARDENED_RUNTIME = YES;
|
ENABLE_HARDENED_RUNTIME = YES;
|
||||||
GCC_DYNAMIC_NO_PIC = NO;
|
GCC_DYNAMIC_NO_PIC = NO;
|
||||||
@ -525,6 +535,7 @@
|
|||||||
buildSettings = {
|
buildSettings = {
|
||||||
CODE_SIGN_IDENTITY = "-";
|
CODE_SIGN_IDENTITY = "-";
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
|
DEAD_CODE_STRIPPING = YES;
|
||||||
DEVELOPMENT_TEAM = "";
|
DEVELOPMENT_TEAM = "";
|
||||||
ENABLE_HARDENED_RUNTIME = YES;
|
ENABLE_HARDENED_RUNTIME = YES;
|
||||||
MACOSX_DEPLOYMENT_TARGET = 11.0;
|
MACOSX_DEPLOYMENT_TARGET = 11.0;
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<metadata>
|
<metadata>
|
||||||
<id>pdfio_native</id>
|
<id>pdfio_native</id>
|
||||||
<title>PDFio Library for VS2019+</title>
|
<title>PDFio Library for VS2019+</title>
|
||||||
<version>1.3.2</version>
|
<version>1.4.0</version>
|
||||||
<authors>Michael R Sweet</authors>
|
<authors>Michael R Sweet</authors>
|
||||||
<owners>michaelrsweet</owners>
|
<owners>michaelrsweet</owners>
|
||||||
<projectUrl>https://github.com/michaelrsweet/pappl</projectUrl>
|
<projectUrl>https://github.com/michaelrsweet/pappl</projectUrl>
|
||||||
@ -16,7 +16,7 @@
|
|||||||
<copyright>Copyright © 2019-2024 by Michael R Sweet</copyright>
|
<copyright>Copyright © 2019-2024 by Michael R Sweet</copyright>
|
||||||
<tags>pdf file native</tags>
|
<tags>pdf file native</tags>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency id="pdfio_native.redist" version="1.3.2" />
|
<dependency id="pdfio_native.redist" version="1.4.0" />
|
||||||
<dependency id="zlib_native.redist" version="1.2.11" />
|
<dependency id="zlib_native.redist" version="1.2.11" />
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</metadata>
|
</metadata>
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<metadata>
|
<metadata>
|
||||||
<id>pdfio_native.redist</id>
|
<id>pdfio_native.redist</id>
|
||||||
<title>PDFio Library for VS2019+</title>
|
<title>PDFio Library for VS2019+</title>
|
||||||
<version>1.3.2</version>
|
<version>1.4.0</version>
|
||||||
<authors>Michael R Sweet</authors>
|
<authors>Michael R Sweet</authors>
|
||||||
<owners>michaelrsweet</owners>
|
<owners>michaelrsweet</owners>
|
||||||
<projectUrl>https://github.com/michaelrsweet/pappl</projectUrl>
|
<projectUrl>https://github.com/michaelrsweet/pappl</projectUrl>
|
||||||
|
Reference in New Issue
Block a user