diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4d2705f..04fc371 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,7 +17,7 @@ jobs: - name: Update Build Environment run: sudo apt-get update --fix-missing -y - 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 run: ./configure --enable-debug --enable-sanitizer --enable-maintainer - name: Build PDFio diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 74ca2aa..5b65ee2 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -32,7 +32,7 @@ jobs: run: sudo apt-get update --fix-missing -y - name: Install Prerequisites - run: sudo apt-get install -y zlib1g-dev + run: sudo apt-get install -y zlib1g-dev libpng-dev - name: Initialize CodeQL uses: github/codeql-action/init@v2 diff --git a/.github/workflows/coverity.yml b/.github/workflows/coverity.yml index 1f36815..30d9158 100644 --- a/.github/workflows/coverity.yml +++ b/.github/workflows/coverity.yml @@ -12,7 +12,7 @@ jobs: - name: Update Build Environment run: sudo apt-get update --fix-missing -y - 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 run: | wget -q https://scan.coverity.com/download/linux64 --post-data token="$TOKEN&project=$GITHUB_REPOSITORY" -O cov-analysis-linux64.tar.gz diff --git a/CHANGES.md b/CHANGES.md index 325c506..a471a58 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,13 +1,23 @@ Changes in PDFio ================ - -v1.4.1 - YYYY-MM-DD +v1.5.0 - 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 handling of the Info object (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 diff --git a/Makefile.in b/Makefile.in index 704f4d9..ce5eb3f 100644 --- a/Makefile.in +++ b/Makefile.in @@ -117,12 +117,14 @@ DOCFILES = \ NOTICE EXAMPLES = \ examples/Makefile \ + examples/Roboto-LICENSE.txt \ examples/Roboto-Bold.ttf \ examples/Roboto-Italic.ttf \ examples/Roboto-Regular.ttf \ examples/RobotoMono-Regular.ttf \ examples/code128.c \ examples/code128.ttf \ + examples/code128-LICENSE.txt \ examples/image2pdf.c \ examples/md2pdf.c \ examples/md2pdf.md \ diff --git a/configure b/configure index dc87439..a9293a7 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # 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 . # @@ -610,8 +610,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='pdfio' PACKAGE_TARNAME='pdfio' -PACKAGE_VERSION='1.4.1' -PACKAGE_STRING='pdfio 1.4.1' +PACKAGE_VERSION='1.5.0' +PACKAGE_STRING='pdfio 1.5.0' PACKAGE_BUGREPORT='https://github.com/michaelrsweet/pdfio/issues' PACKAGE_URL='https://www.msweet.org/pdfio' @@ -653,6 +653,7 @@ WARNINGS CSFLAGS LIBPDFIO_STATIC LIBPDFIO +PKGCONFIG_LIBPNG PKGCONFIG_REQUIRES PKGCONFIG_LIBS_PRIVATE PKGCONFIG_LIBS @@ -729,6 +730,7 @@ SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking +enable_libpng enable_static enable_shared 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. # This message is too long to be a string in the A/UX 3.1 sh. 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]... @@ -1359,7 +1361,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of pdfio 1.4.1:";; + short | recursive ) echo "Configuration of pdfio 1.5.0:";; esac cat <<\_ACEOF @@ -1367,6 +1369,8 @@ Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-libpng use libpng for pdfioFileCreateImageObjFromFile, + default=auto --disable-static do not install static library --enable-shared install shared library --enable-debug turn on debugging, default=no @@ -1456,7 +1460,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -pdfio configure 1.4.1 +pdfio configure 1.5.0 generated by GNU Autoconf 2.71 Copyright (C) 2021 Free Software Foundation, Inc. @@ -1612,7 +1616,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while 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 $ $0$ac_configure_args_raw @@ -2368,9 +2372,9 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu -PDFIO_VERSION="1.4.1" -PDFIO_VERSION_MAJOR="`echo 1.4.1 | awk -F. '{print $1}'`" -PDFIO_VERSION_MINOR="`echo 1.4.1 | awk -F. '{printf("%d\n",$2);}'`" +PDFIO_VERSION="1.5.0" +PDFIO_VERSION_MAJOR="`echo 1.5.0 | awk -F. '{print $1}'`" +PDFIO_VERSION_MINOR="`echo 1.5.0 | awk -F. '{printf("%d\n",$2);}'`" @@ -4099,6 +4103,55 @@ 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. if test ${enable_static+y} then : @@ -4935,7 +4988,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. 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 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 ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ -pdfio config.status 1.4.1 +pdfio config.status 1.5.0 configured by $0, generated by GNU Autoconf 2.71, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index c0d2977..19caff4 100644 --- a/configure.ac +++ b/configure.ac @@ -1,7 +1,7 @@ dnl dnl Configuration script for PDFio dnl -dnl Copyright © 2023-2024 by Michael R Sweet +dnl Copyright © 2023-2025 by Michael R Sweet dnl dnl Licensed under Apache License v2.0. See the file "LICENSE" for more dnl information. @@ -21,7 +21,7 @@ AC_PREREQ([2.70]) 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_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... 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])) diff --git a/doc/pdfio-512.png b/doc/pdfio-512.png index 349fb09..4dd81bb 100644 Binary files a/doc/pdfio-512.png and b/doc/pdfio-512.png differ diff --git a/doc/pdfio.3 b/doc/pdfio.3 index 41eeedb..1c823a1 100644 --- a/doc/pdfio.3 +++ b/doc/pdfio.3 @@ -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 pdfio \- pdf read/write library .SH Introduction @@ -2074,7 +2074,7 @@ The render_line function adds content from the linefrag_t array to a PDF page. I } .fi .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 if (frag\->url && dd\->num_links < DOCLINK_MAX) @@ -4567,4 +4567,4 @@ typedef enum pdfio_valtype_e pdfio_valtype_t; Michael R Sweet .SH COPYRIGHT .PP -Copyright (c) 2021-2024 by Michael R Sweet +Copyright (c) 2021-2025 by Michael R Sweet diff --git a/doc/pdfio.html b/doc/pdfio.html index 834afce..d80f62c 100644 --- a/doc/pdfio.html +++ b/doc/pdfio.html @@ -1,13 +1,13 @@ -PDFio Programming Manual v1.4.0 +PDFio Programming Manual v1.4.1 - - + +