Compare commits

...

9 Commits

Author SHA1 Message Date
vlasovsoft1979
e0cdd66887
Merge ee3109601901306ef8ee97ae6fb6d5e37f70809d into 9c04d1dc209cb081799f4c787ebe712b2d93d460 2024-10-19 13:40:07 +08:00
Michael R Sweet
9c04d1dc20
Update changelog. 2024-10-15 13:10:06 -04:00
Michael R Sweet
335472023e
Bump version in header. 2024-10-15 13:06:40 -04:00
Sergey Vlasov
ee31096019 PR comment 2024-09-27 20:38:15 +03:00
Sergey Vlasov
121b933307 minor 2024-09-25 18:44:34 +03:00
Sergey Vlasov
f4409146e3 minor 2024-09-25 18:42:38 +03:00
Sergey Vlasov
4312933409 pdfioFileCreateNameObj implemented 2024-09-25 18:40:36 +03:00
Sergey Vlasov
a19949834b PR comments 2024-09-25 18:06:17 +03:00
Sergey Vlasov
04c4f44324 Get name from simple object. For example, Image ColorSpace is the reference to other object. 2024-09-25 17:04:25 +03:00
4 changed files with 53 additions and 2 deletions

View File

@ -2,7 +2,7 @@ Changes in PDFio
================
v1.3.2 - YYYY-MM-DD
v1.3.2 - 2024-08-15
-------------------
- Added some more sanity checks to the TrueType font reader.

View File

@ -244,6 +244,35 @@ pdfioFileCreateArrayObj(
}
//
// 'pdfioFileCreateNameObj()' - Create a new object in a PDF file containing a name.
//
// This function creates a new object with a name value in a PDF file.
// You must call @link pdfioObjClose@ to write the object to the file.
//
pdfio_obj_t * // O - New object
pdfioFileCreateNameObj(
pdfio_file_t *pdf, // I - PDF file
const char *name) // I - Name value
{
_pdfio_value_t value; // Object value
// Range check input...
if (!pdf || !name)
return (NULL);
value.type = PDFIO_VALTYPE_NAME;
value.value.name = pdfioStringCreate(pdf, name);
if (!value.value.name)
return (NULL);
return (_pdfioFileCreateObj(pdf, NULL, &value));
}
//
// 'pdfioFileCreateNumberObj()' - Create a new object in a PDF file containing a number.
//

View File

@ -333,6 +333,26 @@ pdfioObjGetLength(pdfio_obj_t *obj) // I - Object
}
//
// 'pdfioObjGetName()' - Get the name value associated with an object.
//
const char * // O - Dictionary or `NULL` on error
pdfioObjGetName(pdfio_obj_t *obj) // I - Object
{
if (!obj)
return (NULL);
if (obj->value.type == PDFIO_VALTYPE_NONE)
_pdfioObjLoad(obj);
if (obj->value.type == PDFIO_VALTYPE_NAME)
return (obj->value.value.name);
else
return (NULL);
}
//
// 'pdfioObjGetNumber()' - Get the object's number.
//

View File

@ -23,7 +23,7 @@ extern "C" {
// Version number...
//
# define PDFIO_VERSION "1.3.1"
# define PDFIO_VERSION "1.3.2"
//
@ -182,6 +182,7 @@ extern bool pdfioDictSetStringf(pdfio_dict_t *dict, const char *key, const char
extern bool pdfioFileClose(pdfio_file_t *pdf) _PDFIO_PUBLIC;
extern pdfio_file_t *pdfioFileCreate(const char *filename, const char *version, pdfio_rect_t *media_box, pdfio_rect_t *crop_box, pdfio_error_cb_t error_cb, void *error_data) _PDFIO_PUBLIC;
extern pdfio_obj_t *pdfioFileCreateArrayObj(pdfio_file_t *pdf, pdfio_array_t *array) _PDFIO_PUBLIC;
extern pdfio_obj_t *pdfioFileCreateNameObj(pdfio_file_t *pdf, const char *name) _PDFIO_PUBLIC;
extern pdfio_obj_t *pdfioFileCreateNumberObj(pdfio_file_t *pdf, double number) _PDFIO_PUBLIC;
extern pdfio_obj_t *pdfioFileCreateObj(pdfio_file_t *pdf, pdfio_dict_t *dict) _PDFIO_PUBLIC;
extern pdfio_file_t *pdfioFileCreateOutput(pdfio_output_cb_t output_cb, void *output_ctx, const char *version, pdfio_rect_t *media_box, pdfio_rect_t *crop_box, pdfio_error_cb_t error_cb, void *error_data) _PDFIO_PUBLIC;
@ -222,6 +223,7 @@ extern pdfio_array_t *pdfioObjGetArray(pdfio_obj_t *obj) _PDFIO_PUBLIC;
extern pdfio_dict_t *pdfioObjGetDict(pdfio_obj_t *obj) _PDFIO_PUBLIC;
extern unsigned short pdfioObjGetGeneration(pdfio_obj_t *obj) _PDFIO_PUBLIC;
extern size_t pdfioObjGetLength(pdfio_obj_t *obj) _PDFIO_PUBLIC;
extern const char *pdfioObjGetName(pdfio_obj_t *obj) _PDFIO_PUBLIC;
extern size_t pdfioObjGetNumber(pdfio_obj_t *obj) _PDFIO_PUBLIC;
extern const char *pdfioObjGetSubtype(pdfio_obj_t *obj) _PDFIO_PUBLIC;
extern const char *pdfioObjGetType(pdfio_obj_t *obj) _PDFIO_PUBLIC;