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.

Mon Dec 02, 2013 8:46 am

Hello,
is possible to convert an existing PDF file to PDF/A via Spire.PDF? I tried to find some some settings, but without success.

Thank you

Pavel

ales.klenka
 
Posts: 9
Joined: Thu Mar 22, 2012 9:30 am

Mon Dec 02, 2013 9:35 am

Hello Pavel,

Thanks for your inquiry.

Sorry that at present our Spire.Pdf product doesn't support the feature to convert an existing PDF file to PDF/A, and we have added the feature to our schedule, once it is supported, we will inform you immediately.

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

Tue Apr 15, 2014 7:10 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

Thu Jun 18, 2020 4:44 pm

Hi, i'm try convert pdf to pdf/a using the your code, but not have sucess.
Can help me ?

cleuber_s
 
Posts: 3
Joined: Thu Jun 18, 2020 4:35 pm

Fri Jun 19, 2020 2:13 am

Hi Cleuber,

Thanks for your inquiry.
Do you want to convert your PDF file to PDF/A-2A? If so, we are sorry to tell you that our Spire.PDF does not actually support creating PDF/A-2A files yet. Our Dev team is now working hard to implement it.
Or if I misunderstood, please provide the code you are using to help us investigate further. Looking forward to your response.

Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Fri Jun 19, 2020 11:12 am

I want convert to PDF/a (1A) .
is Here the code:

Code: Select all
        public static byte[] ConvertBytesPdfToPdfA(byte[] bytes)
        {
            MemoryStream file_pdf = new MemoryStream(bytes);
            MemoryStream file_pdfa = new MemoryStream();

            PdfDocument OriginalDoc = new PdfDocument();
            OriginalDoc.LoadFromStream (file_pdf);

            PdfNewDocument newDOC = new PdfNewDocument();
            newDOC.Conformance = PdfConformanceLevel.Pdf_A1A;
            foreach (PdfPageBase page in OriginalDoc.Pages)
            {
                SizeF size = page.Size;
                PdfPageBase p = newDOC.Pages.Add(size, new Spire.Pdf.Graphics.PdfMargins(0));
                page.CreateTemplate().Draw(p, 0, 0);
            }
            file_pdf.Close();
            newDOC.Save(file_pdfa);
            return file_pdfa.ToArray();
        }

cleuber_s
 
Posts: 3
Joined: Thu Jun 18, 2020 4:35 pm

Mon Jun 22, 2020 1:54 am

Hello,

Sorry for the late reply as weekend.
I tested your code with the latest Spire.PDF Pack(Hot Fix) Version:6.5.15, but found it could work well. Attached is my output file. If you are using an older version, please try the latest version. If the issue still occurs, to help us investigate further, please provide your OS information (E.g. Windows 7, 64 bit) and region setting (E.g. China, Chinese). Thanks in advance.

Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Mon Jun 22, 2020 12:20 pm

Hi, i submit your file (output.pdf) on validator (searching in google)

Results:

File output.pdf
Compliance pdfa-1a
Result Document does not conform to PDF/A.

Details

Validating file "output.pdf" for conformance level pdfa-1a

The key CIDSet is required but missing.

The value of the key SMask is an image but must be None.

The font ArialMT must be embedded.

The font Helvetica must be embedded.

The document does not conform to the requested standard.

The document contains fonts without embedded font programs or encoding information (CMAPs).

The document contains transparency.

The document does not conform to the PDF/A-1a standard.

cleuber_s
 
Posts: 3
Joined: Thu Jun 18, 2020 4:35 pm

Tue Jun 23, 2020 2:14 am

Hello,

Thanks for your feedback.
I used some online tools to validate the output file and indeed found that it does not conform to the PDF/A-1A standard. I have posted this issue to our Dev team with the ticket SPIREPDF-2950 for further investigation. If there is any progress, we will let you know immediately.
Apologize for the inconvenience caused.

Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Return to Spire.PDF