Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Wed Sep 11, 2013 1:25 pm

Hi I need to create pdf-files of type pdf/x-1a
I start with a docx.
I can convert it to a pdf and set version = 1.3
But how do I set the pdf to be of type Pdf/x-1a?
I have found an enum (Spire.Pdf.PdfConformanceLevel.Pdf_X1A2001)

Best regards
Sven Hasselblad

Code: Select all
Document document = new Document();
System.IO.Stream pdfStream = new System.IO.MemoryStream();
            document.SaveToStream(pdfStream, Spire.Doc.FileFormat.PDF);
            PdfDocument doc = new PdfDocument();
            doc.LoadFromStream(pdfStream);
            doc.FileInfo.Version = PdfVersion.Version1_3;

svenh
 
Posts: 2
Joined: Wed Sep 11, 2013 11:58 am

Thu Sep 12, 2013 8:46 am

Hi,

Thanks for your inquiry.

Although our Spire.Pdf product has the enum (Spire.Pdf.PdfConformanceLevel.Pdf_X1A2001), sorry that we don't publish the interface about the feature on setting the pdf to be of type Pdf/x-1a at present, and we will release it in the future, once it is released, we will inform you.

If there are any questions, welcome to get it back to us.

Sincerely,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Thu Sep 12, 2013 10:52 am

Thanks for the fast and clear reply.
That was to bad, then we have to continue our search for a product that do support that.
Best regards
Sven Hasselblad

Gary.zhang wrote:Hi,

Thanks for your inquiry.

Although our Spire.Pdf product has the enum (Spire.Pdf.PdfConformanceLevel.Pdf_X1A2001), sorry that we don't publish the interface about the feature on setting the pdf to be of type Pdf/x-1a at present, and we will release it in the future, once it is released, we will inform you.

If there are any questions, welcome to get it back to us.

Sincerely,
Gary
E-iceblue support team

svenh
 
Posts: 2
Joined: Wed Sep 11, 2013 11:58 am

Fri Sep 13, 2013 9:30 am

Hi,

Thanks for the reply.
Welcome to evaluate our product if need in the future.
If there are any questions, welcome to get it back to us.

Thanks,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Tue Apr 15, 2014 7:03 am

Hello,

Now our Spire.Doc(Spire.Doc5.0.37) product can support the feature about doc to the pdf to be of type Pdf_X1A2001/Pdf_A1B conversion. There are some codes for your reference.
Code: Select all
Document doc = new Document();
doc.LoadFromFile("test.docx");
ToPdfParameterList toPdf = new ToPdfParameterList();
toPdf.PdfConformanceLevel = Spire.Pdf.PdfConformanceLevel.Pdf_A1B;
doc.SaveToFile("result.pdf", toPdf);

And our Spire.Pdf product can also support the feature about set the pdf to be of type Pdf_X1A2001/Pdf_A1B from the existing pdf.
Code: Select all
PdfDocument OriginalDoc = new PdfDocument();
OriginalDoc.LoadFromFile("Original.pdf");
PdfNewDocument newDOC = new PdfNewDocument();
newDOC.Conformance = PdfConformanceLevel.Pdf_A1B;
foreach (PdfPageBase page in OriginalDoc.Pages)
            {
                float pageWidth = page.Size.Width + OriginalDoc.PageSettings.Margins.Left + OriginalDoc.PageSettings.Margins.Right;
                float pageHeight = page.Size.Height + OriginalDoc.PageSettings.Margins.Top + OriginalDoc.PageSettings.Margins.Bottom;
                PdfPageBase p = newDOC.Pages.Add(new SizeF(pageWidth, pageHeight));
                page.CreateTemplate().Draw(p, 0, 0);
            }
      newDOC.Save("result.pdf");

Thanks,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Mon Sep 26, 2016 2:41 pm

I try this, and when testing the resulting file, it said it is not PDF-A conform ?

public byte[] test(byte[] bytes)
{
Guid logid = LogThisTrace(false);
Spire.Doc.Document document = new Spire.Doc.Document();

System.IO.MemoryStream inputStream = new System.IO.MemoryStream(bytes);
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;
document.SaveToStream(outputStream, tppl);
document.Dispose();
return outputStream.ToArray();
}
Any idea why, is it also working with SaveToStream ?
Thanks,
Robin Leblond
.Net Consultant, Montréal, Qc, Canada

robinleblond
 
Posts: 22
Joined: Fri Jan 29, 2016 5:46 pm

Mon Sep 26, 2016 2:53 pm

Well, after more verification, it look like it work, because when opening the file, it say on top of it "The file you have openened complies with the PDF/A standard....", but when testing it with many online confirmity validator (like the one linked below), it says it doesn't not... Any idea why ?

http://www.pdf-tools.com/pdf/validate-pdfa-online.aspx

Thanks
Robin Leblond
.Net Consultant, Montréal, Qc, Canada

robinleblond
 
Posts: 22
Joined: Fri Jan 29, 2016 5:46 pm

Tue Sep 27, 2016 8:05 am

Hello,

Could you please attach the word document you were trying?

Thanks in advance,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Tue Sep 27, 2016 1:25 pm

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();
}
Robin Leblond
.Net Consultant, Montréal, Qc, Canada

robinleblond
 
Posts: 22
Joined: Fri Jan 29, 2016 5:46 pm

Wed Sep 28, 2016 8:05 am

Dear robinleblond,

Thanks for your detailed information.
I have tested your scenario with the latest Spire.Doc Pack(hot fix) Version:5.7.117, the online verification is ok. Please try to use the version I mentioned. If there is any question, welcome to get it back to us.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Wed Sep 28, 2016 2:55 pm

I did test it again, I even create a brend new project to test it with the latest 5.7 version, still the same result.
When you test it (the online validator), did you click the "Execute" button ? because, elseway it seem to state that the file is pdfa-1b, while its not completly compliant, see image attached.

result.png
Robin Leblond
.Net Consultant, Montréal, Qc, Canada

robinleblond
 
Posts: 22
Joined: Fri Jan 29, 2016 5:46 pm

Thu Sep 29, 2016 2:10 am

Dear robinleblond,

Thanks for your information.
Please try to use Spire.Doc Pack(hot fix) Version:5.7.117 instead of version 5.7.
And I have attached the result PDF/A document, please check.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Thu Sep 29, 2016 1:24 pm

Oh! Yes, it work, sorry, I was thinkint that the first download link included the hotfix too... Thanks ! BTW, you do have an amazing client service, it's not the first time I ask question here, and you are always very fast and kind! I think it worth saying it!!!
Robin Leblond
.Net Consultant, Montréal, Qc, Canada

robinleblond
 
Posts: 22
Joined: Fri Jan 29, 2016 5:46 pm

Fri Sep 30, 2016 1:21 am

Dear Robin,

Thanks for your feedback.
Welcome to write to us again for further question.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Fri Mar 16, 2018 11:58 am

This document contains the phrase "Evaluation Warning:The document was created with Spire.Doc for .NET" and also "Evaluation Warning : The document was created with Spire.PDF for .NET."

it will be necessary to buy the two licenses or only with the Spire. Doc will be sufficient??

agomte@gmail.com
 
Posts: 1
Joined: Thu Jul 27, 2017 9:17 am

Return to Spire.PDF