PDF/A-1A Metadata

I am creating a PDF with Title and Subject metadata. It is working with PdfConformance.None,
but when I change to PdfConformance.PdfA1A, generated pdf has Title,Subject empty.

Dim pdfA1a As Aspose.Pdf.Generator.Pdf = New Aspose.Pdf.Generator.Pdf
Dim sec As Aspose.Pdf.Generator.Section = pdfA1a.Sections.Add()
Dim img As Aspose.Pdf.Generator.Image = New Aspose.Pdf.Generator.Image()
img.ImageInfo.File = "C:\TEST\ABC.JPG"
sec.Paragraphs.Add(img)
pdfA1a.Conformance = Aspose.Pdf.Generator.PdfConformance.PdfA1A
pdfA1a.Title = "MY TITLE"
pdfA1a.Subject = "MY SUBJECT"
pdfA1a.Save("C:\TEST\ABC.PDF")

Please give me solution to add Title,Subject to PDFA1A.

Hiten

I am creating a PDF with Title and Subject metadata. It is working with PdfConformance.None,
but when I change to PdfConformance.PdfA1A, generated pdf has Title,Subject empty.

Dim pdfA1a As Aspose.Pdf.Generator.Pdf = New Aspose.Pdf.Generator.Pdf
Dim sec As Aspose.Pdf.Generator.Section = pdfA1a.Sections.Add()
Dim img As Aspose.Pdf.Generator.Image = New Aspose.Pdf.Generator.Image()
img.ImageInfo.File = “C:\TEST\ABC.JPG”
sec.Paragraphs.Add(img)
pdfA1a.Conformance = Aspose.Pdf.Generator.PdfConformance.PdfA1A
pdfA1a.Title = “MY TITLE”
pdfA1a.Subject = “MY SUBJECT”
pdfA1a.Save(“C:\TEST\ABC.PDF”)

Please give me solution to add Title,Subject to PDFA1A.

Hi Hiten,

