diff --git a/pdfio-content.c b/pdfio-content.c index 81e1134..c3009ce 100644 --- a/pdfio-content.c +++ b/pdfio-content.c @@ -1700,6 +1700,11 @@ pdfioFileCreateFontObjFromBase( pdfio_dict_t *dict; // Font dictionary pdfio_obj_t *obj; // Font object + if (pdf && pdf->pdfa != _PDFIO_PDFA_NONE) + { + _pdfioFileError(pdf, "Base fonts are not allowed in PDF/A files; use pdfioFileCreateFontObjFromFile to embed a font."); + return (NULL); + } if ((dict = pdfioDictCreate(pdf)) == NULL) return (NULL); @@ -2064,6 +2069,12 @@ pdfioFileCreateImageObjFromData( }; + if (pdf && (pdf->pdfa == _PDFIO_PDFA_1A || pdf->pdfa == _PDFIO_PDFA_1B) && alpha) + { + _pdfioFileError(pdf, "Images with transparency (alpha channels) are not allowed in PDF/A-1 files."); + return (NULL); + } + // Range check input... if (!pdf || !data || !width || !height || num_colors < 1 || num_colors == 2 || num_colors > 4) return (NULL); @@ -2730,6 +2741,12 @@ copy_png(pdfio_dict_t *dict, // I - Dictionary depth = png_get_bit_depth(pp, info); color_type = png_get_color_type(pp, info); + if ((dict->pdf->pdfa == _PDFIO_PDFA_1A || dict->pdf->pdfa == _PDFIO_PDFA_1B) && (color_type & PNG_COLOR_MASK_ALPHA)) + { + _pdfioFileError(dict->pdf, "PNG images with transparency (alpha channels) are not allowed in PDF/A-1 files."); + goto finish_png; + } + if (color_type & PNG_COLOR_MASK_PALETTE) num_colors = 1; else if (color_type & PNG_COLOR_MASK_COLOR)