mirror of
https://github.com/michaelrsweet/pdfio.git
synced 2025-08-29 07:12:02 +02:00
Implement pdfioObjCopy and pdfioPageCopy, with tests.
This commit is contained in:
31
pdfio-page.c
31
pdfio-page.c
@@ -18,13 +18,32 @@
|
||||
// 'pdfioPageCopy()' - Copy a page to a PDF file.
|
||||
//
|
||||
|
||||
pdfio_obj_t * // O - Destination page
|
||||
bool // O - `true` on success, `false` on failure
|
||||
pdfioPageCopy(pdfio_file_t *pdf, // I - PDF file
|
||||
pdfio_obj_t *src) // I - Source page
|
||||
pdfio_obj_t *srcpage) // I - Source page
|
||||
{
|
||||
// TODO: Implement pdfioPageCopy
|
||||
(void)pdf;
|
||||
(void)src;
|
||||
pdfio_obj_t *dstpage; // Destination page object
|
||||
|
||||
return (NULL);
|
||||
|
||||
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));
|
||||
}
|
||||
|
Reference in New Issue
Block a user