pdfio/pdfio-page.c
Michael R Sweet 246c2e4b41
Rename as PDFio for consistency.
Add PDFio logo image.

Move documentation to "doc" subdirectory.
2021-05-30 07:10:44 -04:00

50 lines
1.1 KiB
C
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// PDF page functions for PDFio.
//
// Copyright © 2021 by Michael R Sweet.
//
// Licensed under Apache License v2.0. See the file "LICENSE" for more
// information.
//
//
// Include necessary headers...
//
#include "pdfio-private.h"
//
// 'pdfioPageCopy()' - Copy a page to a PDF file.
//
bool // O - `true` on success, `false` on failure
pdfioPageCopy(pdfio_file_t *pdf, // I - PDF file
pdfio_obj_t *srcpage) // I - Source page
{
pdfio_obj_t *dstpage; // Destination page object
PDFIO_DEBUG("pdfioPageCopy(pdf=%p, srcpage=%p(%p))\n", pdf, srcpage, srcpage ? srcpage->pdf : NULL);
// Range check input
if (!pdf || !srcpage || srcpage->value.type != PDFIO_VALTYPE_DICT)
{
if (pdf)
{
if (!srcpage)
_pdfioFileError(pdf, "NULL page object specified.");
else
_pdfioFileError(pdf, "Object is not a page.");
}
return (false);
}
// Copy the page object and add it to the pages array...
if ((dstpage = pdfioObjCopy(pdf, srcpage)) == NULL)
return (false);
else
return (_pdfioFileAddPage(pdf, dstpage));
}