Merge branch 'michaelrsweet:master' into info
2
.github/workflows/build.yml
vendored
@ -17,7 +17,7 @@ jobs:
|
|||||||
- name: Update Build Environment
|
- name: Update Build Environment
|
||||||
run: sudo apt-get update --fix-missing -y
|
run: sudo apt-get update --fix-missing -y
|
||||||
- name: Install Prerequisites
|
- name: Install Prerequisites
|
||||||
run: sudo apt-get install -y cppcheck zlib1g-dev
|
run: sudo apt-get install -y cppcheck zlib1g-dev libpng-dev
|
||||||
- name: Configure PDFio
|
- name: Configure PDFio
|
||||||
run: ./configure --enable-debug --enable-sanitizer --enable-maintainer
|
run: ./configure --enable-debug --enable-sanitizer --enable-maintainer
|
||||||
- name: Build PDFio
|
- name: Build PDFio
|
||||||
|
2
.github/workflows/codeql.yml
vendored
@ -32,7 +32,7 @@ jobs:
|
|||||||
run: sudo apt-get update --fix-missing -y
|
run: sudo apt-get update --fix-missing -y
|
||||||
|
|
||||||
- name: Install Prerequisites
|
- name: Install Prerequisites
|
||||||
run: sudo apt-get install -y zlib1g-dev
|
run: sudo apt-get install -y zlib1g-dev libpng-dev
|
||||||
|
|
||||||
- name: Initialize CodeQL
|
- name: Initialize CodeQL
|
||||||
uses: github/codeql-action/init@v2
|
uses: github/codeql-action/init@v2
|
||||||
|
2
.github/workflows/coverity.yml
vendored
@ -12,7 +12,7 @@ jobs:
|
|||||||
- name: Update Build Environment
|
- name: Update Build Environment
|
||||||
run: sudo apt-get update --fix-missing -y
|
run: sudo apt-get update --fix-missing -y
|
||||||
- name: Install Prerequisites
|
- name: Install Prerequisites
|
||||||
run: sudo apt-get install -y zlib1g-dev
|
run: sudo apt-get install -y zlib1g-dev libpng-dev
|
||||||
- name: Download Coverity Build Tool
|
- name: Download Coverity Build Tool
|
||||||
run: |
|
run: |
|
||||||
wget -q https://scan.coverity.com/download/linux64 --post-data token="$TOKEN&project=$GITHUB_REPOSITORY" -O cov-analysis-linux64.tar.gz
|
wget -q https://scan.coverity.com/download/linux64 --post-data token="$TOKEN&project=$GITHUB_REPOSITORY" -O cov-analysis-linux64.tar.gz
|
||||||
|
14
CHANGES.md
@ -1,13 +1,23 @@
|
|||||||
Changes in PDFio
|
Changes in PDFio
|
||||||
================
|
================
|
||||||
|
|
||||||
|
v1.5.0 - YYYY-MM-DD
|
||||||
v1.4.1 - YYYY-MM-DD
|
|
||||||
-------------------
|
-------------------
|
||||||
|
|
||||||
|
- Added support for using libpng to embed PNG images in PDF output (Issue #90)
|
||||||
|
- Updated the pdf2txt example to support font encodings.
|
||||||
|
|
||||||
|
|
||||||
|
v1.4.1 - 2025-01-24
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
- Added license files for the example fonts now bundled with PDFio (Issue #91)
|
||||||
- Fixed the link libraries for the example source code (Issue #86)
|
- Fixed the link libraries for the example source code (Issue #86)
|
||||||
- Fixed handling of the Info object (Issue #87)
|
- Fixed handling of the Info object (Issue #87)
|
||||||
- Fixed opening of PDF files less than 1024 bytes in length (Issue #87)
|
- Fixed opening of PDF files less than 1024 bytes in length (Issue #87)
|
||||||
|
- Fixed potential `NULL` dereference when reading (Issue #89)
|
||||||
|
- Fixed reading of compressed object streams (Issue #92)
|
||||||
|
- Fixed reading of UTF-16 string values (Issue #92)
|
||||||
|
|
||||||
|
|
||||||
v1.4.0 - 2024-12-26
|
v1.4.0 - 2024-12-26
|
||||||
|
@ -117,12 +117,14 @@ DOCFILES = \
|
|||||||
NOTICE
|
NOTICE
|
||||||
EXAMPLES = \
|
EXAMPLES = \
|
||||||
examples/Makefile \
|
examples/Makefile \
|
||||||
|
examples/Roboto-LICENSE.txt \
|
||||||
examples/Roboto-Bold.ttf \
|
examples/Roboto-Bold.ttf \
|
||||||
examples/Roboto-Italic.ttf \
|
examples/Roboto-Italic.ttf \
|
||||||
examples/Roboto-Regular.ttf \
|
examples/Roboto-Regular.ttf \
|
||||||
examples/RobotoMono-Regular.ttf \
|
examples/RobotoMono-Regular.ttf \
|
||||||
examples/code128.c \
|
examples/code128.c \
|
||||||
examples/code128.ttf \
|
examples/code128.ttf \
|
||||||
|
examples/code128-LICENSE.txt \
|
||||||
examples/image2pdf.c \
|
examples/image2pdf.c \
|
||||||
examples/md2pdf.c \
|
examples/md2pdf.c \
|
||||||
examples/md2pdf.md \
|
examples/md2pdf.md \
|
||||||
|
77
configure
vendored
@ -1,6 +1,6 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# Guess values for system-dependent variables and create Makefiles.
|
# Guess values for system-dependent variables and create Makefiles.
|
||||||
# Generated by GNU Autoconf 2.71 for pdfio 1.4.1.
|
# Generated by GNU Autoconf 2.71 for pdfio 1.5.0.
|
||||||
#
|
#
|
||||||
# Report bugs to <https://github.com/michaelrsweet/pdfio/issues>.
|
# Report bugs to <https://github.com/michaelrsweet/pdfio/issues>.
|
||||||
#
|
#
|
||||||
@ -610,8 +610,8 @@ MAKEFLAGS=
|
|||||||
# Identity of this package.
|
# Identity of this package.
|
||||||
PACKAGE_NAME='pdfio'
|
PACKAGE_NAME='pdfio'
|
||||||
PACKAGE_TARNAME='pdfio'
|
PACKAGE_TARNAME='pdfio'
|
||||||
PACKAGE_VERSION='1.4.1'
|
PACKAGE_VERSION='1.5.0'
|
||||||
PACKAGE_STRING='pdfio 1.4.1'
|
PACKAGE_STRING='pdfio 1.5.0'
|
||||||
PACKAGE_BUGREPORT='https://github.com/michaelrsweet/pdfio/issues'
|
PACKAGE_BUGREPORT='https://github.com/michaelrsweet/pdfio/issues'
|
||||||
PACKAGE_URL='https://www.msweet.org/pdfio'
|
PACKAGE_URL='https://www.msweet.org/pdfio'
|
||||||
|
|
||||||
@ -653,6 +653,7 @@ WARNINGS
|
|||||||
CSFLAGS
|
CSFLAGS
|
||||||
LIBPDFIO_STATIC
|
LIBPDFIO_STATIC
|
||||||
LIBPDFIO
|
LIBPDFIO
|
||||||
|
PKGCONFIG_LIBPNG
|
||||||
PKGCONFIG_REQUIRES
|
PKGCONFIG_REQUIRES
|
||||||
PKGCONFIG_LIBS_PRIVATE
|
PKGCONFIG_LIBS_PRIVATE
|
||||||
PKGCONFIG_LIBS
|
PKGCONFIG_LIBS
|
||||||
@ -729,6 +730,7 @@ SHELL'
|
|||||||
ac_subst_files=''
|
ac_subst_files=''
|
||||||
ac_user_opts='
|
ac_user_opts='
|
||||||
enable_option_checking
|
enable_option_checking
|
||||||
|
enable_libpng
|
||||||
enable_static
|
enable_static
|
||||||
enable_shared
|
enable_shared
|
||||||
enable_debug
|
enable_debug
|
||||||
@ -1293,7 +1295,7 @@ if test "$ac_init_help" = "long"; then
|
|||||||
# Omit some internal or obsolete options to make the list less imposing.
|
# Omit some internal or obsolete options to make the list less imposing.
|
||||||
# This message is too long to be a string in the A/UX 3.1 sh.
|
# This message is too long to be a string in the A/UX 3.1 sh.
|
||||||
cat <<_ACEOF
|
cat <<_ACEOF
|
||||||
\`configure' configures pdfio 1.4.1 to adapt to many kinds of systems.
|
\`configure' configures pdfio 1.5.0 to adapt to many kinds of systems.
|
||||||
|
|
||||||
Usage: $0 [OPTION]... [VAR=VALUE]...
|
Usage: $0 [OPTION]... [VAR=VALUE]...
|
||||||
|
|
||||||
@ -1359,7 +1361,7 @@ fi
|
|||||||
|
|
||||||
if test -n "$ac_init_help"; then
|
if test -n "$ac_init_help"; then
|
||||||
case $ac_init_help in
|
case $ac_init_help in
|
||||||
short | recursive ) echo "Configuration of pdfio 1.4.1:";;
|
short | recursive ) echo "Configuration of pdfio 1.5.0:";;
|
||||||
esac
|
esac
|
||||||
cat <<\_ACEOF
|
cat <<\_ACEOF
|
||||||
|
|
||||||
@ -1367,6 +1369,8 @@ Optional Features:
|
|||||||
--disable-option-checking ignore unrecognized --enable/--with options
|
--disable-option-checking ignore unrecognized --enable/--with options
|
||||||
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
|
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
|
||||||
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
|
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
|
||||||
|
--enable-libpng use libpng for pdfioFileCreateImageObjFromFile,
|
||||||
|
default=auto
|
||||||
--disable-static do not install static library
|
--disable-static do not install static library
|
||||||
--enable-shared install shared library
|
--enable-shared install shared library
|
||||||
--enable-debug turn on debugging, default=no
|
--enable-debug turn on debugging, default=no
|
||||||
@ -1456,7 +1460,7 @@ fi
|
|||||||
test -n "$ac_init_help" && exit $ac_status
|
test -n "$ac_init_help" && exit $ac_status
|
||||||
if $ac_init_version; then
|
if $ac_init_version; then
|
||||||
cat <<\_ACEOF
|
cat <<\_ACEOF
|
||||||
pdfio configure 1.4.1
|
pdfio configure 1.5.0
|
||||||
generated by GNU Autoconf 2.71
|
generated by GNU Autoconf 2.71
|
||||||
|
|
||||||
Copyright (C) 2021 Free Software Foundation, Inc.
|
Copyright (C) 2021 Free Software Foundation, Inc.
|
||||||
@ -1612,7 +1616,7 @@ cat >config.log <<_ACEOF
|
|||||||
This file contains any messages produced by compilers while
|
This file contains any messages produced by compilers while
|
||||||
running configure, to aid debugging if configure makes a mistake.
|
running configure, to aid debugging if configure makes a mistake.
|
||||||
|
|
||||||
It was created by pdfio $as_me 1.4.1, which was
|
It was created by pdfio $as_me 1.5.0, which was
|
||||||
generated by GNU Autoconf 2.71. Invocation command line was
|
generated by GNU Autoconf 2.71. Invocation command line was
|
||||||
|
|
||||||
$ $0$ac_configure_args_raw
|
$ $0$ac_configure_args_raw
|
||||||
@ -2368,9 +2372,9 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
PDFIO_VERSION="1.4.1"
|
PDFIO_VERSION="1.5.0"
|
||||||
PDFIO_VERSION_MAJOR="`echo 1.4.1 | awk -F. '{print $1}'`"
|
PDFIO_VERSION_MAJOR="`echo 1.5.0 | awk -F. '{print $1}'`"
|
||||||
PDFIO_VERSION_MINOR="`echo 1.4.1 | awk -F. '{printf("%d\n",$2);}'`"
|
PDFIO_VERSION_MINOR="`echo 1.5.0 | awk -F. '{printf("%d\n",$2);}'`"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -4099,6 +4103,55 @@ fi
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Check whether --enable-libpng was given.
|
||||||
|
if test ${enable_libpng+y}
|
||||||
|
then :
|
||||||
|
enableval=$enable_libpng;
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
PKGCONFIG_LIBPNG=""
|
||||||
|
|
||||||
|
|
||||||
|
if test "x$PKGCONFIG" != x -a x$enable_libpng != xno
|
||||||
|
then :
|
||||||
|
|
||||||
|
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libpng-1.6.x" >&5
|
||||||
|
printf %s "checking for libpng-1.6.x... " >&6; }
|
||||||
|
if $PKGCONFIG --exists libpng16
|
||||||
|
then :
|
||||||
|
|
||||||
|
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||||
|
printf "%s\n" "yes" >&6; };
|
||||||
|
|
||||||
|
printf "%s\n" "#define HAVE_LIBPNG 1" >>confdefs.h
|
||||||
|
|
||||||
|
CPPFLAGS="$($PKGCONFIG --cflags libpng16) -DHAVE_LIBPNG=1 $CPPFLAGS"
|
||||||
|
LIBS="$($PKGCONFIG --libs libpng16) -lz $LIBS"
|
||||||
|
PKGCONFIG_LIBPNG="libpng >= 1.6,"
|
||||||
|
PKGCONFIG_LIBS_PRIVATE="$($PKGCONFIG --libs libpng16) $PKGCONFIG_LIBS_PRIVATE"
|
||||||
|
|
||||||
|
else $as_nop
|
||||||
|
|
||||||
|
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||||
|
printf "%s\n" "no" >&6; };
|
||||||
|
if test x$enable_libpng = xyes
|
||||||
|
then :
|
||||||
|
|
||||||
|
as_fn_error $? "libpng-dev 1.6 or later required for --enable-libpng." "$LINENO" 5
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
elif test x$enable_libpng = xyes
|
||||||
|
then :
|
||||||
|
|
||||||
|
as_fn_error $? "libpng-dev 1.6 or later required for --enable-libpng." "$LINENO" 5
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Check whether --enable-static was given.
|
# Check whether --enable-static was given.
|
||||||
if test ${enable_static+y}
|
if test ${enable_static+y}
|
||||||
then :
|
then :
|
||||||
@ -4935,7 +4988,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
|
|||||||
# report actual input values of CONFIG_FILES etc. instead of their
|
# report actual input values of CONFIG_FILES etc. instead of their
|
||||||
# values after options handling.
|
# values after options handling.
|
||||||
ac_log="
|
ac_log="
|
||||||
This file was extended by pdfio $as_me 1.4.1, which was
|
This file was extended by pdfio $as_me 1.5.0, which was
|
||||||
generated by GNU Autoconf 2.71. Invocation command line was
|
generated by GNU Autoconf 2.71. Invocation command line was
|
||||||
|
|
||||||
CONFIG_FILES = $CONFIG_FILES
|
CONFIG_FILES = $CONFIG_FILES
|
||||||
@ -4991,7 +5044,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
|
|||||||
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
|
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
|
||||||
ac_cs_config='$ac_cs_config_escaped'
|
ac_cs_config='$ac_cs_config_escaped'
|
||||||
ac_cs_version="\\
|
ac_cs_version="\\
|
||||||
pdfio config.status 1.4.1
|
pdfio config.status 1.5.0
|
||||||
configured by $0, generated by GNU Autoconf 2.71,
|
configured by $0, generated by GNU Autoconf 2.71,
|
||||||
with options \\"\$ac_cs_config\\"
|
with options \\"\$ac_cs_config\\"
|
||||||
|
|
||||||
|
30
configure.ac
@ -1,7 +1,7 @@
|
|||||||
dnl
|
dnl
|
||||||
dnl Configuration script for PDFio
|
dnl Configuration script for PDFio
|
||||||
dnl
|
dnl
|
||||||
dnl Copyright © 2023-2024 by Michael R Sweet
|
dnl Copyright © 2023-2025 by Michael R Sweet
|
||||||
dnl
|
dnl
|
||||||
dnl Licensed under Apache License v2.0. See the file "LICENSE" for more
|
dnl Licensed under Apache License v2.0. See the file "LICENSE" for more
|
||||||
dnl information.
|
dnl information.
|
||||||
@ -21,7 +21,7 @@ AC_PREREQ([2.70])
|
|||||||
|
|
||||||
|
|
||||||
dnl Package name and version...
|
dnl Package name and version...
|
||||||
AC_INIT([pdfio], [1.4.1], [https://github.com/michaelrsweet/pdfio/issues], [pdfio], [https://www.msweet.org/pdfio])
|
AC_INIT([pdfio], [1.5.0], [https://github.com/michaelrsweet/pdfio/issues], [pdfio], [https://www.msweet.org/pdfio])
|
||||||
|
|
||||||
PDFIO_VERSION="AC_PACKAGE_VERSION"
|
PDFIO_VERSION="AC_PACKAGE_VERSION"
|
||||||
PDFIO_VERSION_MAJOR="`echo AC_PACKAGE_VERSION | awk -F. '{print $1}'`"
|
PDFIO_VERSION_MAJOR="`echo AC_PACKAGE_VERSION | awk -F. '{print $1}'`"
|
||||||
@ -121,6 +121,32 @@ AS_IF([$PKGCONFIG --exists zlib], [
|
|||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
|
dnl libpng...
|
||||||
|
AC_ARG_ENABLE([libpng], AS_HELP_STRING([--enable-libpng], [use libpng for pdfioFileCreateImageObjFromFile, default=auto]))
|
||||||
|
|
||||||
|
PKGCONFIG_LIBPNG=""
|
||||||
|
AC_SUBST([PKGCONFIG_LIBPNG])
|
||||||
|
|
||||||
|
AS_IF([test "x$PKGCONFIG" != x -a x$enable_libpng != xno], [
|
||||||
|
AC_MSG_CHECKING([for libpng-1.6.x])
|
||||||
|
AS_IF([$PKGCONFIG --exists libpng16], [
|
||||||
|
AC_MSG_RESULT([yes]);
|
||||||
|
AC_DEFINE([HAVE_LIBPNG], 1, [Have PNG library?])
|
||||||
|
CPPFLAGS="$($PKGCONFIG --cflags libpng16) -DHAVE_LIBPNG=1 $CPPFLAGS"
|
||||||
|
LIBS="$($PKGCONFIG --libs libpng16) -lz $LIBS"
|
||||||
|
PKGCONFIG_LIBPNG="libpng >= 1.6,"
|
||||||
|
PKGCONFIG_LIBS_PRIVATE="$($PKGCONFIG --libs libpng16) $PKGCONFIG_LIBS_PRIVATE"
|
||||||
|
], [
|
||||||
|
AC_MSG_RESULT([no]);
|
||||||
|
AS_IF([test x$enable_libpng = xyes], [
|
||||||
|
AC_MSG_ERROR([libpng-dev 1.6 or later required for --enable-libpng.])
|
||||||
|
])
|
||||||
|
])
|
||||||
|
], [test x$enable_libpng = xyes], [
|
||||||
|
AC_MSG_ERROR([libpng-dev 1.6 or later required for --enable-libpng.])
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
dnl Library target...
|
dnl Library target...
|
||||||
AC_ARG_ENABLE([static], AS_HELP_STRING([--disable-static], [do not install static library]))
|
AC_ARG_ENABLE([static], AS_HELP_STRING([--disable-static], [do not install static library]))
|
||||||
AC_ARG_ENABLE([shared], AS_HELP_STRING([--enable-shared], [install shared library]))
|
AC_ARG_ENABLE([shared], AS_HELP_STRING([--enable-shared], [install shared library]))
|
||||||
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
@ -1,4 +1,4 @@
|
|||||||
.TH pdfio 3 "pdf read/write library" "2025-01-17" "pdf read/write library"
|
.TH pdfio 3 "pdf read/write library" "2025-01-24" "pdf read/write library"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
pdfio \- pdf read/write library
|
pdfio \- pdf read/write library
|
||||||
.SH Introduction
|
.SH Introduction
|
||||||
@ -2074,7 +2074,7 @@ The render_line function adds content from the linefrag_t array to a PDF page. I
|
|||||||
}
|
}
|
||||||
.fi
|
.fi
|
||||||
.PP
|
.PP
|
||||||
We then loops through the fragments for the current line, drawing checkboxes, images, and text as needed. Whan a hyperlink is present, we add the link to the links array in the docdata_t structure, mapping "@" and "@@" to an internal link corresponding to the linked text:
|
We then loop through the fragments for the current line, drawing checkboxes, images, and text as needed. When a hyperlink is present, we add the link to the links array in the docdata_t structure, mapping "@" and "@@" to an internal link corresponding to the linked text:
|
||||||
.nf
|
.nf
|
||||||
|
|
||||||
if (frag\->url && dd\->num_links < DOCLINK_MAX)
|
if (frag\->url && dd\->num_links < DOCLINK_MAX)
|
||||||
@ -4567,4 +4567,4 @@ typedef enum pdfio_valtype_e pdfio_valtype_t;
|
|||||||
Michael R Sweet
|
Michael R Sweet
|
||||||
.SH COPYRIGHT
|
.SH COPYRIGHT
|
||||||
.PP
|
.PP
|
||||||
Copyright (c) 2021-2024 by Michael R Sweet
|
Copyright (c) 2021-2025 by Michael R Sweet
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en-US">
|
<html lang="en-US">
|
||||||
<head>
|
<head>
|
||||||
<title>PDFio Programming Manual v1.4.0</title>
|
<title>PDFio Programming Manual v1.4.1</title>
|
||||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
|
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
|
||||||
<meta name="generator" content="codedoc v3.8">
|
<meta name="generator" content="codedoc v3.8">
|
||||||
<meta name="author" content="Michael R Sweet">
|
<meta name="author" content="Michael R Sweet">
|
||||||
<meta name="language" content="en-US">
|
<meta name="language" content="en-US">
|
||||||
<meta name="copyright" content="Copyright © 2021-2024 by Michael R Sweet">
|
<meta name="copyright" content="Copyright © 2021-2025 by Michael R Sweet">
|
||||||
<meta name="version" content="1.4.0">
|
<meta name="version" content="1.4.1">
|
||||||
<style type="text/css"><!--
|
<style type="text/css"><!--
|
||||||
body {
|
body {
|
||||||
background: white;
|
background: white;
|
||||||
@ -251,9 +251,9 @@ span.string {
|
|||||||
<body>
|
<body>
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<p><img class="title" src="pdfio-512.png"></p>
|
<p><img class="title" src="pdfio-512.png"></p>
|
||||||
<h1 class="title">PDFio Programming Manual v1.4.0</h1>
|
<h1 class="title">PDFio Programming Manual v1.4.1</h1>
|
||||||
<p>Michael R Sweet</p>
|
<p>Michael R Sweet</p>
|
||||||
<p>Copyright © 2021-2024 by Michael R Sweet</p>
|
<p>Copyright © 2021-2025 by Michael R Sweet</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="contents">
|
<div class="contents">
|
||||||
<h2 class="title">Contents</h2>
|
<h2 class="title">Contents</h2>
|
||||||
@ -2034,7 +2034,7 @@ dd->y -= margin_top + lineheight;
|
|||||||
dd->y -= lineheight;
|
dd->y -= lineheight;
|
||||||
}
|
}
|
||||||
</code></pre>
|
</code></pre>
|
||||||
<p>We then loops through the fragments for the current line, drawing checkboxes, images, and text as needed. WhÑn a hyperlink is present, we add the link to the <code>links</code> array in the <code>docdata_t</code> structure, mapping "@" and "@@" to an internal link corresponding to the linked text:</p>
|
<p>We then loop through the fragments for the current line, drawing checkboxes, images, and text as needed. When a hyperlink is present, we add the link to the <code>links</code> array in the <code>docdata_t</code> structure, mapping "@" and "@@" to an internal link corresponding to the linked text:</p>
|
||||||
<pre><code class="language-c"><span class="reserved">if</span> (frag->url && dd->num_links < DOCLINK_MAX)
|
<pre><code class="language-c"><span class="reserved">if</span> (frag->url && dd->num_links < DOCLINK_MAX)
|
||||||
{
|
{
|
||||||
doclink_t *l = dd->links + dd->num_links;
|
doclink_t *l = dd->links + dd->num_links;
|
||||||
|
@ -2005,7 +2005,7 @@ if ((dd->y - need_bottom) < dd->art_box.y1)
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
We then loops through the fragments for the current line, drawing checkboxes,
|
We then loop through the fragments for the current line, drawing checkboxes,
|
||||||
images, and text as needed. When a hyperlink is present, we add the link to the
|
images, and text as needed. When a hyperlink is present, we add the link to the
|
||||||
`links` array in the `docdata_t` structure, mapping "@" and "@@" to an internal
|
`links` array in the `docdata_t` structure, mapping "@" and "@@" to an internal
|
||||||
link corresponding to the linked text:
|
link corresponding to the linked text:
|
||||||
|
@ -14,8 +14,8 @@
|
|||||||
# Common options
|
# Common options
|
||||||
CFLAGS = -g $(CPPFLAGS)
|
CFLAGS = -g $(CPPFLAGS)
|
||||||
#CFLAGS = -g -fsanitize=address $(CPPFLAGS)
|
#CFLAGS = -g -fsanitize=address $(CPPFLAGS)
|
||||||
CPPFLAGS = -I.. -I/usr/local/include
|
CPPFLAGS = -I.. $(shell PKG_CONFIG_PATH="..:$(PKG_CONFIG_PATH)" pkg-config pdfio --cflags)
|
||||||
LIBS = -L.. -L/usr/local/lib -lpdfio -lz -lm
|
LIBS = -L.. $(shell PKG_CONFIG_PATH="..:$(PKG_CONFIG_PATH)" pkg-config pdfio --libs)
|
||||||
|
|
||||||
|
|
||||||
# Targets
|
# Targets
|
||||||
|
93
examples/Roboto-LICENSE.txt
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
Copyright 2011 The Roboto Project Authors (https://github.com/googlefonts/roboto-classic)
|
||||||
|
|
||||||
|
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||||
|
This license is copied below, and is also available with a FAQ at:
|
||||||
|
https://openfontlicense.org
|
||||||
|
|
||||||
|
|
||||||
|
-----------------------------------------------------------
|
||||||
|
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
||||||
|
-----------------------------------------------------------
|
||||||
|
|
||||||
|
PREAMBLE
|
||||||
|
The goals of the Open Font License (OFL) are to stimulate worldwide
|
||||||
|
development of collaborative font projects, to support the font creation
|
||||||
|
efforts of academic and linguistic communities, and to provide a free and
|
||||||
|
open framework in which fonts may be shared and improved in partnership
|
||||||
|
with others.
|
||||||
|
|
||||||
|
The OFL allows the licensed fonts to be used, studied, modified and
|
||||||
|
redistributed freely as long as they are not sold by themselves. The
|
||||||
|
fonts, including any derivative works, can be bundled, embedded,
|
||||||
|
redistributed and/or sold with any software provided that any reserved
|
||||||
|
names are not used by derivative works. The fonts and derivatives,
|
||||||
|
however, cannot be released under any other type of license. The
|
||||||
|
requirement for fonts to remain under this license does not apply
|
||||||
|
to any document created using the fonts or their derivatives.
|
||||||
|
|
||||||
|
DEFINITIONS
|
||||||
|
"Font Software" refers to the set of files released by the Copyright
|
||||||
|
Holder(s) under this license and clearly marked as such. This may
|
||||||
|
include source files, build scripts and documentation.
|
||||||
|
|
||||||
|
"Reserved Font Name" refers to any names specified as such after the
|
||||||
|
copyright statement(s).
|
||||||
|
|
||||||
|
"Original Version" refers to the collection of Font Software components as
|
||||||
|
distributed by the Copyright Holder(s).
|
||||||
|
|
||||||
|
"Modified Version" refers to any derivative made by adding to, deleting,
|
||||||
|
or substituting -- in part or in whole -- any of the components of the
|
||||||
|
Original Version, by changing formats or by porting the Font Software to a
|
||||||
|
new environment.
|
||||||
|
|
||||||
|
"Author" refers to any designer, engineer, programmer, technical
|
||||||
|
writer or other person who contributed to the Font Software.
|
||||||
|
|
||||||
|
PERMISSION & CONDITIONS
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
||||||
|
redistribute, and sell modified and unmodified copies of the Font
|
||||||
|
Software, subject to the following conditions:
|
||||||
|
|
||||||
|
1) Neither the Font Software nor any of its individual components,
|
||||||
|
in Original or Modified Versions, may be sold by itself.
|
||||||
|
|
||||||
|
2) Original or Modified Versions of the Font Software may be bundled,
|
||||||
|
redistributed and/or sold with any software, provided that each copy
|
||||||
|
contains the above copyright notice and this license. These can be
|
||||||
|
included either as stand-alone text files, human-readable headers or
|
||||||
|
in the appropriate machine-readable metadata fields within text or
|
||||||
|
binary files as long as those fields can be easily viewed by the user.
|
||||||
|
|
||||||
|
3) No Modified Version of the Font Software may use the Reserved Font
|
||||||
|
Name(s) unless explicit written permission is granted by the corresponding
|
||||||
|
Copyright Holder. This restriction only applies to the primary font name as
|
||||||
|
presented to the users.
|
||||||
|
|
||||||
|
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||||
|
Software shall not be used to promote, endorse or advertise any
|
||||||
|
Modified Version, except to acknowledge the contribution(s) of the
|
||||||
|
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||||
|
permission.
|
||||||
|
|
||||||
|
5) The Font Software, modified or unmodified, in part or in whole,
|
||||||
|
must be distributed entirely under this license, and must not be
|
||||||
|
distributed under any other license. The requirement for fonts to
|
||||||
|
remain under this license does not apply to any document created
|
||||||
|
using the Font Software.
|
||||||
|
|
||||||
|
TERMINATION
|
||||||
|
This license becomes null and void if any of the above conditions are
|
||||||
|
not met.
|
||||||
|
|
||||||
|
DISCLAIMER
|
||||||
|
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||||
|
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||||
|
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||||
|
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||||
|
OTHER DEALINGS IN THE FONT SOFTWARE.
|
343
examples/code128-LICENSE.txt
Normal file
@ -0,0 +1,343 @@
|
|||||||
|
Copyright 2003 Grandzebu, All Rights Reserved
|
||||||
|
|
||||||
|
http://grandzebu.net/informatique/codbar-en/code128.htm
|
||||||
|
|
||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 2, June 1991
|
||||||
|
|
||||||
|
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The licenses for most software are designed to take away your
|
||||||
|
freedom to share and change it. By contrast, the GNU General Public
|
||||||
|
License is intended to guarantee your freedom to share and change free
|
||||||
|
software--to make sure the software is free for all its users. This
|
||||||
|
General Public License applies to most of the Free Software
|
||||||
|
Foundation's software and to any other program whose authors commit to
|
||||||
|
using it. (Some other Free Software Foundation software is covered by
|
||||||
|
the GNU Lesser General Public License instead.) You can apply it to
|
||||||
|
your programs, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
this service if you wish), that you receive source code or can get it
|
||||||
|
if you want it, that you can change the software or use pieces of it
|
||||||
|
in new free programs; and that you know you can do these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to make restrictions that forbid
|
||||||
|
anyone to deny you these rights or to ask you to surrender the rights.
|
||||||
|
These restrictions translate to certain responsibilities for you if you
|
||||||
|
distribute copies of the software, or if you modify it.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must give the recipients all the rights that
|
||||||
|
you have. You must make sure that they, too, receive or can get the
|
||||||
|
source code. And you must show them these terms so they know their
|
||||||
|
rights.
|
||||||
|
|
||||||
|
We protect your rights with two steps: (1) copyright the software, and
|
||||||
|
(2) offer you this license which gives you legal permission to copy,
|
||||||
|
distribute and/or modify the software.
|
||||||
|
|
||||||
|
Also, for each author's protection and ours, we want to make certain
|
||||||
|
that everyone understands that there is no warranty for this free
|
||||||
|
software. If the software is modified by someone else and passed on, we
|
||||||
|
want its recipients to know that what they have is not the original, so
|
||||||
|
that any problems introduced by others will not reflect on the original
|
||||||
|
authors' reputations.
|
||||||
|
|
||||||
|
Finally, any free program is threatened constantly by software
|
||||||
|
patents. We wish to avoid the danger that redistributors of a free
|
||||||
|
program will individually obtain patent licenses, in effect making the
|
||||||
|
program proprietary. To prevent this, we have made it clear that any
|
||||||
|
patent must be licensed for everyone's free use or not licensed at all.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||||
|
|
||||||
|
0. This License applies to any program or other work which contains
|
||||||
|
a notice placed by the copyright holder saying it may be distributed
|
||||||
|
under the terms of this General Public License. The "Program", below,
|
||||||
|
refers to any such program or work, and a "work based on the Program"
|
||||||
|
means either the Program or any derivative work under copyright law:
|
||||||
|
that is to say, a work containing the Program or a portion of it,
|
||||||
|
either verbatim or with modifications and/or translated into another
|
||||||
|
language. (Hereinafter, translation is included without limitation in
|
||||||
|
the term "modification".) Each licensee is addressed as "you".
|
||||||
|
|
||||||
|
Activities other than copying, distribution and modification are not
|
||||||
|
covered by this License; they are outside its scope. The act of
|
||||||
|
running the Program is not restricted, and the output from the Program
|
||||||
|
is covered only if its contents constitute a work based on the
|
||||||
|
Program (independent of having been made by running the Program).
|
||||||
|
Whether that is true depends on what the Program does.
|
||||||
|
|
||||||
|
1. You may copy and distribute verbatim copies of the Program's
|
||||||
|
source code as you receive it, in any medium, provided that you
|
||||||
|
conspicuously and appropriately publish on each copy an appropriate
|
||||||
|
copyright notice and disclaimer of warranty; keep intact all the
|
||||||
|
notices that refer to this License and to the absence of any warranty;
|
||||||
|
and give any other recipients of the Program a copy of this License
|
||||||
|
along with the Program.
|
||||||
|
|
||||||
|
You may charge a fee for the physical act of transferring a copy, and
|
||||||
|
you may at your option offer warranty protection in exchange for a fee.
|
||||||
|
|
||||||
|
2. You may modify your copy or copies of the Program or any portion
|
||||||
|
of it, thus forming a work based on the Program, and copy and
|
||||||
|
distribute such modifications or work under the terms of Section 1
|
||||||
|
above, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) You must cause the modified files to carry prominent notices
|
||||||
|
stating that you changed the files and the date of any change.
|
||||||
|
|
||||||
|
b) You must cause any work that you distribute or publish, that in
|
||||||
|
whole or in part contains or is derived from the Program or any
|
||||||
|
part thereof, to be licensed as a whole at no charge to all third
|
||||||
|
parties under the terms of this License.
|
||||||
|
|
||||||
|
c) If the modified program normally reads commands interactively
|
||||||
|
when run, you must cause it, when started running for such
|
||||||
|
interactive use in the most ordinary way, to print or display an
|
||||||
|
announcement including an appropriate copyright notice and a
|
||||||
|
notice that there is no warranty (or else, saying that you provide
|
||||||
|
a warranty) and that users may redistribute the program under
|
||||||
|
these conditions, and telling the user how to view a copy of this
|
||||||
|
License. (Exception: if the Program itself is interactive but
|
||||||
|
does not normally print such an announcement, your work based on
|
||||||
|
the Program is not required to print an announcement.)
|
||||||
|
|
||||||
|
These requirements apply to the modified work as a whole. If
|
||||||
|
identifiable sections of that work are not derived from the Program,
|
||||||
|
and can be reasonably considered independent and separate works in
|
||||||
|
themselves, then this License, and its terms, do not apply to those
|
||||||
|
sections when you distribute them as separate works. But when you
|
||||||
|
distribute the same sections as part of a whole which is a work based
|
||||||
|
on the Program, the distribution of the whole must be on the terms of
|
||||||
|
this License, whose permissions for other licensees extend to the
|
||||||
|
entire whole, and thus to each and every part regardless of who wrote it.
|
||||||
|
|
||||||
|
Thus, it is not the intent of this section to claim rights or contest
|
||||||
|
your rights to work written entirely by you; rather, the intent is to
|
||||||
|
exercise the right to control the distribution of derivative or
|
||||||
|
collective works based on the Program.
|
||||||
|
|
||||||
|
In addition, mere aggregation of another work not based on the Program
|
||||||
|
with the Program (or with a work based on the Program) on a volume of
|
||||||
|
a storage or distribution medium does not bring the other work under
|
||||||
|
the scope of this License.
|
||||||
|
|
||||||
|
3. You may copy and distribute the Program (or a work based on it,
|
||||||
|
under Section 2) in object code or executable form under the terms of
|
||||||
|
Sections 1 and 2 above provided that you also do one of the following:
|
||||||
|
|
||||||
|
a) Accompany it with the complete corresponding machine-readable
|
||||||
|
source code, which must be distributed under the terms of Sections
|
||||||
|
1 and 2 above on a medium customarily used for software interchange; or,
|
||||||
|
|
||||||
|
b) Accompany it with a written offer, valid for at least three
|
||||||
|
years, to give any third party, for a charge no more than your
|
||||||
|
cost of physically performing source distribution, a complete
|
||||||
|
machine-readable copy of the corresponding source code, to be
|
||||||
|
distributed under the terms of Sections 1 and 2 above on a medium
|
||||||
|
customarily used for software interchange; or,
|
||||||
|
|
||||||
|
c) Accompany it with the information you received as to the offer
|
||||||
|
to distribute corresponding source code. (This alternative is
|
||||||
|
allowed only for noncommercial distribution and only if you
|
||||||
|
received the program in object code or executable form with such
|
||||||
|
an offer, in accord with Subsection b above.)
|
||||||
|
|
||||||
|
The source code for a work means the preferred form of the work for
|
||||||
|
making modifications to it. For an executable work, complete source
|
||||||
|
code means all the source code for all modules it contains, plus any
|
||||||
|
associated interface definition files, plus the scripts used to
|
||||||
|
control compilation and installation of the executable. However, as a
|
||||||
|
special exception, the source code distributed need not include
|
||||||
|
anything that is normally distributed (in either source or binary
|
||||||
|
form) with the major components (compiler, kernel, and so on) of the
|
||||||
|
operating system on which the executable runs, unless that component
|
||||||
|
itself accompanies the executable.
|
||||||
|
|
||||||
|
If distribution of executable or object code is made by offering
|
||||||
|
access to copy from a designated place, then offering equivalent
|
||||||
|
access to copy the source code from the same place counts as
|
||||||
|
distribution of the source code, even though third parties are not
|
||||||
|
compelled to copy the source along with the object code.
|
||||||
|
|
||||||
|
4. You may not copy, modify, sublicense, or distribute the Program
|
||||||
|
except as expressly provided under this License. Any attempt
|
||||||
|
otherwise to copy, modify, sublicense or distribute the Program is
|
||||||
|
void, and will automatically terminate your rights under this License.
|
||||||
|
However, parties who have received copies, or rights, from you under
|
||||||
|
this License will not have their licenses terminated so long as such
|
||||||
|
parties remain in full compliance.
|
||||||
|
|
||||||
|
5. You are not required to accept this License, since you have not
|
||||||
|
signed it. However, nothing else grants you permission to modify or
|
||||||
|
distribute the Program or its derivative works. These actions are
|
||||||
|
prohibited by law if you do not accept this License. Therefore, by
|
||||||
|
modifying or distributing the Program (or any work based on the
|
||||||
|
Program), you indicate your acceptance of this License to do so, and
|
||||||
|
all its terms and conditions for copying, distributing or modifying
|
||||||
|
the Program or works based on it.
|
||||||
|
|
||||||
|
6. Each time you redistribute the Program (or any work based on the
|
||||||
|
Program), the recipient automatically receives a license from the
|
||||||
|
original licensor to copy, distribute or modify the Program subject to
|
||||||
|
these terms and conditions. You may not impose any further
|
||||||
|
restrictions on the recipients' exercise of the rights granted herein.
|
||||||
|
You are not responsible for enforcing compliance by third parties to
|
||||||
|
this License.
|
||||||
|
|
||||||
|
7. If, as a consequence of a court judgment or allegation of patent
|
||||||
|
infringement or for any other reason (not limited to patent issues),
|
||||||
|
conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot
|
||||||
|
distribute so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you
|
||||||
|
may not distribute the Program at all. For example, if a patent
|
||||||
|
license would not permit royalty-free redistribution of the Program by
|
||||||
|
all those who receive copies directly or indirectly through you, then
|
||||||
|
the only way you could satisfy both it and this License would be to
|
||||||
|
refrain entirely from distribution of the Program.
|
||||||
|
|
||||||
|
If any portion of this section is held invalid or unenforceable under
|
||||||
|
any particular circumstance, the balance of the section is intended to
|
||||||
|
apply and the section as a whole is intended to apply in other
|
||||||
|
circumstances.
|
||||||
|
|
||||||
|
It is not the purpose of this section to induce you to infringe any
|
||||||
|
patents or other property right claims or to contest validity of any
|
||||||
|
such claims; this section has the sole purpose of protecting the
|
||||||
|
integrity of the free software distribution system, which is
|
||||||
|
implemented by public license practices. Many people have made
|
||||||
|
generous contributions to the wide range of software distributed
|
||||||
|
through that system in reliance on consistent application of that
|
||||||
|
system; it is up to the author/donor to decide if he or she is willing
|
||||||
|
to distribute software through any other system and a licensee cannot
|
||||||
|
impose that choice.
|
||||||
|
|
||||||
|
This section is intended to make thoroughly clear what is believed to
|
||||||
|
be a consequence of the rest of this License.
|
||||||
|
|
||||||
|
8. If the distribution and/or use of the Program is restricted in
|
||||||
|
certain countries either by patents or by copyrighted interfaces, the
|
||||||
|
original copyright holder who places the Program under this License
|
||||||
|
may add an explicit geographical distribution limitation excluding
|
||||||
|
those countries, so that distribution is permitted only in or among
|
||||||
|
countries not thus excluded. In such case, this License incorporates
|
||||||
|
the limitation as if written in the body of this License.
|
||||||
|
|
||||||
|
9. The Free Software Foundation may publish revised and/or new versions
|
||||||
|
of the General Public License from time to time. Such new versions will
|
||||||
|
be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the Program
|
||||||
|
specifies a version number of this License which applies to it and "any
|
||||||
|
later version", you have the option of following the terms and conditions
|
||||||
|
either of that version or of any later version published by the Free
|
||||||
|
Software Foundation. If the Program does not specify a version number of
|
||||||
|
this License, you may choose any version ever published by the Free Software
|
||||||
|
Foundation.
|
||||||
|
|
||||||
|
10. If you wish to incorporate parts of the Program into other free
|
||||||
|
programs whose distribution conditions are different, write to the author
|
||||||
|
to ask for permission. For software which is copyrighted by the Free
|
||||||
|
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||||
|
make exceptions for this. Our decision will be guided by the two goals
|
||||||
|
of preserving the free status of all derivatives of our free software and
|
||||||
|
of promoting the sharing and reuse of software generally.
|
||||||
|
|
||||||
|
NO WARRANTY
|
||||||
|
|
||||||
|
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||||
|
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||||
|
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||||
|
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||||
|
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||||
|
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||||
|
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||||
|
REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||||
|
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||||
|
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||||
|
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||||
|
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||||
|
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||||
|
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||||
|
POSSIBILITY OF SUCH DAMAGES.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest
|
||||||
|
to attach them to the start of each source file to most effectively
|
||||||
|
convey the exclusion of warranty; and each file should have at least
|
||||||
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along
|
||||||
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If the program is interactive, make it output a short notice like this
|
||||||
|
when it starts in an interactive mode:
|
||||||
|
|
||||||
|
Gnomovision version 69, Copyright (C) year name of author
|
||||||
|
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it
|
||||||
|
under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||||
|
parts of the General Public License. Of course, the commands you use may
|
||||||
|
be called something other than `show w' and `show c'; they could even be
|
||||||
|
mouse-clicks or menu items--whatever suits your program.
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or your
|
||||||
|
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||||
|
necessary. Here is a sample; alter the names:
|
||||||
|
|
||||||
|
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||||
|
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||||
|
|
||||||
|
<signature of Ty Coon>, 1 April 1989
|
||||||
|
Ty Coon, President of Vice
|
||||||
|
|
||||||
|
This General Public License does not permit incorporating your program into
|
||||||
|
proprietary programs. If your program is a subroutine library, you may
|
||||||
|
consider it more useful to permit linking proprietary applications with the
|
||||||
|
library. If this is what you want to do, use the GNU Lesser General
|
||||||
|
Public License instead of this License.
|
@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// Image example for PDFio.
|
// Image example for PDFio.
|
||||||
//
|
//
|
||||||
// Copyright © 2023-2024 by Michael R Sweet.
|
// Copyright © 2023-2025 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.
|
||||||
@ -22,8 +22,8 @@
|
|||||||
|
|
||||||
bool // O - True on success, false on failure
|
bool // O - True on success, false on failure
|
||||||
create_pdf_image_file(
|
create_pdf_image_file(
|
||||||
const char *pdfname, // I - PDF filename
|
|
||||||
const char *imagename, // I - Image filename
|
const char *imagename, // I - Image filename
|
||||||
|
const char *pdfname, // I - PDF filename
|
||||||
const char *caption) // I - Caption filename
|
const char *caption) // I - Caption filename
|
||||||
{
|
{
|
||||||
pdfio_file_t *pdf; // PDF file
|
pdfio_file_t *pdf; // PDF file
|
||||||
@ -36,6 +36,15 @@ create_pdf_image_file(
|
|||||||
double tx, ty; // Position on page
|
double tx, ty; // Position on page
|
||||||
|
|
||||||
|
|
||||||
|
// Default the caption...
|
||||||
|
if (!caption)
|
||||||
|
{
|
||||||
|
if ((caption = strrchr(imagename, '/')) != NULL)
|
||||||
|
caption ++;
|
||||||
|
else
|
||||||
|
caption = imagename;
|
||||||
|
}
|
||||||
|
|
||||||
// Create the PDF file...
|
// Create the PDF file...
|
||||||
pdf = pdfioFileCreate(pdfname, /*version*/NULL, /*media_box*/NULL,
|
pdf = pdfioFileCreate(pdfname, /*version*/NULL, /*media_box*/NULL,
|
||||||
/*crop_box*/NULL, /*error_cb*/NULL,
|
/*crop_box*/NULL, /*error_cb*/NULL,
|
||||||
|
1286
examples/pdf2text.c
@ -29,6 +29,15 @@ if test $(grep AC_INIT configure.ac | awk '{print $2}') != "[$version],"; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if test $(head -4 CHANGES.md | tail -1 | awk '{print $1}') != "v$version"; then
|
||||||
|
echo "Still need to update CHANGES.md version number."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if test $(head -4 CHANGES.md | tail -1 | awk '{print $3}') = "YYYY-MM-DD"; then
|
||||||
|
echo "Still need to update CHANGES.md release date."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
if test $(grep PDFIO_VERSION= configure | awk -F \" '{print $2}') != "$version"; then
|
if test $(grep PDFIO_VERSION= configure | awk -F \" '{print $2}') != "$version"; then
|
||||||
echo "Still need to run 'autoconf -f'."
|
echo "Still need to run 'autoconf -f'."
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
|
<package id="libpng_native" version="1.6.30" targetFramework="native" />
|
||||||
|
<package id="libpng_native.redist" version="1.6.30" targetFramework="native" />
|
||||||
<package id="zlib_native" version="1.2.11" targetFramework="native" />
|
<package id="zlib_native" version="1.2.11" targetFramework="native" />
|
||||||
<package id="zlib_native.redist" version="1.2.11" targetFramework="native" />
|
<package id="zlib_native.redist" version="1.2.11" targetFramework="native" />
|
||||||
</packages>
|
</packages>
|
@ -368,7 +368,7 @@ _pdfioFileSeek(pdfio_file_t *pdf, // I - PDF file
|
|||||||
if (pdf->mode == _PDFIO_MODE_READ)
|
if (pdf->mode == _PDFIO_MODE_READ)
|
||||||
{
|
{
|
||||||
// Reading, see if we already have the data we need...
|
// Reading, see if we already have the data we need...
|
||||||
if (whence != SEEK_END && offset >= pdf->bufpos && offset < (pdf->bufpos + pdf->bufend - pdf->buffer))
|
if (whence != SEEK_END && offset >= pdf->bufpos && pdf->bufend && offset < (pdf->bufpos + pdf->bufend - pdf->buffer))
|
||||||
{
|
{
|
||||||
// Yes, seek within existing buffer...
|
// Yes, seek within existing buffer...
|
||||||
pdf->bufptr = pdf->buffer + (offset - pdf->bufpos);
|
pdf->bufptr = pdf->buffer + (offset - pdf->bufpos);
|
||||||
|
689
pdfio-content.c
@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// Content helper functions for PDFio.
|
// Content helper functions for PDFio.
|
||||||
//
|
//
|
||||||
// Copyright © 2021-2024 by Michael R Sweet.
|
// Copyright © 2021-2025 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.
|
||||||
@ -11,6 +11,9 @@
|
|||||||
#include "pdfio-content.h"
|
#include "pdfio-content.h"
|
||||||
#include "pdfio-base-font-widths.h"
|
#include "pdfio-base-font-widths.h"
|
||||||
#include "ttf.h"
|
#include "ttf.h"
|
||||||
|
#ifdef HAVE_LIBPNG
|
||||||
|
# include <png.h>
|
||||||
|
#endif // HAVE_LIBPNG
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#ifndef M_PI
|
#ifndef M_PI
|
||||||
# define M_PI 3.14159265358979323846264338327950288
|
# define M_PI 3.14159265358979323846264338327950288
|
||||||
@ -29,12 +32,50 @@
|
|||||||
#define _PDFIO_PNG_CHUNK_gAMA 0x67414d41 // Gamma correction
|
#define _PDFIO_PNG_CHUNK_gAMA 0x67414d41 // Gamma correction
|
||||||
#define _PDFIO_PNG_CHUNK_tRNS 0x74524e53 // Transparency information
|
#define _PDFIO_PNG_CHUNK_tRNS 0x74524e53 // Transparency information
|
||||||
|
|
||||||
|
#define _PDFIO_PNG_COMPRESSION_FLATE 0 // Flate compression
|
||||||
|
|
||||||
|
#define _PDFIO_PNG_FILTER_ADAPTIVE 0 // Adaptive filtering
|
||||||
|
|
||||||
|
#define _PDFIO_PNG_INTERLACE_NONE 0 // No interlacing
|
||||||
|
#define _PDFIO_PNG_INTERLACE_ADAM 1 // "Adam7" interlacing
|
||||||
|
|
||||||
#define _PDFIO_PNG_TYPE_GRAY 0 // Grayscale
|
#define _PDFIO_PNG_TYPE_GRAY 0 // Grayscale
|
||||||
#define _PDFIO_PNG_TYPE_RGB 2 // RGB
|
#define _PDFIO_PNG_TYPE_RGB 2 // RGB
|
||||||
#define _PDFIO_PNG_TYPE_INDEXED 3 // Indexed
|
#define _PDFIO_PNG_TYPE_INDEXED 3 // Indexed
|
||||||
#define _PDFIO_PNG_TYPE_GRAYA 4 // Grayscale + alpha
|
#define _PDFIO_PNG_TYPE_GRAYA 4 // Grayscale + alpha
|
||||||
#define _PDFIO_PNG_TYPE_RGBA 6 // RGB + alpha
|
#define _PDFIO_PNG_TYPE_RGBA 6 // RGB + alpha
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// Local types...
|
||||||
|
//
|
||||||
|
|
||||||
|
typedef pdfio_obj_t *(*_pdfio_image_func_t)(pdfio_dict_t *dict, int fd);
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// Local functions...
|
||||||
|
//
|
||||||
|
|
||||||
|
static pdfio_obj_t *copy_jpeg(pdfio_dict_t *dict, int fd);
|
||||||
|
static pdfio_obj_t *copy_png(pdfio_dict_t *dict, int fd);
|
||||||
|
static bool create_cp1252(pdfio_file_t *pdf);
|
||||||
|
static pdfio_obj_t *create_image(pdfio_dict_t *dict, const unsigned char *data, size_t width, size_t height, size_t depth, size_t num_colors, bool alpha);
|
||||||
|
#ifdef HAVE_LIBPNG
|
||||||
|
static void png_error_func(png_structp pp, png_const_charp message);
|
||||||
|
static void png_read_func(png_structp png_ptr, png_bytep data, size_t length);
|
||||||
|
#endif // HAVE_LIBPNG
|
||||||
|
static void ttf_error_cb(pdfio_file_t *pdf, const char *message);
|
||||||
|
#ifndef HAVE_LIBPNG
|
||||||
|
static unsigned update_png_crc(unsigned crc, const unsigned char *buffer, size_t length);
|
||||||
|
#endif // !HAVE_LIBPNG
|
||||||
|
static bool write_string(pdfio_stream_t *st, bool unicode, const char *s, bool *newline);
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// Local globals...
|
||||||
|
//
|
||||||
|
|
||||||
static int _pdfio_cp1252[] = // CP1252-specific character mapping
|
static int _pdfio_cp1252[] = // CP1252-specific character mapping
|
||||||
{
|
{
|
||||||
0x20AC,
|
0x20AC,
|
||||||
@ -71,30 +112,7 @@ static int _pdfio_cp1252[] = // CP1252-specific character mapping
|
|||||||
0x0178
|
0x0178
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifndef HAVE_LIBPNG
|
||||||
//
|
|
||||||
// Local types...
|
|
||||||
//
|
|
||||||
|
|
||||||
typedef pdfio_obj_t *(*_pdfio_image_func_t)(pdfio_dict_t *dict, int fd);
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// Local functions...
|
|
||||||
//
|
|
||||||
|
|
||||||
static pdfio_obj_t *copy_jpeg(pdfio_dict_t *dict, int fd);
|
|
||||||
static pdfio_obj_t *copy_png(pdfio_dict_t *dict, int fd);
|
|
||||||
static bool create_cp1252(pdfio_file_t *pdf);
|
|
||||||
static void ttf_error_cb(pdfio_file_t *pdf, const char *message);
|
|
||||||
static unsigned update_png_crc(unsigned crc, const unsigned char *buffer, size_t length);
|
|
||||||
static bool write_string(pdfio_stream_t *st, bool unicode, const char *s, bool *newline);
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// Local globals...
|
|
||||||
//
|
|
||||||
|
|
||||||
static unsigned png_crc_table[256] = // CRC-32 table for PNG files
|
static unsigned png_crc_table[256] = // CRC-32 table for PNG files
|
||||||
{
|
{
|
||||||
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f,
|
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f,
|
||||||
@ -141,6 +159,7 @@ static unsigned png_crc_table[256] = // CRC-32 table for PNG files
|
|||||||
0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94,
|
0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94,
|
||||||
0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d
|
0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d
|
||||||
};
|
};
|
||||||
|
#endif // !HAVE_LIBPNG
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -1976,18 +1995,7 @@ pdfioFileCreateImageObjFromData(
|
|||||||
bool alpha, // I - `true` if data contains an alpha channel
|
bool alpha, // I - `true` if data contains an alpha channel
|
||||||
bool interpolate) // I - Interpolate image data?
|
bool interpolate) // I - Interpolate image data?
|
||||||
{
|
{
|
||||||
pdfio_dict_t *dict, // Image dictionary
|
pdfio_dict_t *dict; // Image dictionary
|
||||||
*decode; // DecodeParms dictionary
|
|
||||||
pdfio_obj_t *obj, // Image object
|
|
||||||
*mask_obj = NULL;
|
|
||||||
// Mask image object, if any
|
|
||||||
pdfio_stream_t *st; // Image stream
|
|
||||||
size_t x, y, // X and Y position in image
|
|
||||||
bpp, // Bytes per pixel
|
|
||||||
linelen; // Line length
|
|
||||||
const unsigned char *dataptr; // Pointer into image data
|
|
||||||
unsigned char *line = NULL, // Current line
|
|
||||||
*lineptr; // Pointer into line
|
|
||||||
static const char *defcolors[] = // Default ColorSpace values
|
static const char *defcolors[] = // Default ColorSpace values
|
||||||
{
|
{
|
||||||
NULL,
|
NULL,
|
||||||
@ -2002,74 +2010,9 @@ pdfioFileCreateImageObjFromData(
|
|||||||
if (!pdf || !data || !width || !height || num_colors < 1 || num_colors == 2 || num_colors > 4)
|
if (!pdf || !data || !width || !height || num_colors < 1 || num_colors == 2 || num_colors > 4)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
|
||||||
// Allocate memory for one line of data...
|
// Create the image dictionary...
|
||||||
bpp = alpha ? num_colors + 1 : num_colors;
|
|
||||||
linelen = num_colors * width;
|
|
||||||
|
|
||||||
if ((line = malloc(linelen)) == NULL)
|
|
||||||
return (NULL);
|
|
||||||
|
|
||||||
// Generate a mask image, as needed...
|
|
||||||
if (alpha)
|
|
||||||
{
|
|
||||||
// Create the image mask dictionary...
|
|
||||||
if ((dict = pdfioDictCreate(pdf)) == NULL)
|
|
||||||
{
|
|
||||||
free(line);
|
|
||||||
return (NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
pdfioDictSetName(dict, "Type", "XObject");
|
|
||||||
pdfioDictSetName(dict, "Subtype", "Image");
|
|
||||||
pdfioDictSetNumber(dict, "Width", width);
|
|
||||||
pdfioDictSetNumber(dict, "Height", height);
|
|
||||||
pdfioDictSetNumber(dict, "BitsPerComponent", 8);
|
|
||||||
pdfioDictSetName(dict, "ColorSpace", "DeviceGray");
|
|
||||||
pdfioDictSetName(dict, "Filter", "FlateDecode");
|
|
||||||
|
|
||||||
if ((decode = pdfioDictCreate(pdf)) == NULL)
|
|
||||||
{
|
|
||||||
free(line);
|
|
||||||
return (NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
pdfioDictSetNumber(decode, "BitsPerComponent", 8);
|
|
||||||
pdfioDictSetNumber(decode, "Colors", 1);
|
|
||||||
pdfioDictSetNumber(decode, "Columns", width);
|
|
||||||
pdfioDictSetNumber(decode, "Predictor", _PDFIO_PREDICTOR_PNG_AUTO);
|
|
||||||
pdfioDictSetDict(dict, "DecodeParms", decode);
|
|
||||||
|
|
||||||
// Create the mask object and write the mask image...
|
|
||||||
if ((mask_obj = pdfioFileCreateObj(pdf, dict)) == NULL)
|
|
||||||
{
|
|
||||||
free(line);
|
|
||||||
return (NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((st = pdfioObjCreateStream(mask_obj, PDFIO_FILTER_FLATE)) == NULL)
|
|
||||||
{
|
|
||||||
free(line);
|
|
||||||
pdfioObjClose(mask_obj);
|
|
||||||
return (NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (y = height, dataptr = data + num_colors; y > 0; y --)
|
|
||||||
{
|
|
||||||
for (x = width, lineptr = line; x > 0; x --, dataptr += bpp)
|
|
||||||
*lineptr++ = *dataptr;
|
|
||||||
|
|
||||||
pdfioStreamWrite(st, line, width);
|
|
||||||
}
|
|
||||||
|
|
||||||
pdfioStreamClose(st);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Now create the image...
|
|
||||||
if ((dict = pdfioDictCreate(pdf)) == NULL)
|
if ((dict = pdfioDictCreate(pdf)) == NULL)
|
||||||
{
|
|
||||||
free(line);
|
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
|
||||||
|
|
||||||
pdfioDictSetName(dict, "Type", "XObject");
|
pdfioDictSetName(dict, "Type", "XObject");
|
||||||
pdfioDictSetName(dict, "Subtype", "Image");
|
pdfioDictSetName(dict, "Subtype", "Image");
|
||||||
@ -2077,83 +2020,14 @@ pdfioFileCreateImageObjFromData(
|
|||||||
pdfioDictSetNumber(dict, "Width", width);
|
pdfioDictSetNumber(dict, "Width", width);
|
||||||
pdfioDictSetNumber(dict, "Height", height);
|
pdfioDictSetNumber(dict, "Height", height);
|
||||||
pdfioDictSetNumber(dict, "BitsPerComponent", 8);
|
pdfioDictSetNumber(dict, "BitsPerComponent", 8);
|
||||||
pdfioDictSetName(dict, "Filter", "FlateDecode");
|
|
||||||
|
|
||||||
if (color_data)
|
if (color_data)
|
||||||
pdfioDictSetArray(dict, "ColorSpace", color_data);
|
pdfioDictSetArray(dict, "ColorSpace", color_data);
|
||||||
else
|
else
|
||||||
pdfioDictSetName(dict, "ColorSpace", defcolors[num_colors]);
|
pdfioDictSetName(dict, "ColorSpace", defcolors[num_colors]);
|
||||||
|
|
||||||
if (mask_obj)
|
// Create the image object(s)...
|
||||||
pdfioDictSetObj(dict, "SMask", mask_obj);
|
return (create_image(dict, data, width, height, 8, num_colors, alpha));
|
||||||
|
|
||||||
if ((decode = pdfioDictCreate(pdf)) == NULL)
|
|
||||||
{
|
|
||||||
free(line);
|
|
||||||
return (NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
pdfioDictSetNumber(decode, "BitsPerComponent", 8);
|
|
||||||
pdfioDictSetNumber(decode, "Colors", num_colors);
|
|
||||||
pdfioDictSetNumber(decode, "Columns", width);
|
|
||||||
pdfioDictSetNumber(decode, "Predictor", _PDFIO_PREDICTOR_PNG_AUTO);
|
|
||||||
pdfioDictSetDict(dict, "DecodeParms", decode);
|
|
||||||
|
|
||||||
if ((obj = pdfioFileCreateObj(pdf, dict)) == NULL)
|
|
||||||
{
|
|
||||||
free(line);
|
|
||||||
return (NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((st = pdfioObjCreateStream(obj, PDFIO_FILTER_FLATE)) == NULL)
|
|
||||||
{
|
|
||||||
free(line);
|
|
||||||
pdfioObjClose(obj);
|
|
||||||
return (NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (y = height, dataptr = data; y > 0; y --)
|
|
||||||
{
|
|
||||||
if (alpha)
|
|
||||||
{
|
|
||||||
switch (num_colors)
|
|
||||||
{
|
|
||||||
case 1 :
|
|
||||||
for (x = width, lineptr = line; x > 0; x --, dataptr += bpp)
|
|
||||||
*lineptr++ = *dataptr;
|
|
||||||
break;
|
|
||||||
case 3 :
|
|
||||||
for (x = width, lineptr = line; x > 0; x --, dataptr += bpp)
|
|
||||||
{
|
|
||||||
*lineptr++ = dataptr[0];
|
|
||||||
*lineptr++ = dataptr[1];
|
|
||||||
*lineptr++ = dataptr[2];
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 4 :
|
|
||||||
for (x = width, lineptr = line; x > 0; x --, dataptr += bpp)
|
|
||||||
{
|
|
||||||
*lineptr++ = dataptr[0];
|
|
||||||
*lineptr++ = dataptr[1];
|
|
||||||
*lineptr++ = dataptr[2];
|
|
||||||
*lineptr++ = dataptr[3];
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
pdfioStreamWrite(st, line, linelen);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
pdfioStreamWrite(st, dataptr, linelen);
|
|
||||||
dataptr += linelen;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
free(line);
|
|
||||||
pdfioStreamClose(st);
|
|
||||||
|
|
||||||
return (obj);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2183,6 +2057,8 @@ pdfioFileCreateImageObjFromFile(
|
|||||||
_pdfio_image_func_t copy_func = NULL; // Image copy function
|
_pdfio_image_func_t copy_func = NULL; // Image copy function
|
||||||
|
|
||||||
|
|
||||||
|
PDFIO_DEBUG("pdfioFileCreateImageObjFromFile(pdf=%p, filename=\"%s\", interpolate=%s)\n", (void *)pdf, filename, interpolate ? "true" : "false");
|
||||||
|
|
||||||
// Range check input...
|
// Range check input...
|
||||||
if (!pdf || !filename)
|
if (!pdf || !filename)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
@ -2204,6 +2080,8 @@ pdfioFileCreateImageObjFromFile(
|
|||||||
|
|
||||||
lseek(fd, 0, SEEK_SET);
|
lseek(fd, 0, SEEK_SET);
|
||||||
|
|
||||||
|
PDFIO_DEBUG("pdfioFileCreateImageObjFromFile: buffer=<%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X>\n", buffer[0], buffer[1], buffer[2], buffer[3], buffer[4], buffer[5], buffer[6], buffer[7], buffer[8], buffer[9], buffer[10], buffer[11], buffer[12], buffer[13], buffer[14], buffer[15], buffer[16], buffer[17], buffer[18], buffer[19], buffer[20], buffer[21], buffer[22], buffer[23], buffer[24], buffer[25], buffer[26], buffer[27], buffer[28], buffer[29], buffer[30], buffer[31]);
|
||||||
|
|
||||||
if (!memcmp(buffer, "\211PNG\015\012\032\012\000\000\000\015IHDR", 16))
|
if (!memcmp(buffer, "\211PNG\015\012\032\012\000\000\000\015IHDR", 16))
|
||||||
{
|
{
|
||||||
// PNG image...
|
// PNG image...
|
||||||
@ -2606,8 +2484,198 @@ copy_png(pdfio_dict_t *dict, // I - Dictionary
|
|||||||
int fd) // I - File descriptor
|
int fd) // I - File descriptor
|
||||||
{
|
{
|
||||||
pdfio_obj_t *obj = NULL; // Object
|
pdfio_obj_t *obj = NULL; // Object
|
||||||
pdfio_stream_t *st = NULL; // Stream for PNG data
|
double gamma = 2.2, // Gamma value
|
||||||
|
wx = 0.0, wy = 0.0, // White point chromacity
|
||||||
|
rx = 0.0, ry = 0.0, // Red chromacity
|
||||||
|
gx = 0.0, gy = 0.0, // Green chromacity
|
||||||
|
bx = 0.0, by = 0.0; // Blue chromacity
|
||||||
|
#ifdef HAVE_LIBPNG
|
||||||
|
png_structp pp = NULL; // PNG read pointer
|
||||||
|
png_infop info = NULL; // PNG info pointers
|
||||||
|
png_bytep *rows = NULL; // PNG row pointers
|
||||||
|
unsigned char *pixels = NULL; // PNG image data
|
||||||
|
unsigned i, // Looping var
|
||||||
|
color_type, // PNG color mode
|
||||||
|
width, // Width in columns
|
||||||
|
height, // Height in lines
|
||||||
|
depth, // Bit depth
|
||||||
|
num_colors = 0, // Number of colors
|
||||||
|
linesize; // Bytes per line
|
||||||
|
bool alpha; // Alpha transparency?
|
||||||
|
png_color *palette; // Color palette information
|
||||||
|
int num_palette; // Number of colors
|
||||||
|
int num_trans; // Number of transparent colors
|
||||||
|
png_color_16 *trans; // Transparent colors
|
||||||
|
|
||||||
|
|
||||||
|
PDFIO_DEBUG("copy_png(dict=%p, fd=%d)\n", (void *)dict, fd);
|
||||||
|
|
||||||
|
// Allocate memory for PNG reader structures...
|
||||||
|
if ((pp = png_create_read_struct(PNG_LIBPNG_VER_STRING, (png_voidp)dict->pdf, png_error_func, png_error_func)) == NULL)
|
||||||
|
{
|
||||||
|
_pdfioFileError(dict->pdf, "Unable to allocate memory for PNG file: %s", strerror(errno));
|
||||||
|
goto finish_png;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((info = png_create_info_struct(pp)) == NULL)
|
||||||
|
{
|
||||||
|
_pdfioFileError(dict->pdf, "Unable to allocate memory for PNG file: %s", strerror(errno));
|
||||||
|
goto finish_png;
|
||||||
|
}
|
||||||
|
|
||||||
|
PDFIO_DEBUG("copy_png: pp=%p, info=%p\n", (void *)pp, (void *)info);
|
||||||
|
|
||||||
|
if (setjmp(png_jmpbuf(pp)))
|
||||||
|
{
|
||||||
|
// If we get here, PNG loading failed and any errors/warnings were logged
|
||||||
|
// via the corresponding callback functions...
|
||||||
|
fputs("copy_png: setjmp error handler called.\n", stderr);
|
||||||
|
goto finish_png;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set max image size to 16384x16384...
|
||||||
|
png_set_user_limits(pp, 16384, 16384);
|
||||||
|
|
||||||
|
// Read from the file descriptor...
|
||||||
|
png_set_read_fn(pp, &fd, png_read_func);
|
||||||
|
|
||||||
|
// Don't throw errors with "invalid" sRGB profiles produced by Adobe apps.
|
||||||
|
# if defined(PNG_SKIP_sRGB_CHECK_PROFILE) && defined(PNG_SET_OPTION_SUPPORTED)
|
||||||
|
png_set_option(pp, PNG_SKIP_sRGB_CHECK_PROFILE, PNG_OPTION_ON);
|
||||||
|
# endif // PNG_SKIP_sRGB_CHECK_PROFILE && PNG_SET_OPTION_SUPPORTED
|
||||||
|
|
||||||
|
// Get the image dimensions and depth...
|
||||||
|
png_read_info(pp, info);
|
||||||
|
|
||||||
|
width = png_get_image_width(pp, info);
|
||||||
|
height = png_get_image_height(pp, info);
|
||||||
|
depth = png_get_bit_depth(pp, info);
|
||||||
|
color_type = png_get_color_type(pp, info);
|
||||||
|
|
||||||
|
if (color_type & PNG_COLOR_MASK_PALETTE)
|
||||||
|
num_colors = 1;
|
||||||
|
else if (color_type & PNG_COLOR_MASK_COLOR)
|
||||||
|
num_colors = 3;
|
||||||
|
else
|
||||||
|
num_colors = 1;
|
||||||
|
|
||||||
|
PDFIO_DEBUG("copy_png: width=%u, height=%u, depth=%u, color_type=%u, num_colors=%d\n", width, height, depth, color_type, num_colors);
|
||||||
|
|
||||||
|
// Set decoding options...
|
||||||
|
alpha = (color_type & PNG_COLOR_MASK_ALPHA) != 0;
|
||||||
|
linesize = (width * num_colors * depth + 7) / 8;
|
||||||
|
if (alpha)
|
||||||
|
linesize += width;
|
||||||
|
|
||||||
|
PDFIO_DEBUG("copy_png: alpha=%s, linesize=%u\n", alpha ? "true" : "false", (unsigned)linesize);
|
||||||
|
|
||||||
|
// Allocate memory for the image...
|
||||||
|
if ((pixels = (unsigned char *)calloc(height, linesize)) == NULL)
|
||||||
|
{
|
||||||
|
_pdfioFileError(dict->pdf, "Unable to allocate memory for PNG image: %s", strerror(errno));
|
||||||
|
goto finish_png;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((rows = (png_bytep *)calloc((size_t)height, sizeof(png_bytep))) == NULL)
|
||||||
|
{
|
||||||
|
_pdfioFileError(dict->pdf, "Unable to allocate memory for PNG image: %s", strerror(errno));
|
||||||
|
goto finish_png;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < height; i ++)
|
||||||
|
rows[i] = pixels + i * linesize;
|
||||||
|
|
||||||
|
// Read the image...
|
||||||
|
for (i = png_set_interlace_handling(pp); i > 0; i --)
|
||||||
|
png_read_rows(pp, rows, NULL, (png_uint_32)height);
|
||||||
|
|
||||||
|
// Add image dictionary information...
|
||||||
|
pdfioDictSetNumber(dict, "Width", width);
|
||||||
|
pdfioDictSetNumber(dict, "Height", height);
|
||||||
|
pdfioDictSetNumber(dict, "BitsPerComponent", depth);
|
||||||
|
|
||||||
|
// Grab any color space/palette information...
|
||||||
|
if (png_get_PLTE(pp, info, &palette, &num_palette))
|
||||||
|
{
|
||||||
|
pdfioDictSetArray(dict, "ColorSpace", pdfioArrayCreateColorFromPalette(dict->pdf, num_palette, (unsigned char *)palette));
|
||||||
|
}
|
||||||
|
else if (png_get_cHRM(pp, info, &wx, &wy, &rx, &ry, &gx, &gy, &bx, &by) && png_get_gAMA(pp, info, &gamma))
|
||||||
|
{
|
||||||
|
pdfioDictSetArray(dict, "ColorSpace", pdfioArrayCreateColorFromPrimaries(dict->pdf, num_colors, gamma, wx, wy, rx, ry, gx, gy, bx, by));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Default to sRGB...
|
||||||
|
pdfioDictSetArray(dict, "ColorSpace", pdfioArrayCreateColorFromStandard(dict->pdf, num_colors, PDFIO_CS_SRGB));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (png_get_tRNS(pp, info, /*trans_alpha*/NULL, &num_trans, &trans))
|
||||||
|
{
|
||||||
|
int m; // Looping var
|
||||||
|
pdfio_array_t *mask; // Mask array
|
||||||
|
|
||||||
|
mask = pdfioArrayCreate(dict->pdf);
|
||||||
|
|
||||||
|
if (color_type & PNG_COLOR_MASK_PALETTE)
|
||||||
|
{
|
||||||
|
// List color indices that are transparent...
|
||||||
|
for (m = 0; m < num_trans; m ++)
|
||||||
|
{
|
||||||
|
pdfioArrayAppendNumber(mask, trans[m].index);
|
||||||
|
pdfioArrayAppendNumber(mask, trans[m].index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (num_colors == 1)
|
||||||
|
{
|
||||||
|
// List grayscale values that are transparent...
|
||||||
|
for (m = 0; m < num_trans; m ++)
|
||||||
|
{
|
||||||
|
pdfioArrayAppendNumber(mask, trans[m].gray >> (16 - depth));
|
||||||
|
pdfioArrayAppendNumber(mask, trans[m].gray >> (16 - depth));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// List RGB color values that are transparent...
|
||||||
|
for (m = 0; m < num_trans; m ++)
|
||||||
|
{
|
||||||
|
pdfioArrayAppendNumber(mask, trans[m].red >> (16 - depth));
|
||||||
|
pdfioArrayAppendNumber(mask, trans[m].green >> (16 - depth));
|
||||||
|
pdfioArrayAppendNumber(mask, trans[m].blue >> (16 - depth));
|
||||||
|
pdfioArrayAppendNumber(mask, trans[m].red >> (16 - depth));
|
||||||
|
pdfioArrayAppendNumber(mask, trans[m].green >> (16 - depth));
|
||||||
|
pdfioArrayAppendNumber(mask, trans[m].blue >> (16 - depth));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pdfioDictSetArray(dict, "Mask", mask);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create the image object...
|
||||||
|
obj = create_image(dict, pixels, width, height, depth, num_colors, alpha);
|
||||||
|
|
||||||
|
finish_png:
|
||||||
|
|
||||||
|
if (pp && info)
|
||||||
|
{
|
||||||
|
png_read_end(pp, info);
|
||||||
|
png_destroy_read_struct(&pp, &info, NULL);
|
||||||
|
|
||||||
|
pp = NULL;
|
||||||
|
info = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
free(pixels);
|
||||||
|
pixels = NULL;
|
||||||
|
|
||||||
|
free(rows);
|
||||||
|
rows = NULL;
|
||||||
|
|
||||||
|
return (obj);
|
||||||
|
|
||||||
|
#else
|
||||||
pdfio_dict_t *decode = NULL; // Parameters for PNG decode
|
pdfio_dict_t *decode = NULL; // Parameters for PNG decode
|
||||||
|
pdfio_stream_t *st = NULL; // Stream for PNG data
|
||||||
ssize_t bytes; // Bytes read
|
ssize_t bytes; // Bytes read
|
||||||
unsigned char buffer[16384]; // Read buffer
|
unsigned char buffer[16384]; // Read buffer
|
||||||
unsigned i, // Looping var
|
unsigned i, // Looping var
|
||||||
@ -2616,14 +2684,11 @@ copy_png(pdfio_dict_t *dict, // I - Dictionary
|
|||||||
crc, // CRC-32
|
crc, // CRC-32
|
||||||
temp, // Temporary value
|
temp, // Temporary value
|
||||||
width = 0, // Width
|
width = 0, // Width
|
||||||
height = 0; // Height
|
height = 0, // Height
|
||||||
|
num_colors = 0; // Number of colors
|
||||||
unsigned char bit_depth = 0, // Bit depth
|
unsigned char bit_depth = 0, // Bit depth
|
||||||
color_type = 0; // Color type
|
color_type = 0, // Color type
|
||||||
double gamma = 2.2, // Gamma value
|
interlace = 0; // Interlace type
|
||||||
wx = 0.0, wy = 0.0, // White point chromacity
|
|
||||||
rx = 0.0, ry = 0.0, // Red chromacity
|
|
||||||
gx = 0.0, gy = 0.0, // Green chromacity
|
|
||||||
bx = 0.0, by = 0.0; // Blue chromacity
|
|
||||||
pdfio_array_t *mask = NULL; // Color masking array
|
pdfio_array_t *mask = NULL; // Color masking array
|
||||||
|
|
||||||
|
|
||||||
@ -2727,18 +2792,55 @@ copy_png(pdfio_dict_t *dict, // I - Dictionary
|
|||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
crc = update_png_crc(crc, buffer, length);
|
crc = update_png_crc(crc, buffer, length);
|
||||||
width = (unsigned)((buffer[0] << 24) | (buffer[1] << 16) | (buffer[2] << 8) | buffer[3]);
|
width = (unsigned)((buffer[0] << 24) | (buffer[1] << 16) | (buffer[2] << 8) | buffer[3]);
|
||||||
height = (unsigned)((buffer[4] << 24) | (buffer[5] << 16) | (buffer[6] << 8) | buffer[7]);
|
height = (unsigned)((buffer[4] << 24) | (buffer[5] << 16) | (buffer[6] << 8) | buffer[7]);
|
||||||
bit_depth = buffer[8];
|
|
||||||
color_type = buffer[9];
|
|
||||||
|
|
||||||
if (width == 0 || height == 0 || (bit_depth != 1 && bit_depth != 2 && bit_depth != 4 && bit_depth != 8 && bit_depth != 16) || (color_type != _PDFIO_PNG_TYPE_GRAY && color_type != _PDFIO_PNG_TYPE_RGB && color_type != _PDFIO_PNG_TYPE_INDEXED) || buffer[10] || buffer[11] || buffer[12])
|
if (width == 0 || height == 0)
|
||||||
{
|
{
|
||||||
_pdfioFileError(dict->pdf, "Unsupported PNG image.");
|
_pdfioFileError(dict->pdf, "Unsupported PNG dimensions %ux%u.", (unsigned)width, (unsigned)height);
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bit_depth = buffer[8];
|
||||||
|
color_type = buffer[9];
|
||||||
|
|
||||||
|
if (color_type != _PDFIO_PNG_TYPE_GRAY && color_type != _PDFIO_PNG_TYPE_RGB && color_type != _PDFIO_PNG_TYPE_INDEXED)
|
||||||
|
{
|
||||||
|
_pdfioFileError(dict->pdf, "Unsupported PNG color type %u.", color_type);
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((color_type == _PDFIO_PNG_TYPE_GRAY && bit_depth != 1 && bit_depth != 2 && bit_depth != 4 && bit_depth != 8 && bit_depth != 16) ||
|
||||||
|
(color_type == _PDFIO_PNG_TYPE_RGB && bit_depth != 8 && bit_depth != 16) ||
|
||||||
|
(color_type == _PDFIO_PNG_TYPE_INDEXED && bit_depth != 1 && bit_depth != 2 && bit_depth != 4 && bit_depth != 8))
|
||||||
|
{
|
||||||
|
_pdfioFileError(dict->pdf, "Unsupported PNG bit depth %u for color type %u.", bit_depth, color_type);
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (buffer[10] != _PDFIO_PNG_COMPRESSION_FLATE)
|
||||||
|
{
|
||||||
|
_pdfioFileError(dict->pdf, "Unsupported PNG compression %u.", buffer[10]);
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (buffer[11] != _PDFIO_PNG_FILTER_ADAPTIVE)
|
||||||
|
{
|
||||||
|
_pdfioFileError(dict->pdf, "Unsupported PNG filtering %u.", buffer[11]);
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
interlace = buffer[12];
|
||||||
|
|
||||||
|
if (interlace != _PDFIO_PNG_INTERLACE_NONE)
|
||||||
|
{
|
||||||
|
_pdfioFileError(dict->pdf, "Unsupported PNG interlacing %u.", interlace);
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
num_colors = color_type == _PDFIO_PNG_TYPE_RGB ? 3 : 1;
|
||||||
|
|
||||||
pdfioDictSetNumber(dict, "Width", width);
|
pdfioDictSetNumber(dict, "Width", width);
|
||||||
pdfioDictSetNumber(dict, "Height", height);
|
pdfioDictSetNumber(dict, "Height", height);
|
||||||
pdfioDictSetNumber(dict, "BitsPerComponent", bit_depth);
|
pdfioDictSetNumber(dict, "BitsPerComponent", bit_depth);
|
||||||
@ -2748,7 +2850,7 @@ copy_png(pdfio_dict_t *dict, // I - Dictionary
|
|||||||
return (NULL);
|
return (NULL);
|
||||||
|
|
||||||
pdfioDictSetNumber(decode, "BitsPerComponent", bit_depth);
|
pdfioDictSetNumber(decode, "BitsPerComponent", bit_depth);
|
||||||
pdfioDictSetNumber(decode, "Colors", color_type == _PDFIO_PNG_TYPE_RGB ? 3 : 1);
|
pdfioDictSetNumber(decode, "Colors", num_colors);
|
||||||
pdfioDictSetNumber(decode, "Columns", width);
|
pdfioDictSetNumber(decode, "Columns", width);
|
||||||
pdfioDictSetNumber(decode, "Predictor", _PDFIO_PREDICTOR_PNG_AUTO);
|
pdfioDictSetNumber(decode, "Predictor", _PDFIO_PREDICTOR_PNG_AUTO);
|
||||||
pdfioDictSetDict(dict, "DecodeParms", decode);
|
pdfioDictSetDict(dict, "DecodeParms", decode);
|
||||||
@ -2948,6 +3050,7 @@ copy_png(pdfio_dict_t *dict, // I - Dictionary
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
#endif // HAVE_LIBPNG
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -3227,6 +3330,210 @@ create_cp1252(pdfio_file_t *pdf) // I - PDF file
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// 'create_image()' - Create an image object from some data.
|
||||||
|
//
|
||||||
|
|
||||||
|
static pdfio_obj_t * // O - PDF object or `NULL` on error
|
||||||
|
create_image(
|
||||||
|
pdfio_dict_t *dict, // I - Image dictionary
|
||||||
|
const unsigned char *data, // I - Image data
|
||||||
|
size_t width, // I - Width in columns
|
||||||
|
size_t height, // I - Height in lines
|
||||||
|
size_t depth, // I - Bit depth
|
||||||
|
size_t num_colors, // I - Number of colors
|
||||||
|
bool alpha) // I - `true` if there is transparency
|
||||||
|
{
|
||||||
|
pdfio_file_t *pdf = dict->pdf;
|
||||||
|
// PDF file
|
||||||
|
pdfio_dict_t *mask_dict, // Mask image dictionary
|
||||||
|
*decode; // DecodeParms dictionary
|
||||||
|
pdfio_obj_t *obj, // Image object
|
||||||
|
*mask_obj = NULL;
|
||||||
|
// Mask image object, if any
|
||||||
|
pdfio_stream_t *st; // Image stream
|
||||||
|
size_t x, y, // X and Y position in image
|
||||||
|
bpc = depth / 8,// Bytes per component
|
||||||
|
bpp = num_colors * bpc,
|
||||||
|
// Bytes per pixel (less alpha)
|
||||||
|
linelen; // Line length
|
||||||
|
const unsigned char *dataptr; // Pointer into image data
|
||||||
|
unsigned char *line = NULL, // Current line
|
||||||
|
*lineptr; // Pointer into line
|
||||||
|
|
||||||
|
|
||||||
|
// Allocate memory for one line of data...
|
||||||
|
linelen = (width * num_colors * depth + 7) / 8;
|
||||||
|
|
||||||
|
if ((line = malloc(linelen)) == NULL)
|
||||||
|
return (NULL);
|
||||||
|
|
||||||
|
// Use Flate compression...
|
||||||
|
pdfioDictSetName(dict, "Filter", "FlateDecode");
|
||||||
|
|
||||||
|
// Generate a mask image, as needed...
|
||||||
|
if (alpha)
|
||||||
|
{
|
||||||
|
// Create the image mask dictionary...
|
||||||
|
if ((mask_dict = pdfioDictCopy(pdf, dict)) == NULL)
|
||||||
|
{
|
||||||
|
free(line);
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Transparency masks are always grayscale...
|
||||||
|
pdfioDictSetName(mask_dict, "ColorSpace", "DeviceGray");
|
||||||
|
|
||||||
|
// Set the automatic PNG predictor to optimize compression...
|
||||||
|
if ((decode = pdfioDictCreate(pdf)) == NULL)
|
||||||
|
{
|
||||||
|
free(line);
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
pdfioDictSetNumber(decode, "BitsPerComponent", depth);
|
||||||
|
pdfioDictSetNumber(decode, "Colors", 1);
|
||||||
|
pdfioDictSetNumber(decode, "Columns", width);
|
||||||
|
pdfioDictSetNumber(decode, "Predictor", _PDFIO_PREDICTOR_PNG_AUTO);
|
||||||
|
pdfioDictSetDict(mask_dict, "DecodeParms", decode);
|
||||||
|
|
||||||
|
// Create the mask object and write the mask image...
|
||||||
|
if ((mask_obj = pdfioFileCreateObj(pdf, mask_dict)) == NULL)
|
||||||
|
{
|
||||||
|
free(line);
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((st = pdfioObjCreateStream(mask_obj, PDFIO_FILTER_FLATE)) == NULL)
|
||||||
|
{
|
||||||
|
free(line);
|
||||||
|
pdfioObjClose(mask_obj);
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (y = height, dataptr = data + bpp; y > 0; y --)
|
||||||
|
{
|
||||||
|
if (bpc == 1)
|
||||||
|
{
|
||||||
|
for (x = width, lineptr = line; x > 0; x --, dataptr += bpp)
|
||||||
|
*lineptr++ = *dataptr++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (x = width, lineptr = line; x > 0; x --, dataptr += bpp)
|
||||||
|
{
|
||||||
|
*lineptr++ = *dataptr++;
|
||||||
|
*lineptr++ = *dataptr++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pdfioStreamWrite(st, line, width * bpc);
|
||||||
|
}
|
||||||
|
|
||||||
|
pdfioStreamClose(st);
|
||||||
|
|
||||||
|
// Use the transparency mask...
|
||||||
|
pdfioDictSetObj(dict, "SMask", mask_obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the automatic PNG predictor to optimize compression...
|
||||||
|
if ((decode = pdfioDictCreate(pdf)) == NULL)
|
||||||
|
{
|
||||||
|
free(line);
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
pdfioDictSetNumber(decode, "BitsPerComponent", depth);
|
||||||
|
pdfioDictSetNumber(decode, "Colors", num_colors);
|
||||||
|
pdfioDictSetNumber(decode, "Columns", width);
|
||||||
|
pdfioDictSetNumber(decode, "Predictor", _PDFIO_PREDICTOR_PNG_AUTO);
|
||||||
|
pdfioDictSetDict(dict, "DecodeParms", decode);
|
||||||
|
|
||||||
|
// Now create the image...
|
||||||
|
if ((obj = pdfioFileCreateObj(pdf, dict)) == NULL)
|
||||||
|
{
|
||||||
|
free(line);
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((st = pdfioObjCreateStream(obj, PDFIO_FILTER_FLATE)) == NULL)
|
||||||
|
{
|
||||||
|
free(line);
|
||||||
|
pdfioObjClose(obj);
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (y = height, dataptr = data; y > 0; y --)
|
||||||
|
{
|
||||||
|
if (alpha)
|
||||||
|
{
|
||||||
|
if (bpp == 1)
|
||||||
|
{
|
||||||
|
for (x = width, lineptr = line; x > 0; x --, dataptr += bpc)
|
||||||
|
*lineptr++ = *dataptr++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (x = width, lineptr = line; x > 0; x --, dataptr += bpp + bpc, lineptr += bpp)
|
||||||
|
memcpy(lineptr, dataptr, bpp);
|
||||||
|
}
|
||||||
|
|
||||||
|
pdfioStreamWrite(st, line, linelen);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pdfioStreamWrite(st, dataptr, linelen);
|
||||||
|
dataptr += linelen;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
free(line);
|
||||||
|
pdfioStreamClose(st);
|
||||||
|
|
||||||
|
return (obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBPNG
|
||||||
|
//
|
||||||
|
// 'png_error_func()' - PNG error message function.
|
||||||
|
//
|
||||||
|
|
||||||
|
static void
|
||||||
|
png_error_func(
|
||||||
|
png_structp pp, // I - PNG pointer
|
||||||
|
png_const_charp message) // I - Error message
|
||||||
|
{
|
||||||
|
pdfio_file_t *pdf = (pdfio_file_t *)png_get_error_ptr(pp);
|
||||||
|
// PDF file
|
||||||
|
|
||||||
|
|
||||||
|
_pdfioFileError(pdf, "Unable to create image object from PNG file: %s", message);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// 'png_read_func()' - Read from a PNG file.
|
||||||
|
//
|
||||||
|
|
||||||
|
static void
|
||||||
|
png_read_func(png_structp pp, // I - PNG pointer
|
||||||
|
png_bytep data, // I - Read buffer
|
||||||
|
size_t length) // I - Number of bytes to read
|
||||||
|
{
|
||||||
|
int *fd = (int *)png_get_io_ptr(pp);
|
||||||
|
// Pointer to file descriptor
|
||||||
|
ssize_t bytes; // Bytes read
|
||||||
|
|
||||||
|
|
||||||
|
PDFIO_DEBUG("png_read_func(pp=%p, data=%p, length=%lu)\n", (void *)pp, (void *)data, (unsigned long)length);
|
||||||
|
|
||||||
|
if ((bytes = read(*fd, data, length)) < (ssize_t)length)
|
||||||
|
png_error(pp, "Unable to read from PNG file.");
|
||||||
|
}
|
||||||
|
#endif // HAVE_LIBPNG
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// 'ttf_error_cb()' - Relay a message from the TTF functions.
|
// 'ttf_error_cb()' - Relay a message from the TTF functions.
|
||||||
//
|
//
|
||||||
@ -3239,6 +3546,7 @@ ttf_error_cb(pdfio_file_t *pdf, // I - PDF file
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef HAVE_LIBPNG
|
||||||
//
|
//
|
||||||
// 'update_png_crc()' - Update the CRC-32 value for a PNG chunk.
|
// 'update_png_crc()' - Update the CRC-32 value for a PNG chunk.
|
||||||
//
|
//
|
||||||
@ -3258,6 +3566,7 @@ update_png_crc(
|
|||||||
|
|
||||||
return (crc);
|
return (crc);
|
||||||
}
|
}
|
||||||
|
#endif // !HAVE_LIBPNG
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
|
130
pdfio-dict.c
@ -465,10 +465,134 @@ pdfioDictGetString(pdfio_dict_t *dict, // I - Dictionary
|
|||||||
else if (value && value->type == PDFIO_VALTYPE_BINARY && value->value.binary.datalen < 4096)
|
else if (value && value->type == PDFIO_VALTYPE_BINARY && value->value.binary.datalen < 4096)
|
||||||
{
|
{
|
||||||
// Convert binary string to regular string...
|
// Convert binary string to regular string...
|
||||||
char temp[4096]; // Temporary string
|
char temp[4096], // Temporary string
|
||||||
|
*tempptr; // Pointer into temporary string
|
||||||
|
unsigned char *dataptr; // Pointer into the data string
|
||||||
|
|
||||||
memcpy(temp, value->value.binary.data, value->value.binary.datalen);
|
if (!(value->value.binary.datalen & 1) && !memcmp(value->value.binary.data, "\377\376", 2))
|
||||||
temp[value->value.binary.datalen] = '\0';
|
{
|
||||||
|
// Copy UTF-16 BE
|
||||||
|
int ch; // Unicode character
|
||||||
|
size_t remaining; // Remaining bytes
|
||||||
|
|
||||||
|
for (dataptr = value->value.binary.data + 2, remaining = value->value.binary.datalen - 2, tempptr = temp; remaining > 1 && tempptr < (temp + sizeof(temp) - 5); dataptr += 2, remaining -= 2)
|
||||||
|
{
|
||||||
|
ch = (dataptr[0] << 8) | dataptr[1];
|
||||||
|
|
||||||
|
if (ch >= 0xd800 && ch <= 0xdbff && remaining > 3)
|
||||||
|
{
|
||||||
|
// Multi-word UTF-16 char...
|
||||||
|
int lch; // Lower bits
|
||||||
|
|
||||||
|
lch = (dataptr[2] << 8) | dataptr[3];
|
||||||
|
|
||||||
|
if (lch < 0xdc00 || lch >= 0xdfff)
|
||||||
|
break;
|
||||||
|
|
||||||
|
ch = (((ch & 0x3ff) << 10) | (lch & 0x3ff)) + 0x10000;
|
||||||
|
dataptr += 2;
|
||||||
|
remaining -= 2;
|
||||||
|
}
|
||||||
|
else if (ch >= 0xfffe)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ch < 128)
|
||||||
|
{
|
||||||
|
// ASCII
|
||||||
|
*tempptr++ = (char)ch;
|
||||||
|
}
|
||||||
|
else if (ch < 4096)
|
||||||
|
{
|
||||||
|
// 2-byte UTF-8
|
||||||
|
*tempptr++ = (char)(0xc0 | (ch >> 6));
|
||||||
|
*tempptr++ = (char)(0x80 | (ch & 0x3f));
|
||||||
|
}
|
||||||
|
else if (ch < 65536)
|
||||||
|
{
|
||||||
|
// 3-byte UTF-8
|
||||||
|
*tempptr++ = (char)(0xe0 | (ch >> 12));
|
||||||
|
*tempptr++ = (char)(0x80 | ((ch >> 6) & 0x3f));
|
||||||
|
*tempptr++ = (char)(0x80 | (ch & 0x3f));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 4-byte UTF-8
|
||||||
|
*tempptr++ = (char)(0xe0 | (ch >> 18));
|
||||||
|
*tempptr++ = (char)(0x80 | ((ch >> 12) & 0x3f));
|
||||||
|
*tempptr++ = (char)(0x80 | ((ch >> 6) & 0x3f));
|
||||||
|
*tempptr++ = (char)(0x80 | (ch & 0x3f));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
*tempptr = '\0';
|
||||||
|
}
|
||||||
|
else if (!(value->value.binary.datalen & 1) && !memcmp(value->value.binary.data, "\376\377", 2))
|
||||||
|
{
|
||||||
|
// Copy UTF-16 LE
|
||||||
|
int ch; // Unicode character
|
||||||
|
size_t remaining; // Remaining bytes
|
||||||
|
|
||||||
|
for (dataptr = value->value.binary.data + 2, remaining = value->value.binary.datalen - 2, tempptr = temp; remaining > 1 && tempptr < (temp + sizeof(temp) - 5); dataptr += 2, remaining -= 2)
|
||||||
|
{
|
||||||
|
ch = (dataptr[1] << 8) | dataptr[0];
|
||||||
|
|
||||||
|
if (ch >= 0xd800 && ch <= 0xdbff && remaining > 3)
|
||||||
|
{
|
||||||
|
// Multi-word UTF-16 char...
|
||||||
|
int lch; // Lower bits
|
||||||
|
|
||||||
|
lch = (dataptr[3] << 8) | dataptr[2];
|
||||||
|
|
||||||
|
if (lch < 0xdc00 || lch >= 0xdfff)
|
||||||
|
break;
|
||||||
|
|
||||||
|
ch = (((ch & 0x3ff) << 10) | (lch & 0x3ff)) + 0x10000;
|
||||||
|
dataptr += 2;
|
||||||
|
remaining -= 2;
|
||||||
|
}
|
||||||
|
else if (ch >= 0xfffe)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ch < 128)
|
||||||
|
{
|
||||||
|
// ASCII
|
||||||
|
*tempptr++ = (char)ch;
|
||||||
|
}
|
||||||
|
else if (ch < 4096)
|
||||||
|
{
|
||||||
|
// 2-byte UTF-8
|
||||||
|
*tempptr++ = (char)(0xc0 | (ch >> 6));
|
||||||
|
*tempptr++ = (char)(0x80 | (ch & 0x3f));
|
||||||
|
}
|
||||||
|
else if (ch < 65536)
|
||||||
|
{
|
||||||
|
// 3-byte UTF-8
|
||||||
|
*tempptr++ = (char)(0xe0 | (ch >> 12));
|
||||||
|
*tempptr++ = (char)(0x80 | ((ch >> 6) & 0x3f));
|
||||||
|
*tempptr++ = (char)(0x80 | (ch & 0x3f));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 4-byte UTF-8
|
||||||
|
*tempptr++ = (char)(0xe0 | (ch >> 18));
|
||||||
|
*tempptr++ = (char)(0x80 | ((ch >> 12) & 0x3f));
|
||||||
|
*tempptr++ = (char)(0x80 | ((ch >> 6) & 0x3f));
|
||||||
|
*tempptr++ = (char)(0x80 | (ch & 0x3f));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
*tempptr = '\0';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Copy as-is...
|
||||||
|
memcpy(temp, value->value.binary.data, value->value.binary.datalen);
|
||||||
|
temp[value->value.binary.datalen] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
free(value->value.binary.data);
|
free(value->value.binary.data);
|
||||||
value->type = PDFIO_VALTYPE_STRING;
|
value->type = PDFIO_VALTYPE_STRING;
|
||||||
|
22
pdfio-file.c
@ -1529,6 +1529,7 @@ load_obj_stream(pdfio_obj_t *obj) // I - Object to load
|
|||||||
cur_obj, // Current object
|
cur_obj, // Current object
|
||||||
num_objs = 0; // Number of objects
|
num_objs = 0; // Number of objects
|
||||||
pdfio_obj_t *objs[16384]; // Objects
|
pdfio_obj_t *objs[16384]; // Objects
|
||||||
|
int count; // Count of objects
|
||||||
|
|
||||||
|
|
||||||
PDFIO_DEBUG("load_obj_stream(obj=%p(%d))\n", obj, (int)obj->number);
|
PDFIO_DEBUG("load_obj_stream(obj=%p(%d))\n", obj, (int)obj->number);
|
||||||
@ -1540,12 +1541,17 @@ load_obj_stream(pdfio_obj_t *obj) // I - Object to load
|
|||||||
return (false);
|
return (false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
count = (int)pdfioDictGetNumber(pdfioObjGetDict(obj), "N");
|
||||||
|
|
||||||
|
PDFIO_DEBUG("load_obj_stream: N=%d\n", count);
|
||||||
|
|
||||||
_pdfioTokenInit(&tb, obj->pdf, (_pdfio_tconsume_cb_t)pdfioStreamConsume, (_pdfio_tpeek_cb_t)pdfioStreamPeek, st);
|
_pdfioTokenInit(&tb, obj->pdf, (_pdfio_tconsume_cb_t)pdfioStreamConsume, (_pdfio_tpeek_cb_t)pdfioStreamPeek, st);
|
||||||
|
|
||||||
// Read the object numbers from the beginning of the stream...
|
// Read the object numbers from the beginning of the stream...
|
||||||
while (_pdfioTokenGet(&tb, buffer, sizeof(buffer)))
|
while (count > 0 && _pdfioTokenGet(&tb, buffer, sizeof(buffer)))
|
||||||
{
|
{
|
||||||
// Stop if this isn't an object number...
|
// Stop if this isn't an object number...
|
||||||
|
PDFIO_DEBUG("load_obj_stream: %s\n", buffer);
|
||||||
if (!isdigit(buffer[0] & 255))
|
if (!isdigit(buffer[0] & 255))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1568,21 +1574,19 @@ load_obj_stream(pdfio_obj_t *obj) // I - Object to load
|
|||||||
// Skip offset
|
// Skip offset
|
||||||
_pdfioTokenGet(&tb, buffer, sizeof(buffer));
|
_pdfioTokenGet(&tb, buffer, sizeof(buffer));
|
||||||
PDFIO_DEBUG("load_obj_stream: %ld at offset %s\n", (long)number, buffer);
|
PDFIO_DEBUG("load_obj_stream: %ld at offset %s\n", (long)number, buffer);
|
||||||
|
|
||||||
|
// One less compressed object...
|
||||||
|
count --;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!buffer[0])
|
PDFIO_DEBUG("load_obj_stream: num_objs=%lu\n", (unsigned long)num_objs);
|
||||||
{
|
|
||||||
pdfioStreamClose(st);
|
|
||||||
return (false);
|
|
||||||
}
|
|
||||||
|
|
||||||
_pdfioTokenPush(&tb, buffer);
|
|
||||||
|
|
||||||
// Read the objects themselves...
|
// Read the objects themselves...
|
||||||
for (cur_obj = 0; cur_obj < num_objs; cur_obj ++)
|
for (cur_obj = 0; cur_obj < num_objs; cur_obj ++)
|
||||||
{
|
{
|
||||||
if (!_pdfioValueRead(obj->pdf, obj, &tb, &(objs[cur_obj]->value), 0))
|
if (!_pdfioValueRead(obj->pdf, obj, &tb, &(objs[cur_obj]->value), 0))
|
||||||
{
|
{
|
||||||
|
_pdfioFileError(obj->pdf, "Unable to read compressed object.");
|
||||||
pdfioStreamClose(st);
|
pdfioStreamClose(st);
|
||||||
return (false);
|
return (false);
|
||||||
}
|
}
|
||||||
@ -1732,7 +1736,7 @@ load_xref(
|
|||||||
pdfio_stream_t *st; // Stream
|
pdfio_stream_t *st; // Stream
|
||||||
unsigned char buffer[32]; // Read buffer
|
unsigned char buffer[32]; // Read buffer
|
||||||
size_t num_sobjs = 0, // Number of object streams
|
size_t num_sobjs = 0, // Number of object streams
|
||||||
sobjs[8192]; // Object streams to load
|
sobjs[16384]; // Object streams to load
|
||||||
pdfio_obj_t *current; // Current object
|
pdfio_obj_t *current; // Current object
|
||||||
|
|
||||||
if ((number = strtoimax(line, &ptr, 10)) < 1)
|
if ((number = strtoimax(line, &ptr, 10)) < 1)
|
||||||
|
4
pdfio.h
@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// Public header file for PDFio.
|
// Public header file for PDFio.
|
||||||
//
|
//
|
||||||
// Copyright © 2021-2024 by Michael R Sweet.
|
// Copyright © 2021-2025 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.
|
||||||
@ -23,7 +23,7 @@ extern "C" {
|
|||||||
// Version number...
|
// Version number...
|
||||||
//
|
//
|
||||||
|
|
||||||
# define PDFIO_VERSION "1.4.0"
|
# define PDFIO_VERSION "1.4.1"
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -172,6 +172,8 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<ImportGroup Label="ExtensionTargets">
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
<Import Project="packages\libpng_native.redist.1.6.30\build\native\libpng_native.redist.targets" Condition="Exists('packages\libpng_native.redist.1.6.30\build\native\libpng_native.redist.targets')" />
|
||||||
|
<Import Project="packages\libpng_native.1.6.30\build\native\libpng_native.targets" Condition="Exists('packages\libpng_native.1.6.30\build\native\libpng_native.targets')" />
|
||||||
<Import Project="packages\zlib_native.redist.1.2.11\build\native\zlib_native.redist.targets" Condition="Exists('packages\zlib_native.redist.1.2.11\build\native\zlib_native.redist.targets')" />
|
<Import Project="packages\zlib_native.redist.1.2.11\build\native\zlib_native.redist.targets" Condition="Exists('packages\zlib_native.redist.1.2.11\build\native\zlib_native.redist.targets')" />
|
||||||
<Import Project="packages\zlib_native.1.2.11\build\native\zlib_native.targets" Condition="Exists('packages\zlib_native.1.2.11\build\native\zlib_native.targets')" />
|
<Import Project="packages\zlib_native.1.2.11\build\native\zlib_native.targets" Condition="Exists('packages\zlib_native.1.2.11\build\native\zlib_native.targets')" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
|
@ -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.4.1</version>
|
<version>1.5.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-2025 by Michael R Sweet</copyright>
|
<copyright>Copyright © 2019-2025 by Michael R Sweet</copyright>
|
||||||
<tags>pdf file native</tags>
|
<tags>pdf file native</tags>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency id="pdfio_native.redist" version="1.4.1" />
|
<dependency id="pdfio_native.redist" version="1.5.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.4.1</version>
|
<version>1.5.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>
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
https://www.color.org/chardata/rgb/rommrgb.xalter
|
||||||
|
|
||||||
|
Copyright © 2006 Hewlett-Packard
|
||||||
|
|
||||||
Terms of use
|
Terms of use
|
||||||
|
|
||||||
This profile is made available by ICC, and may be copied, distributed, embedded, made, used, and sold without restriction. Altered versions of this profile shall have the original identification and copyright information removed and shall not be misrepresented as the original profile.
|
This profile is made available by ICC, and may be copied, distributed, embedded, made, used, and sold without restriction. Altered versions of this profile shall have the original identification and copyright information removed and shall not be misrepresented as the original profile.
|
||||||
|
9
testfiles/pngsuite-LICENSE.txt
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
PngSuite
|
||||||
|
--------
|
||||||
|
|
||||||
|
Permission to use, copy, modify and distribute these images for any
|
||||||
|
purpose and without fee is hereby granted.
|
||||||
|
|
||||||
|
|
||||||
|
(c) Willem van Schaik, 1996, 2011
|
||||||
|
|
BIN
testfiles/pngsuite/basi0g01.png
Normal file
After Width: | Height: | Size: 217 B |
BIN
testfiles/pngsuite/basi0g02.png
Normal file
After Width: | Height: | Size: 154 B |
BIN
testfiles/pngsuite/basi0g04.png
Normal file
After Width: | Height: | Size: 247 B |
BIN
testfiles/pngsuite/basi0g08.png
Normal file
After Width: | Height: | Size: 254 B |
BIN
testfiles/pngsuite/basi2c08.png
Normal file
After Width: | Height: | Size: 315 B |
BIN
testfiles/pngsuite/basi3p01.png
Normal file
After Width: | Height: | Size: 132 B |
BIN
testfiles/pngsuite/basi3p02.png
Normal file
After Width: | Height: | Size: 193 B |
BIN
testfiles/pngsuite/basi3p04.png
Normal file
After Width: | Height: | Size: 327 B |
BIN
testfiles/pngsuite/basi3p08.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
testfiles/pngsuite/basi4a08.png
Normal file
After Width: | Height: | Size: 214 B |
BIN
testfiles/pngsuite/basi6a08.png
Normal file
After Width: | Height: | Size: 361 B |
BIN
testfiles/pngsuite/basn0g01.png
Normal file
After Width: | Height: | Size: 164 B |
BIN
testfiles/pngsuite/basn0g02.png
Normal file
After Width: | Height: | Size: 104 B |
BIN
testfiles/pngsuite/basn0g04.png
Normal file
After Width: | Height: | Size: 145 B |
BIN
testfiles/pngsuite/basn0g08.png
Normal file
After Width: | Height: | Size: 138 B |
BIN
testfiles/pngsuite/basn2c08.png
Normal file
After Width: | Height: | Size: 145 B |
BIN
testfiles/pngsuite/basn3p01.png
Normal file
After Width: | Height: | Size: 112 B |
BIN
testfiles/pngsuite/basn3p02.png
Normal file
After Width: | Height: | Size: 146 B |
BIN
testfiles/pngsuite/basn3p04.png
Normal file
After Width: | Height: | Size: 216 B |
BIN
testfiles/pngsuite/basn3p08.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
testfiles/pngsuite/basn4a08.png
Normal file
After Width: | Height: | Size: 126 B |
BIN
testfiles/pngsuite/basn6a08.png
Normal file
After Width: | Height: | Size: 184 B |
BIN
testfiles/pngsuite/exif2c08.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
testfiles/pngsuite/g03n2c08.png
Normal file
After Width: | Height: | Size: 370 B |
BIN
testfiles/pngsuite/g03n3p04.png
Normal file
After Width: | Height: | Size: 214 B |
BIN
testfiles/pngsuite/g04n2c08.png
Normal file
After Width: | Height: | Size: 377 B |
BIN
testfiles/pngsuite/g04n3p04.png
Normal file
After Width: | Height: | Size: 219 B |
BIN
testfiles/pngsuite/g05n2c08.png
Normal file
After Width: | Height: | Size: 350 B |
BIN
testfiles/pngsuite/g05n3p04.png
Normal file
After Width: | Height: | Size: 206 B |
BIN
testfiles/pngsuite/g07n2c08.png
Normal file
After Width: | Height: | Size: 340 B |
BIN
testfiles/pngsuite/g07n3p04.png
Normal file
After Width: | Height: | Size: 207 B |
BIN
testfiles/pngsuite/g10n2c08.png
Normal file
After Width: | Height: | Size: 285 B |
BIN
testfiles/pngsuite/g10n3p04.png
Normal file
After Width: | Height: | Size: 214 B |
BIN
testfiles/pngsuite/g25n2c08.png
Normal file
After Width: | Height: | Size: 405 B |
BIN
testfiles/pngsuite/g25n3p04.png
Normal file
After Width: | Height: | Size: 215 B |
BIN
testfiles/pngsuite/s02i3p01.png
Normal file
After Width: | Height: | Size: 114 B |
BIN
testfiles/pngsuite/s02n3p01.png
Normal file
After Width: | Height: | Size: 115 B |
BIN
testfiles/pngsuite/s03i3p01.png
Normal file
After Width: | Height: | Size: 118 B |
BIN
testfiles/pngsuite/s03n3p01.png
Normal file
After Width: | Height: | Size: 120 B |
BIN
testfiles/pngsuite/s04i3p01.png
Normal file
After Width: | Height: | Size: 126 B |
BIN
testfiles/pngsuite/s04n3p01.png
Normal file
After Width: | Height: | Size: 121 B |
BIN
testfiles/pngsuite/s05i3p02.png
Normal file
After Width: | Height: | Size: 134 B |
BIN
testfiles/pngsuite/s05n3p02.png
Normal file
After Width: | Height: | Size: 129 B |
BIN
testfiles/pngsuite/s06i3p02.png
Normal file
After Width: | Height: | Size: 143 B |
BIN
testfiles/pngsuite/s06n3p02.png
Normal file
After Width: | Height: | Size: 131 B |
BIN
testfiles/pngsuite/s07i3p02.png
Normal file
After Width: | Height: | Size: 149 B |
BIN
testfiles/pngsuite/s07n3p02.png
Normal file
After Width: | Height: | Size: 138 B |
BIN
testfiles/pngsuite/s08i3p02.png
Normal file
After Width: | Height: | Size: 149 B |
BIN
testfiles/pngsuite/s08n3p02.png
Normal file
After Width: | Height: | Size: 139 B |
BIN
testfiles/pngsuite/s09i3p02.png
Normal file
After Width: | Height: | Size: 147 B |
BIN
testfiles/pngsuite/s09n3p02.png
Normal file
After Width: | Height: | Size: 143 B |
BIN
testfiles/pngsuite/s32i3p04.png
Normal file
After Width: | Height: | Size: 355 B |
BIN
testfiles/pngsuite/s32n3p04.png
Normal file
After Width: | Height: | Size: 263 B |
BIN
testfiles/pngsuite/s33i3p04.png
Normal file
After Width: | Height: | Size: 385 B |
BIN
testfiles/pngsuite/s33n3p04.png
Normal file
After Width: | Height: | Size: 329 B |
BIN
testfiles/pngsuite/s34i3p04.png
Normal file
After Width: | Height: | Size: 349 B |
BIN
testfiles/pngsuite/s34n3p04.png
Normal file
After Width: | Height: | Size: 248 B |
BIN
testfiles/pngsuite/s35i3p04.png
Normal file
After Width: | Height: | Size: 399 B |
BIN
testfiles/pngsuite/s35n3p04.png
Normal file
After Width: | Height: | Size: 338 B |
BIN
testfiles/pngsuite/s36i3p04.png
Normal file
After Width: | Height: | Size: 356 B |
BIN
testfiles/pngsuite/s36n3p04.png
Normal file
After Width: | Height: | Size: 258 B |
BIN
testfiles/pngsuite/s37i3p04.png
Normal file
After Width: | Height: | Size: 393 B |
BIN
testfiles/pngsuite/s37n3p04.png
Normal file
After Width: | Height: | Size: 336 B |
BIN
testfiles/pngsuite/s38i3p04.png
Normal file
After Width: | Height: | Size: 357 B |
BIN
testfiles/pngsuite/s38n3p04.png
Normal file
After Width: | Height: | Size: 245 B |
BIN
testfiles/pngsuite/s39i3p04.png
Normal file
After Width: | Height: | Size: 420 B |
BIN
testfiles/pngsuite/s39n3p04.png
Normal file
After Width: | Height: | Size: 352 B |
BIN
testfiles/pngsuite/s40i3p04.png
Normal file
After Width: | Height: | Size: 357 B |
BIN
testfiles/pngsuite/s40n3p04.png
Normal file
After Width: | Height: | Size: 256 B |
BIN
testfiles/pngsuite/tbbn0g04.png
Normal file
After Width: | Height: | Size: 429 B |
BIN
testfiles/pngsuite/tbbn3p08.png
Normal file
After Width: | Height: | Size: 1.5 KiB |