Here it is... Very simple as you see... I made an other example, more straightforward...
I included both the original Word file and the resulting pdf. Below are the code AND the validation result from the validation site.
I also did the test by not using a memory stream, (therefor using : document.SaveToFile(@"c:\temp\pdfa.pdf", tppl);), it gave the same result.
VALIDATION RESULT :
pdfa.pdf does not conform to PDF/A.
Validating file "pdfa.pdf" for conformance level pdfa-1b
There is only one RDF resource allowed in XMP.
The required XMP property 'xmp:CreatorTool' for the document information entry 'Creator' is missing.
The XMP property 'xmp:CreateDate' is not synchronized with the document information entry 'CreationDate'.
The XMP property 'xmp:ModifyDate' is not synchronized with the document information entry 'ModDate'.
The value of the CIDSet[3] of font THTESD+Calibri is false but must be true.
The value of the CIDSet[100] of font THTESD+Calibri is false but must be true.
The value of the CIDSet[286] of font THTESD+Calibri is false but must be true.
The value of the CIDSet[400] of font THTESD+Calibri is false but must be true.
The value of the CIDSet[410] of font THTESD+Calibri is false but must be true.
The value of the CIDSet[1005] of font THTESD+Calibri is false but must be true.
The value of the CIDSet[1006] of font THTESD+Calibri is false but must be true.
The value of the CIDSet[1007] of font THTESD+Calibri is false but must be true.
The document does not conform to the requested standard.
The document contains fonts without embedded font programs or encoding information (CMAPs).
The document's meta data is either missing or inconsistent or corrupt.
Done.
TEST CODE :
- Code: Select all
{
System.IO.FileInfo fi = new System.IO.FileInfo(@"c:\temp\pdfa.docx");
System.IO.FileStream fs = fi.OpenRead();
byte[] read = new byte[fs.Length];
fs.Read(read, 0, (int)fs.Length);
Spire.Doc.Document document = new Spire.Doc.Document();
System.IO.MemoryStream inputStream = new System.IO.MemoryStream(read);
document.LoadFromStream(inputStream, Spire.Doc.FileFormat.Auto);
System.IO.MemoryStream outputStream = new System.IO.MemoryStream();
Spire.Doc.ToPdfParameterList tppl = new Spire.Doc.ToPdfParameterList();
tppl.PdfConformanceLevel = Spire.Pdf.PdfConformanceLevel.Pdf_A1B;
tppl.IsEmbeddedAllFonts = true;
document.SaveToStream(outputStream, tppl);
document.Dispose();
byte[] write = outputStream.ToArray();
System.IO.FileInfo fo = new System.IO.FileInfo(@"c:\temp\pdfa.pdf");
System.IO.FileStream fos = fo.OpenWrite();
fos.Write(write, 0, write.Length);
fs.Close();
fos.Close();
}
Login to view the files attached to this post.