mirror of
https://github.com/michaelrsweet/pdfio.git
synced 2025-12-23 21:46:24 +01:00
added string replacing the switch cases
This commit is contained in:
50
pdfio-file.c
50
pdfio-file.c
@@ -2749,46 +2749,18 @@ write_metadata(pdfio_file_t *pdf) // I - PDF file
|
|||||||
|
|
||||||
if (pdf->pdfa != _PDFIO_PDFA_NONE)
|
if (pdf->pdfa != _PDFIO_PDFA_NONE)
|
||||||
{
|
{
|
||||||
const char *part = "1"; // Conformance part number
|
static const char * const parts[] = // Part numbers
|
||||||
const char *conformance = "B"; // Conformance level
|
|
||||||
|
|
||||||
switch (pdf->pdfa)
|
|
||||||
{
|
{
|
||||||
case _PDFIO_PDFA_1A:
|
"1", "1", "2", "2", "2", "3", "3", "3", "4"
|
||||||
conformance = "A";
|
};
|
||||||
break;
|
static const char * const conformances[] = // Conformance levels
|
||||||
case _PDFIO_PDFA_1B:
|
{
|
||||||
// Default is B
|
"A", "B", "A", "B", "U", "A", "B", "U", ""
|
||||||
break;
|
};
|
||||||
case _PDFIO_PDFA_2A:
|
|
||||||
part = "2";
|
const char *part = parts[pdf->pdfa - 1];
|
||||||
conformance = "A";
|
const char *conformance = conformances[pdf->pdfa - 1];
|
||||||
break;
|
|
||||||
case _PDFIO_PDFA_2B:
|
|
||||||
part="2";
|
|
||||||
break;
|
|
||||||
case _PDFIO_PDFA_2U:
|
|
||||||
part = "2";
|
|
||||||
conformance = "U";
|
|
||||||
break;
|
|
||||||
case _PDFIO_PDFA_3A:
|
|
||||||
part = "3";
|
|
||||||
conformance = "A";
|
|
||||||
break;
|
|
||||||
case _PDFIO_PDFA_3B:
|
|
||||||
part = "3";
|
|
||||||
break;
|
|
||||||
case _PDFIO_PDFA_3U:
|
|
||||||
part = "3";
|
|
||||||
conformance = "U";
|
|
||||||
break;
|
|
||||||
case _PDFIO_PDFA_4:
|
|
||||||
part = "4";
|
|
||||||
conformance = ""; // Conformance level is part of GTS_PDFA4 key
|
|
||||||
break;
|
|
||||||
case _PDFIO_PDFA_NONE:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
status &= pdfioStreamPuts(st, " <rdf:Description rdf:about=\"\" xmlns:pdfaid=\"http://www.aiim.org/pdfa/ns/id/\">\n");
|
status &= pdfioStreamPuts(st, " <rdf:Description rdf:about=\"\" xmlns:pdfaid=\"http://www.aiim.org/pdfa/ns/id/\">\n");
|
||||||
status &= pdfioStreamPrintf(st, " <pdfaid:part>%s</pdfaid:part>\n",part);
|
status &= pdfioStreamPrintf(st, " <pdfaid:part>%s</pdfaid:part>\n",part);
|
||||||
|
|||||||
Reference in New Issue
Block a user