Я пытаюсь создать PDF / совместимый документ с libharu, но он не работает.
Созданный PDF не PDF / совместимый.
Вот мой маленький пример:
pdf = HPDF_New(error_handler, NULL);
if (!pdf) {
printf("error: cannot create PdfDoc object\n");
return;
}
HPDF_STATUS stat;
HPDF_Date date;
stat = HPDF_SetInfoAttr(pdf, HPDF_INFO_TITLE, "Rechnung");
stat = HPDF_PDFA_SetPDFAConformance(pdf, HPDF_PDFAType::HPDF_PDFA_1A);
HPDF_Page page = HPDF_AddPage(pdf);
CString hpdfFontName = HPDF_LoadTTFontFromFile(pdf, "C:\\Windows\\Fonts\\arial.ttf", HPDF_TRUE);
HPDF_Font title_font = HPDF_GetFont(pdf, hpdfFontName, "WinAnsiEncoding");
HPDF_Page_SetFontAndSize(page, title_font, 10);
HPDF_Page_BeginText(page);
HPDF_Page_MoveTextPos(page, 10, 190);
HPDF_Page_ShowText(page, "Dies ist ein Test");
HPDF_Page_EndText(page);
HPDF_SaveToFile(pdf, "");
HPDF_Free(pdf);
Я проверяю pdf do c с veraPDF, и вот ошибки, которые я получаю:
<?xml version="1.0" encoding="utf-8"?>
<report>
<buildInformation>
<releaseDetails id="core" version="1.14.105" buildDate="2019-10-24T22:54:00+02:00"></releaseDetails>
<releaseDetails id="validation-model" version="1.14.105" buildDate="2019-10-24T22:59:00+02:00"></releaseDetails>
<releaseDetails id="gui" version="1.14.8" buildDate="2019-10-24T23:11:00+02:00"></releaseDetails>
</buildInformation>
<jobs>
<job>
<item size="68127">
<name>C:\test.pdf</name>
</item>
<validationReport profileName="PDF/A-1A validation profile" statement="PDF file is not compliant with Validation Profile requirements." isCompliant="false">
<details passedRules="103" failedRules="4" passedChecks="426" failedChecks="4">
<rule specification="ISO 19005-1:2005" clause="6.2.3" testNumber="4" status="failed" passedChecks="0" failedChecks="1">
<description>If an uncalibrated colour space is used in a file then that file shall contain a PDF/A-1 OutputIntent, as defined in 6.2.2</description>
<object>PDDeviceGray</object>
<test>gOutputCS != null</test>
<check status="failed">
<context>root/document[0]/pages[0](6 0 obj PDPage)/contentStream[0](7 0 obj PDContentStream)/operators[3]/fillCS[0]</context>
</check>
</rule>
<rule specification="ISO 19005-1:2005" clause="6.8.2" testNumber="1" status="failed" passedChecks="0" failedChecks="1">
<description>The document catalog dictionary shall include a MarkInfo dictionary with a Marked entry in it, whose value shall be true.</description>
<object>CosDocument</object>
<test>Marked == true</test>
<check status="failed">
<context>root</context>
</check>
</rule>
<rule specification="ISO 19005-1:2005" clause="6.8.3" testNumber="1" status="failed" passedChecks="0" failedChecks="1">
<description>The logical structure of the conforming file shall be described by a structure hierarchy rooted in the StructTreeRoot entry of the document catalog dictionary, as described in PDF Reference 9.6</description>
<object>PDDocument</object>
<test>StructTreeRoot_size == 1</test>
<check status="failed">
<context>root/document[0]</context>
</check>
</rule>
<rule specification="ISO 19005-1:2005" clause="6.7.2" testNumber="1" status="failed" passedChecks="0" failedChecks="1">
<description>The document catalog dictionary of a conforming file shall contain the Metadata key.</description>
<object>PDDocument</object>
<test>metadata_size == 1</test>
<check status="failed">
<context>root/document[0]</context>
</check>
</rule>
</details>
</validationReport>
<duration start="1587388142413" finish="1587388142429">00:00:00.016</duration>
</job>
</jobs>
<batchSummary totalJobs="1" failedToParse="0" encrypted="0">
<validationReports compliant="0" nonCompliant="1" failedJobs="0">1</validationReports>
<featureReports failedJobs="0">0</featureReports>
<repairReports failedJobs="0">0</repairReports>
<duration start="1587388142413" finish="1587388142429">00:00:00.016</duration>
</batchSummary>
</report>
Так что можно создать PDF / совместимый документ с libharu? Где моя неудача?