mirror of
https://github.com/michaelrsweet/pdfio.git
synced 2025-02-26 13:52:49 +01:00
Use pkg-config for compiler options.
Fix some issues with the image2pdf example code.
This commit is contained in:
parent
e686669b9d
commit
4e89137689
@ -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
|
||||||
|
@ -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,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user