Please accept my apology for late reply. I’m afraid Aspose.Pdf doesn’t support creation fo PDF/A-1A but validation so setting metadata also not supported for PDF/A-1A. Please check the [documentation](http://www.aspose.com/docs/display/pdfnet/Others) link for known issues.

Sorry for the inconvenience faced.

Best Regards,

Hi Tilal,

Thank for reply.

I am able to scan and generate PDF/A-1A with Metadata in following steps.

Steps

1. With Aspose.PDF , I am generating ImageOnly PDF/A-1A, (Compliance is verified with Preflight)

2. Then, I am adding metadata thru atalasoft.PDF. Compliance errors are found.

3. Acrobat Preflight Fixup corrects the compliance errors.

As a result I am getting PDF/A-1A which is verified for compliance with PDF/A-1A with Acrobat Preflight.

If there any way I an do this in one step with Aspose.PDF? Because, only Aspose.PDF is generating PDF/A-1A from scanned images.

Regards

Hiten

Hi Hiten,

Thanks for sharing the details and sorry for the delayed response.

Aspose.PDF for .NET supports the feature to add MetaData to existing PDF file. For further details, please visit Set XMP Metadata in an Existing PDF File (Facades)

In case you encounter any issue, please feel free to contact.

Hi Hiten,

Please accept my apology for the delayed response. You can get and set XMP meta data in an existing Pdf document. please check following documentation link for details and sample code.

Aspose.Pdf DOM

Aspose.Pdf.Facades

Please have a sample C# code for your requirement. Hopefully it will serve the purpose

Aspose.Pdf.Generator.Pdf pdfA1a = new Aspose.Pdf.Generator.Pdf();
Aspose.Pdf.Generator.Section sec = pdfA1a.Sections.Add();

Aspose.Pdf.Generator.Image img = new Aspose.Pdf.Generator.Image();
img.ImageInfo.File = myDir + "test.bmp";
sec.Paragraphs.Add(img);

pdfA1a.Conformance = Aspose.Pdf.Generator.PdfConformance.PdfA1A;
pdfA1a.Save(myDir + "ABC.pdf");

Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document(myDir + "ABC.pdf");

//set Metadata properties
pdfDocument.Metadata["xmp:title"] = "Custom Title";
pdfDocument.Metadata["xmp:Subject"] = "Custom Subject";

//document validation
pdfDocument.Validate(myDir + "log.xml", PdfFormat.PDF_A_1A);

//save output document
pdfDocument.Save(myDir + "output_XMP.pdf");

Please feel free to contact us for any further assistance.

Best Regards,

Hi Tilal,

Thank for detailed response, I have tried both the options, but none of them are working.

is it because of trial version?

Option No: 1, Error Stream was not writable. on .Save()

Dim OP1 As New Aspose.Pdf.LoadFormat()

Dim pdfDocument As New Aspose.Pdf.Document("D:\PAF\PANCARD49A\024110200048012A1A.PDF", OP1)


pdfDocument.Metadata(

“xmp:Title”) = “Hiten”


pdfDocument.Save()

Option 2 : Unable to read beyond the end of the stream. on .Validate()

DimmyDir As String = “d:\paf”


Dim pdfA1a As New Aspose.Pdf.Generator.Pdf()


Dim sec As Aspose.Pdf.Generator.Section = pdfA1a.Sections.Add()

Dim img As New Aspose.Pdf.Generator.Image()

img.ImageInfo.File = myDir &

"test.bmp"

sec.Paragraphs.Add(img)

pdfA1a.Conformance = Aspose.Pdf.Generator.PdfConformance.PdfA1A

pdfA1a.Save(myDir &

"ABC.pdf")

Dim pdfDocument As New Aspose.Pdf.Document(myDir & "ABC.pdf")

pdfDocument.Metadata(

"xmp:title") = "Custom Title"

pdfDocument.Metadata(

"xmp:Subject") = "Custom Subject"

pdfDocument.Validate(myDir &

"log.xml", Aspose.Pdf.PdfFormat.PDF_A_1A)

pdfDocument.Save(myDir &

"output_XMP.pdf")

Regards

Hiten

Hi Hiten,


Sorry for the inconvenience. Please use filestream in first option as code snippet given below and unfortunately, I’m unable to find any exception against option 2. Please download and try latest Aspose.Pdf API. If issue persist then please share your source document. So we will test it at our end and will share more information.

Dim pdfFile As String = “D:\PAF\PANCARD49A\024110200048012A1A.PDF”
Dim fs As FileStream = New FileStream(pdfFile, FileMode.Open, FileAccess.ReadWrite)
Dim pdfDocument As New Aspose.Pdf.Document(fs)
pdfDocument.Metadata(“xmp:title”) = “Hiten”
pdfDocument.Save()
fs.Close()

Best Regards,

Hi Tilal,

We have finaly puchased ASPOSE.PDF ver. 7.7

I am still not able to create PDFA1A with Title and Subject.

Here is my code, which creates PDFA1A but Title and Subject Info is missing in PDF file.

Dim license As New Aspose.Pdf.License()
license.SetLicense("Aspose.PDF.lic")
Dim pdfFile As String = Application.StartupPath & "\pdfA1A.PDF"
Dim pdfA1a As Aspose.Pdf.Generator.Pdf = New Aspose.Pdf.Generator.Pdf
Dim sec As Aspose.Pdf.Generator.Section = pdfA1a.Sections.Add()
Dim img As Aspose.Pdf.Generator.Image = New Aspose.Pdf.Generator.Image()
img.ImageInfo.File = Application.StartupPath & "\ABC.JPG"
sec.Paragraphs.Add(img)
pdfA1a.Title = "MY TITLE"
pdfA1a.Subject = "MY SUBJECT"
pdfA1a.Author = "MY AUTHOR"
pdfA1a.Conformance = Aspose.Pdf.Generator.PdfConformance.PdfA1A
pdfA1a.Save(pdfFile)

Hi Hiten,


Thanks for your inquiry. Please check suggested code here for adding XMP metadata in a Pdf document. Hopefully it will serve the purpose.

Please feel free to contact us for any further assistance.

Best Regards,