Convert Pdf to Pdf/ua

Hi
Im trying to convert a Pdf to PdfUa, I found some examples on how to it.

And from this I made this test-function

private void Convert()
{
  Document pdfDoc = new Document("C:\\Temp\\NotPdfua.pdf");

  var validateFileName = "c:\\temp\\ValidateError.xml";
  var errorFileName = "c:\\temp\\ConvertingError.xml";
  var validateAfterFileName = "c:\\temp\\ValidateAfterError.xml";

  if (pdfDoc.IsPdfUaCompliant)
  {
  }
  else
  {
    pdfDoc.Validate(validateFileName, PdfFormat.PDF_UA_1);
  }
  var conversionOption = new PdfFormatConversionOptions(errorFileName, PdfFormat.PDF_UA_1);

  pdfDoc.Convert(conversionOption);

  pdfDoc.Save("c:\\temp\\ConvertedPdf.pdf");
  
  var output = new MemoryStream();
  pdfDoc.Save(output, SaveFormat.Pdf);

  pdfDoc = new Document(output);
  pdfDoc.Save("c:\\temp\\ConvertedPdf2.pdf");

  var after = new MemoryStream(output.ToArray());
  var inputstream = new MemoryStream(after.ToArray());
  Document pdfDocAfter = new Document(inputstream);

  pdfDocAfter.Validate(validateAfterFileName, PdfFormat.PDF_UA_1);
  pdfDocAfter.Save("c:\\temp\\ConvertedPdf3.pdf");

}

But it doesn’t work at all nothing is changed in the converted documents, I guess I’m missing something important but I can’t see it.
Can you point me to a working example?

@Kurt1960

Would you please share your sample PDF with us as well so that we can test the scenario in our environment and address it accordingly?

It doesn’t matter what Pdf I try to convert nothing happens
But here is one of them

NotPdfua.pdf (35.7 KB)

@Kurt1960

Can you please check below attached output generated in our environment? Also, please let us know if you are using another tool as well to validate the compliance e.g. Adobe Preflight.

_out.pdf (36.0 KB)

I’m using this Tool to validate Validate PDF/UA – pdfix.io and it says that the _out.pdf you attached is not valid.

And I tried to run it through my Convert() test-function it says true in this line
if (pdfDoc.IsPdfUaCompliant)
{
}
but if I do a validation (pdfDoc.Validate(validateFileName, PdfFormat.PDF_UA_1)) it generate this output
ValidateError.zip (767 Bytes)

So what does that mean, is your _out.pdf pdf-ua compatible or not?
If yes, why these errors in the validations?

@Kurt1960

The log file contains the errors that API faces during the conversion process and generates an output. However, we need to investigate about this issue in more details and we have logged an issue as PDFNET-57185 in our issue tracking system for the purpose. We will look into its details and keep you posted with the status of its rectification. Please be patient and spare us some time.

We are sorry for the inconvenience.

Hi is there any progress on this bug

@Kurt1960

We are afraid that the ticket is not resolved yet. It will be prioritized on a first come first serve basis and as soon as we make some progress, we will let you know via this forum thread. Please spare us some time.

We apologize for the inconvenience.

Hi is this issue fixed now. If yes, which version?

@Kurt1960

Sadly, the issue hasn’t been yet fixed and no updates are available at the moment. We will inform you once we have some news in this regard.

Subject: Escalation required – unresolved PDF/UA conversion issue (Ticket: Convert PDF to PDF/UA)

Hello Aspose Support,

I am writing to you as Head of Products at Unik System Design, regarding the long‑standing unresolved issue reported in the thread below:

We have now waited an unreasonable amount of time for progress. Your latest update indicates that the issue will be handled on a first‑come‑first‑served basis, but this is not acceptable given that:

  • We are a long‑term enterprise customer.
  • We pay 6,000 USD per year for Aspose licenses.
  • This blocking issue directly impacts our product delivery and several customer implementations.
  • PDF/UA compliance is a legal requirement under EU accessibility regulations, making this issue business‑critical for us and for our customers.

I therefore request:

  1. Immediate escalation of this ticket to your engineering team.
  2. A clear timeline for when we can expect a fix or a technical workaround.
  3. Confirmation of whether additional information is required from our side.

We value the cooperation with Aspose, but we need to see responsive and priority‑aligned handling of issues at this level. Please return with an updated status within the next 2 business days.

Kind regards,
Preben Jakobsen
Head of Products
Unik System Design A/S

@Kurt1960
I will raise this ticket to highest available priority and pass your issue to development team with request to examine this issue as soon as possible. As soon as I will get the update I will write you back.

@Kurt1960
Hi
The development team has responded with following:

The document is not converted to valid PDF/UA-1 since it doesn’t have a logical tags structure, and by default, the conversion process cannot fix this problem.
The customer may build the logical structure manually, extracting constituent parts of the document (texts, headings, images) and tagging them. Or, the customer may use the recently introduced functionality of automatic tagging that will create the basic tags structure, and the created structure may be then refined manually if necessary.

Here is the refined code snippet that includes automatic tagging during the conversion. The provided snippet generates a valid PDF/UA-1 document out of the example provided by the customer.

private void Convert()
{
  var validateFileName = "c:\\temp\\ValidateError.xml";
  var errorFileName = "c:\\temp\\ConvertingError.xml";
  var validateAfterFileName = "c:\\temp\\ValidateAfterError.xml";

  using (Document pdfDoc = new Document("C:\\Temp\\NotPdfua.pdf"))
  {
    if (pdfDoc.IsPdfUaCompliant)
    {
    }
    else
    {
      pdfDoc.Validate(validateFileName, PdfFormat.PDF_UA_1);
    }
    var conversionOption = new PdfFormatConversionOptions(errorFileName, PdfFormat.PDF_UA_1)
    {
      AutoTaggingSettings = AutoTaggingSettings.Default // If necessary, auto-tagging settings may be adjusted manually
    };

    pdfDoc.Convert(conversionOption);

    pdfDoc.Save("c:\\temp\\ConvertedPdf.pdf");
  }

  using (Document pdfDocAfter = new Document("c:\\temp\\ConvertedPdf.pdf"))
  {
    pdfDocAfter.Validate(validateAfterFileName, PdfFormat.PDF_UA_1);
    pdfDocAfter.Save("c:\\temp\\ConvertedPdf3.pdf");
  }
}

Please check if it’s working for you

It doesn’t work at all.
But now I have developed our own RTF to PDF-UA converter with Aspose as the engine, and it works perfectly.

1 Like

@Kurt1960
Good to hear you’ve found a solution for yourself. If you have any other questions or requests, feel free to ask.
Have a nice day