Discussion:
[iText-questions] PDF Validation error with PDF/A1b complaince
Manulak Dissanayake
2012-08-23 12:36:58 UTC
Permalink
Hi All

I am creating a PDF which is supposed to be complaint with PDF/A1-b and when I use online validators like PDF TOOLS Online Validator<http://www.pdf-tools.com/pdf/validate-pdfa-online.aspx>, it gives the following error saying that the PDF is not PDF/A complaint.

dc:description/*[0] :: Missing language qualifier.
dc:title/*[0] :: Missing language qualifier.
The property 'pdf:keywords' is not defined in schema 'Adobe PDF Schema'.
The XMP property 'dc:title' is not synchronized with the document information entry 'Title'.
The XMP property 'dc:description' is not synchronized with the document information entry 'Subject'.
The required XMP property 'pdf:Keywords' for the document information entry 'Keywords' is missing.

I am using FOP for rendering my PDF and using iText (iText 2.1.6 by 1T3XT) for converting the PDF to be PDF/A complaint.

public void convertToPdfA(File file1, File file2)
{
PdfReader reader = null;
Document document = null;
PdfCopy copy;

InputStream PROFILE = this.getClass().getClassLoader().getResourceAsStream("com/ini/vldt/config/sRGB Color Space Profile.icm");

There I first read the PDF file to a PdfReader object, then get a copy as follows.

reader = new PdfReader(new RandomAccessFileOrArray(file1.getPath()),null);
//Creating a new document that has the existing page size
document = new Document(reader.getPageSizeWithRotation(1));
//save the data in the 'document' to file2
copy = new PdfCopy(document, new FileOutputStream(file2));

Then I try adding the Title, Author, Keywords, Creator, Subject, Creation Date and Producer as follows.

try{
document.addTitle(reader.getInfo().get("Title").toString());
}
catch(Exception e){
document.addTitle("TEST Title");
}

try{
document.addAuthor(reader.getInfo().get("Author").toString());
}
catch(Exception e){
document.addAuthor("TEST Author");
}

try{
document.addKeywords(reader.getInfo().get("Keywords").toString());
}
catch(Exception e){
document.addKeywords("TEST Keywords");
}

document.addCreator("TEST Creator");
document.addCreationDate();
document.addProducer();

try{
document.addSubject(reader.getInfo().get("Subject").toString());
}
catch(Exception e){
document.addSubject("TEST Subject");
}


Then I give the PDFA conformance values and then create the PDF as follows.

copy.setPDFXConformance(PdfCopy.PDFA1B);
copy.setPdfVersion(PdfCopy.VERSION_1_4);
document.open();
ICC_Profile icc = ICC_Profile.getInstance(PROFILE);
copy.setOutputIntents("Custom", "", "http://www.color.org", "sRGB IEC61966-2.1", icc);

for(int i=1;i<=reader.getNumberOfPages();i++){
document.setPageSize(reader.getPageSizeWithRotation(i));
copy.addPage(copy.getImportedPage(reader, i));
}
copy.createXmpMetadata();
copy.close();
document.close();
reader.close();


I got another error report from SolidFrameowrk<http://www.validatepdfa.com/online.htm> validations as follows.

- <metadata>
<problem severity="error" objectID="27" clause="6.7" standard="pdfa">Language qualifier missing for property 'dc:description'</problem>
<problem severity="error" objectID="27" clause="6.7" standard="pdfa">Language qualifier missing for property 'dc:title'</problem>
<problem severity="error" objectID="27" clause="TN0003" standard="pdfa">Property 'pdf:keywords' shall use a custom embedded schema</problem>
<problem severity="error" objectID="27" clause="6.7.3" standard="pdfa">Document information entry 'Keywords' not synchronized with metadata property 'pdf:Keywords'</problem>
</metadata>
- <fonts>
<problem severity="error" objectID="12" clause="6.3.5" standard="pdfa">Missing or incorrect CIDSet for CIDFont subset</problem>
<problem severity="error" objectID="18" clause="6.3.5" standard="pdfa">Missing or incorrect CIDSet for CIDFont subset</problem>
</fonts>

What can be the issue? Any reply is highly appreciated.

Thank you.
-Manulak Dissanayake



BstRgds;
Manulak Dissanayake
IFS R&D Technology


------------------------------------------------------------------------------

CONFIDENTIALITY AND DISCLAIMER NOTICE

This e-mail, including any attachments, is confidential and for use only by
the intended recipient. If you are not the intended recipient, please notify
us immediately and delete this e-mail from your system. Any use or disclosure
of the information contained herein is strictly prohibited. As internet
communications are not secure, we do not accept legal responsibility for the
contents of this message nor responsibility for any change made to this
message after it was sent by the original sender. We advise you to carry out
your own virus check as we cannot accept liability for damage resulting from
software viruses.
iText Info
2012-08-23 12:58:45 UTC
Permalink
Post by Manulak Dissanayake
I am using FOP for rendering my PDF and using iText (iText 2.1.6 by
1T3XT) for converting the PDF to be PDF/A complaint.
iText 2.1.6? Did we already support XMP in June 2006? Maybe, but that's
not relevant. That version isn't supported anymore, and it takes more to
make a file PDF/A compliant than merely changing a setting.
mkl
2012-08-23 12:58:47 UTC
Permalink
Manulak,
Post by Manulak Dissanayake
What can be the issue? Any reply is highly appreciated.
The issue is your expectation that iText can create PDF/A compliant PDFs
from non-compliant ones. It merely can create (with support by the program
using it) them from scratch.

Regards, Michael

PS: The version of iText you are using is mighty old.



--
View this message in context: http://itext-general.2136553.n4.nabble.com/PDF-Validation-error-with-PDF-A1b-complaince-tp4655986p4655989.html
Sent from the iText - General mailing list archive at Nabble.com.
Manulak Dissanayake
2012-08-27 11:07:02 UTC
Permalink
Hi



Thanks for the information. Can you please let me know whether I am using a wrong way to generate PDFA/1b complaint files, or it is just the old jar file which makes all these problems?

If the approach is wrong, that do you suggest me to?

If the jar makes all these problems, can you suggest me a place where I can download lowagie /itextPDF iText file?



Thanks in advance.

-Manulak





-----Original Message-----
From: mkl [mailto:***@wir-sind-cool.org]
Sent: Thursday, August 23, 2012 6:29 PM
To: itext-***@lists.sourceforge.net
Subject: [iText-questions] [SPAM] Re: PDF Validation error with PDF/A1b complaince



Manulak,



The issue is your expectation that iText can create PDF/A compliant PDFs

from non-compliant ones. It merely can create (with support by the program

using it) them from scratch.



Regards, Michael



PS: The version of iText you are using is mighty old.


From: Manulak Dissanayake [mailto:***@ifsworld.com]
Sent: Thursday, August 23, 2012 6:07 PM
To: itext-***@lists.sourceforge.net
Subject: [iText-questions] PDF Validation error with PDF/A1b complaince

Hi All

I am creating a PDF which is supposed to be complaint with PDF/A1-b and when I use online validators like PDF TOOLS Online Validator<http://www.pdf-tools.com/pdf/validate-pdfa-online.aspx>, it gives the following error saying that the PDF is not PDF/A complaint.

dc:description/*[0] :: Missing language qualifier.
dc:title/*[0] :: Missing language qualifier.
The property 'pdf:keywords' is not defined in schema 'Adobe PDF Schema'.
The XMP property 'dc:title' is not synchronized with the document information entry 'Title'.
The XMP property 'dc:description' is not synchronized with the document information entry 'Subject'.
The required XMP property 'pdf:Keywords' for the document information entry 'Keywords' is missing.

I am using FOP for rendering my PDF and using iText (iText 2.1.6 by 1T3XT) for converting the PDF to be PDF/A complaint.

public void convertToPdfA(File file1, File file2)
{
PdfReader reader = null;
Document document = null;
PdfCopy copy;

InputStream PROFILE = this.getClass().getClassLoader().getResourceAsStream("com/ini/vldt/config/sRGB Color Space Profile.icm");

There I first read the PDF file to a PdfReader object, then get a copy as follows.

reader = new PdfReader(new RandomAccessFileOrArray(file1.getPath()),null);
//Creating a new document that has the existing page size
document = new Document(reader.getPageSizeWithRotation(1));
//save the data in the 'document' to file2
copy = new PdfCopy(document, new FileOutputStream(file2));

Then I try adding the Title, Author, Keywords, Creator, Subject, Creation Date and Producer as follows.

try{
document.addTitle(reader.getInfo().get("Title").toString());
}
catch(Exception e){
document.addTitle("TEST Title");
}

try{
document.addAuthor(reader.getInfo().get("Author").toString());
}
catch(Exception e){
document.addAuthor("TEST Author");
}

try{
document.addKeywords(reader.getInfo().get("Keywords").toString());
}
catch(Exception e){
document.addKeywords("TEST Keywords");
}

document.addCreator("TEST Creator");
document.addCreationDate();
document.addProducer();

try{
document.addSubject(reader.getInfo().get("Subject").toString());
}
catch(Exception e){
document.addSubject("TEST Subject");
}


Then I give the PDFA conformance values and then create the PDF as follows.

copy.setPDFXConformance(PdfCopy.PDFA1B);
copy.setPdfVersion(PdfCopy.VERSION_1_4);
document.open();
ICC_Profile icc = ICC_Profile.getInstance(PROFILE);
copy.setOutputIntents("Custom", "", "http://www.color.org", "sRGB IEC61966-2.1", icc);

for(int i=1;i<=reader.getNumberOfPages();i++){
document.setPageSize(reader.getPageSizeWithRotation(i));
copy.addPage(copy.getImportedPage(reader, i));
}
copy.createXmpMetadata();
copy.close();
document.close();
reader.close();


I got another error report from SolidFrameowrk<http://www.validatepdfa.com/online.htm> validations as follows.

- <metadata>
<problem severity="error" objectID="27" clause="6.7" standard="pdfa">Language qualifier missing for property 'dc:description'</problem>
<problem severity="error" objectID="27" clause="6.7" standard="pdfa">Language qualifier missing for property 'dc:title'</problem>
<problem severity="error" objectID="27" clause="TN0003" standard="pdfa">Property 'pdf:keywords' shall use a custom embedded schema</problem>
<problem severity="error" objectID="27" clause="6.7.3" standard="pdfa">Document information entry 'Keywords' not synchronized with metadata property 'pdf:Keywords'</problem>
</metadata>
- <fonts>
<problem severity="error" objectID="12" clause="6.3.5" standard="pdfa">Missing or incorrect CIDSet for CIDFont subset</problem>
<problem severity="error" objectID="18" clause="6.3.5" standard="pdfa">Missing or incorrect CIDSet for CIDFont subset</problem>
</fonts>

What can be the issue? Any reply is highly appreciated.

Thank you.
-Manulak Dissanayake



BstRgds;
Manulak Dissanayake
IFS R&D Technology


------------------------------------------------------------------------------



CONFIDENTIALITY AND DISCLAIMER NOTICE



This e-mail, including any attachments, is confidential and for use only by

the intended recipient. If you are not the intended recipient, please notify

us immediately and delete this e-mail from your system. Any use or disclosure

of the information contained herein is strictly prohibited. As internet

communications are not secure, we do not accept legal responsibility for the

contents of this message nor responsibility for any change made to this

message after it was sent by the original sender. We advise you to carry out

your own virus check as we cannot accept liability for damage resulting from

software viruses.



------------------------------------------------------------------------------

CONFIDENTIALITY AND DISCLAIMER NOTICE

This e-mail, including any attachments, is confidential and for use only by
the intended recipient. If you are not the intended recipient, please notify
us immediately and delete this e-mail from your system. Any use or disclosure
of the information contained herein is strictly prohibited. As internet
communications are not secure, we do not accept legal responsibility for the
contents of this message nor responsibility for any change made to this
message after it was sent by the original sender. We advise you to carry out
your own virus check as we cannot accept liability for damage resulting from
software viruses.
Manulak Dissanayake
2012-08-29 04:26:21 UTC
Permalink
Hi Again

In my application, I first create the PDF in normal standard and it is a new functionality I added to convert it to PDFA/1b complaint. So I have given an option to user to select whether the generated PDFs should be PDF Complaint or not.
So I have mentioned the code I added to convert the PDF to PDFA/1b below. I am using iText.jar (lowagie) 2.1.6 and got to know that it is not supported now. And as Micheal described, I can't convert PDF to PDFA complaint PDFS using iText.
I tried with using the same code in latest versions and was not successful. Do you think my approach with converting PDFA complaint PDFS from existing PDF files is not correct? And impossible?
Any suggestions?

I have removed the parts of adding "keyword", "Title" and "Subject" as follows.

/*try{
document.addTitle(reader.getInfo().get("Title").toString());
}
catch(Exception e){
document.addTitle("TEST Title");
}
try{
document.addKeywords(reader.getInfo().get("Keywords").toString());
}
catch(Exception e){
document.addKeywords("TEST Keywords");
}
try{
document.addSubject(reader.getInfo().get("Subject").toString());
}
catch(Exception e){
document.addSubject("TEST Subject");
}*/

This will create the PDFA/1b complaint PDF correctly. So the problem is with those which I removed. This is a mismatch between PDF Schema and the Dublin core schema if I am correct.
Any suggestion would be highly appreciated.
Thank you.
-Manulak


From: Manulak Dissanayake [mailto:***@ifsworld.com]
Sent: Monday, August 27, 2012 4:37 PM
To: Post all your questions about iText here
Subject: Re: [iText-questions] PDF Validation error with PDF/A1b complaince


Hi



Thanks for the information. Can you please let me know whether I am using a wrong way to generate PDFA/1b complaint files, or it is just the old jar file which makes all these problems?

If the approach is wrong, that do you suggest me to?

If the jar makes all these problems, can you suggest me a place where I can download lowagie /itextPDF iText file?



Thanks in advance.

-Manulak





-----Original Message-----
From: mkl [mailto:***@wir-sind-cool.org]<mailto:[mailto:***@wir-sind-cool.org]>
Sent: Thursday, August 23, 2012 6:29 PM
To: itext-***@lists.sourceforge.net<mailto:itext-***@lists.sourceforge.net>
Subject: [iText-questions] [SPAM] Re: PDF Validation error with PDF/A1b complaince



Manulak,



The issue is your expectation that iText can create PDF/A compliant PDFs

from non-compliant ones. It merely can create (with support by the program

using it) them from scratch.



Regards, Michael



PS: The version of iText you are using is mighty old.


From: Manulak Dissanayake [mailto:***@ifsworld.com]<mailto:[mailto:***@ifsworld.com]>
Sent: Thursday, August 23, 2012 6:07 PM
To: itext-***@lists.sourceforge.net<mailto:itext-***@lists.sourceforge.net>
Subject: [iText-questions] PDF Validation error with PDF/A1b complaince

Hi All

I am creating a PDF which is supposed to be complaint with PDF/A1-b and when I use online validators like PDF TOOLS Online Validator<http://www.pdf-tools.com/pdf/validate-pdfa-online.aspx>, it gives the following error saying that the PDF is not PDF/A complaint.

dc:description/*[0] :: Missing language qualifier.
dc:title/*[0] :: Missing language qualifier.
The property 'pdf:keywords' is not defined in schema 'Adobe PDF Schema'.
The XMP property 'dc:title' is not synchronized with the document information entry 'Title'.
The XMP property 'dc:description' is not synchronized with the document information entry 'Subject'.
The required XMP property 'pdf:Keywords' for the document information entry 'Keywords' is missing.

I am using FOP for rendering my PDF and using iText (iText 2.1.6 by 1T3XT) for converting the PDF to be PDF/A complaint.

public void convertToPdfA(File file1, File file2)
{
PdfReader reader = null;
Document document = null;
PdfCopy copy;

InputStream PROFILE = this.getClass().getClassLoader().getResourceAsStream("com/ini/vldt/config/sRGB Color Space Profile.icm");

There I first read the PDF file to a PdfReader object, then get a copy as follows.

reader = new PdfReader(new RandomAccessFileOrArray(file1.getPath()),null);
//Creating a new document that has the existing page size
document = new Document(reader.getPageSizeWithRotation(1));
//save the data in the 'document' to file2
copy = new PdfCopy(document, new FileOutputStream(file2));

Then I try adding the Title, Author, Keywords, Creator, Subject, Creation Date and Producer as follows.

try{
document.addTitle(reader.getInfo().get("Title").toString());
}
catch(Exception e){
document.addTitle("TEST Title");
}

try{
document.addAuthor(reader.getInfo().get("Author").toString());
}
catch(Exception e){
document.addAuthor("TEST Author");
}

try{
document.addKeywords(reader.getInfo().get("Keywords").toString());
}
catch(Exception e){
document.addKeywords("TEST Keywords");
}

document.addCreator("TEST Creator");
document.addCreationDate();
document.addProducer();

try{
document.addSubject(reader.getInfo().get("Subject").toString());
}
catch(Exception e){
document.addSubject("TEST Subject");
}


Then I give the PDFA conformance values and then create the PDF as follows.

copy.setPDFXConformance(PdfCopy.PDFA1B);
copy.setPdfVersion(PdfCopy.VERSION_1_4);
document.open();
ICC_Profile icc = ICC_Profile.getInstance(PROFILE);
copy.setOutputIntents("Custom", "", "http://www.color.org", "sRGB IEC61966-2.1", icc);

for(int i=1;i<=reader.getNumberOfPages();i++){
document.setPageSize(reader.getPageSizeWithRotation(i));
copy.addPage(copy.getImportedPage(reader, i));
}
copy.createXmpMetadata();
copy.close();
document.close();
reader.close();


I got another error report from SolidFrameowrk<http://www.validatepdfa.com/online.htm> validations as follows.

- <metadata>
<problem severity="error" objectID="27" clause="6.7" standard="pdfa">Language qualifier missing for property 'dc:description'</problem>
<problem severity="error" objectID="27" clause="6.7" standard="pdfa">Language qualifier missing for property 'dc:title'</problem>
<problem severity="error" objectID="27" clause="TN0003" standard="pdfa">Property 'pdf:keywords' shall use a custom embedded schema</problem>
<problem severity="error" objectID="27" clause="6.7.3" standard="pdfa">Document information entry 'Keywords' not synchronized with metadata property 'pdf:Keywords'</problem>
</metadata>
- <fonts>
<problem severity="error" objectID="12" clause="6.3.5" standard="pdfa">Missing or incorrect CIDSet for CIDFont subset</problem>
<problem severity="error" objectID="18" clause="6.3.5" standard="pdfa">Missing or incorrect CIDSet for CIDFont subset</problem>
</fonts>

What can be the issue? Any reply is highly appreciated.

Thank you.
-Manulak Dissanayake



BstRgds;
Manulak


------------------------------------------------------------------------------



CONFIDENTIALITY AND DISCLAIMER NOTICE



This e-mail, including any attachments, is confidential and for use only by

the intended recipient. If you are not the intended recipient, please notify

us immediately and delete this e-mail from your system. Any use or disclosure

of the information contained herein is strictly prohibited. As internet

communications are not secure, we do not accept legal responsibility for the

contents of this message nor responsibility for any change made to this

message after it was sent by the original sender. We advise you to carry out

your own virus check as we cannot accept liability for damage resulting from

software viruses.



------------------------------------------------------------------------------



CONFIDENTIALITY AND DISCLAIMER NOTICE



This e-mail, including any attachments, is confidential and for use only by

the intended recipient. If you are not the intended recipient, please notify

us immediately and delete this e-mail from your system. Any use or disclosure

of the information contained herein is strictly prohibited. As internet

communications are not secure, we do not accept legal responsibility for the

contents of this message nor responsibility for any change made to this

message after it was sent by the original sender. We advise you to carry out

your own virus check as we cannot accept liability for damage resulting from

software viruses.



------------------------------------------------------------------------------

CONFIDENTIALITY AND DISCLAIMER NOTICE

This e-mail, including any attachments, is confidential and for use only by
the intended recipient. If you are not the intended recipient, please notify
us immediately and delete this e-mail from your system. Any use or disclosure
of the information contained herein is strictly prohibited. As internet
communications are not secure, we do not accept legal responsibility for the
contents of this message nor responsibility for any change made to this
message after it was sent by the original sender. We advise you to carry out
your own virus check as we cannot accept liability for damage resulting from
software viruses.
mkl
2012-08-29 08:36:49 UTC
Permalink
Manulak,
Post by Manulak Dissanayake
So I have mentioned the code I added to convert the PDF to PDFA/1b below.
I am using iText.jar (lowagie) 2.1.6 and got to know that it is not
supported now. And as Micheal described, I can't convert PDF to PDFA
complaint PDFS using iText.
I tried with using the same code in latest versions and was not
successful. Do you think my approach with converting PDFA complaint PDFS
from existing PDF files is not correct? And impossible?
Any suggestions?
It is not strictly impossible to use iText to convert arbitrary PDFs to
PDF/A as the iText low level API allows you to to nearly everything allowed
in PDF. It is a very big project, though, especially if the PDFs to convert
really are arbitrary. It's safe to assume that programming that as a single
developer takes more than a year.
Post by Manulak Dissanayake
This will create the PDFA/1b complaint PDF correctly. So the problem is
with those which I removed. This is a mismatch between PDF Schema and the
Dublin core schema if I am correct.
iText used to assume everyone uses the recommended namespace prefixes and,
therefore, failed for source PDFs which didn't.

But the metadata are merely a tiny part of the conversion problem. I would
propose you initially create PDFs as PDF/as, and for people who don't want
that, you stamp those PDF/as in a non-compliant manner. (If such a
distinction is required, that is!)

Regards, Michael



--
View this message in context: http://itext-general.2136553.n4.nabble.com/PDF-Validation-error-with-PDF-A1b-complaince-tp4655986p4656073.html
Sent from the iText - General mailing list archive at Nabble.com.
Manulak Dissanayake
2012-09-04 05:29:13 UTC
Permalink
Hi



Thanks for the information.

Creating the PDFs as PDFA complaint files from the scratch is my second option as it is not possible right now. So I tried adding the schema values first to the created PDF, and then create a new file which is a PDFA conversion of the previous file.
In my method converToPDFA (which I explained in earlier messages), I added a call before all as follows.


public void convertToPdfA(File file1, File file2) { \\This "file2" will be the newly converted file to PDFA
file1 = editPDFSchema(file1);
PdfReader reader = null;
Document document = null;
......................



And I added that new method as follows...


private File editPDFSchema(File file1) {
File newFile = null;
PdfReader reader = null;
Document document = null;

File newFile = null;
try {
PdfReader reader = new PdfReader(new RandomAccessFileOrArray(file1.getPath()), null);
PdfStamper stamper = new PdfStamper(reader, new FileOutputStream(newFile));
HashMap info = reader.getInfo();
info.put("Subject", "Report Designer Operational Report");
info.put("Author", "Report ");
info.put("Keywords", "PDF/A compliant");
info.put("Title", " Designer Report");
info.put("Creator", "Application");
stamper.setMoreInfo(info);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
XmpWriter xmp = new XmpWriter(baos, info);
xmp.close();
stamper.setXmpMetadata(baos.toByteArray());
stamper.close();
return newFile;
} catch (Exception ex) {
writeLog(ex.getMessage());
return file1;

}



Still this makes the PDF as PDFA but does not validate.

Can you please help me to maybe update the already created PDF like that, and then do the PDFA conversion?

Thank you in advance...!

- Manulak





-----Original Message-----
From: mkl [mailto:***@wir-sind-cool.org]
Sent: Wednesday, August 29, 2012 2:07 PM
To: itext-***@lists.sourceforge.net
Subject: [iText-questions] [SPAM] Re: PDF Validation error with PDF/A1b complaince



It is not strictly impossible to use iText to convert arbitrary PDFs to PDF/A as the iText low level API allows you to to nearly everything allowed in PDF. It is a very big project, though, especially if the PDFs to convert really are arbitrary. It's safe to assume that programming that as a single developer takes more than a year.

iText used to assume everyone uses the recommended namespace prefixes and, therefore, failed for source PDFs which didn't.



But the metadata are merely a tiny part of the conversion problem. I would propose you initially create PDFs as PDF/as, and for people who don't want that, you stamp those PDF/as in a non-compliant manner. (If such a distinction is required, that is!)



Regards, Michael







--

View this message in context: http://itext-general.2136553.n4.nabble.com/PDF-Validation-error-with-PDF-A1b-complaince-tp4655986p4656073.html

Sent from the iText - General mailing list archive at Nabble.com.



------------------------------------------------------------------------------

Live Security Virtual Conference

Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

_______________________________________________

iText-questions mailing list

iText-***@lists.sourceforge.net<mailto:iText-***@lists.sourceforge.net>

https://lists.sourceforge.net/lists/listinfo/itext-questions



iText(R) is a registered trademark of 1T3XT BVBA.

Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/ Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php

------------------------------------------------------------------------------

CONFIDENTIALITY AND DISCLAIMER NOTICE

This e-mail, including any attachments, is confidential and for use only by
the intended recipient. If you are not the intended recipient, please notify
us immediately and delete this e-mail from your system. Any use or disclosure
of the information contained herein is strictly prohibited. As internet
communications are not secure, we do not accept legal responsibility for the
contents of this message nor responsibility for any change made to this
message after it was sent by the original sender. We advise you to carry out
your own virus check as we cannot accept liability for damage resulting from
software viruses.
Manulak Dissanayake
2012-09-05 04:28:51 UTC
Permalink
Hi Again

I found and experienced that the conversion of an existing PDF to a PDF A complaint ones is merely impossible (or very hard and long process to do so) and still I found that the problem is with the PDF Schema values when the newly added metadata values are not matching with them.
I further found that it is quite possible to read a PDF and edit the PDF Schema meta data. So I tried reading the existing PDF to an existing PdfCopy, add metadata to it, and then forward it to the convertPdfA() method which is stated in my below mail.
But still it doesn't work. (Assume that the file1 is the existing PDF and the file2 is the PDFA complaint file which is the output)

PdfReader reader = new PdfReader(new RandomAccessFileOrArray(file1.getPath()), null);
PdfStamper stamper = new PdfStamper(reader, new FileOutputStream(newFile));
HashMap info = reader.getInfo();

info.put("Subject", "Report Executor");
info.put("Author", "Report building logic");
info.put("Keywords", "PDF/A compliant");
info.put("Title", "Report");
info.put("Creator", "Application reporting");
stamper.setMoreInfo(info);

ByteArrayOutputStream bo = new ByteArrayOutputStream();
XmpWriter xmp = new XmpWriter(bo, info);
xmp.close();
stamper.setXmpMetadata(bo.toByteArray());
stamper.close();
(I call this method before calling the convertToPdfA method, and then it will return file1 with modified PDF document information)

In my already existing PDF (which is to be converted to PDFA), only the following metadata are there.
(When executed - reader.getInfo() )
[0] "Type => Info"
[1] "Producer => null"

My PDF which was converted to PDFA from my convertToPdfA method compliance to PDFA/1b correctly when I removed the title, keywords and subject fields from the PDF information.
(Removed code)

//document.addTitle(reader.getInfo().get("Title").toString());

//document.addKeywords(reader.getInfo().get("Keywords").toString());

//document.addSubject(reader.getInfo().get("Subject").toString());

So it confirms that the above three properties are not existing in PDF dictionary values, and if anyhow we can add those values to the already created PDF and then pass it to conversion, it should work.
How can I change my approach? As this is not working for me, do you have any more suggestions?
Is that enough to update only the PDF Schema like this and then use my convertToPdfA method given below?

Thank you in advance.
-Manulak Dissanayake


From: Manulak Dissanayake
Sent: Tuesday, September 04, 2012 10:59 AM
To: itext-***@lists.sourceforge.net
Subject: RE: [iText-questions] [SPAM] Re: PDF Validation error with PDF/A1b complaince


Hi



Thanks for the information.

Creating the PDFs as PDFA complaint files from the scratch is my second option as it is not possible right now. So I tried adding the schema values first to the created PDF, and then create a new file which is a PDFA conversion of the previous file.
In my method converToPDFA (which I explained in earlier messages), I added a call before all as follows.


public void convertToPdfA(File file1, File file2) { \\ This "file2" will be the newly converted file to PDFA
file1 = editPDFSchema(file1);
PdfReader reader = null;
Document document = null;
......................



And I added that new method as follows...


private File editPDFSchema(File file1) {
File newFile = null;
PdfReader reader = null;
Document document = null;

File newFile = null;
try {
PdfReader reader = new PdfReader(new RandomAccessFileOrArray(file1.getPath()), null);
PdfStamper stamper = new PdfStamper(reader, new FileOutputStream(newFile));
HashMap info = reader.getInfo();
info.put("Subject", "Report Designer Operational Report");
info.put("Author", "Report ");
info.put("Keywords", "PDF/A compliant");
info.put("Title", " Designer Report");
info.put("Creator", "Application");
stamper.setMoreInfo(info);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
XmpWriter xmp = new XmpWriter(baos, info);
xmp.close();
stamper.setXmpMetadata(baos.toByteArray());
stamper.close();
return newFile;
} catch (Exception ex) {
writeLog(ex.getMessage());
return file1;

}



Still this makes the PDF as PDFA but does not validate.

Can you please help me to maybe update the already created PDF like that, and then do the PDFA conversion?

Thank you in advance...!

- Manulak





-----Original Message-----
From: mkl [mailto:***@wir-sind-cool.org]<mailto:[mailto:***@wir-sind-cool.org]>
Sent: Wednesday, August 29, 2012 2:07 PM
To: itext-***@lists.sourceforge.net<mailto:itext-***@lists.sourceforge.net>
Subject: [iText-questions] [SPAM] Re: PDF Validation error with PDF/A1b complaince



It is not strictly impossible to use iText to convert arbitrary PDFs to PDF/A as the iText low level API allows you to to nearly everything allowed in PDF. It is a very big project, though, especially if the PDFs to convert really are arbitrary. It's safe to assume that programming that as a single developer takes more than a year.

iText used to assume everyone uses the recommended namespace prefixes and, therefore, failed for source PDFs which didn't.



But the metadata are merely a tiny part of the conversion problem. I would propose you initially create PDFs as PDF/as, and for people who don't want that, you stamp those PDF/as in a non-compliant manner. (If such a distinction is required, that is!)



Regards, Michael







--

View this message in context: http://itext-general.2136553.n4.nabble.com/PDF-Validation-error-with-PDF-A1b-complaince-tp4655986p4656073.html

Sent from the iText - General mailing list archive at Nabble.com.



------------------------------------------------------------------------------

Live Security Virtual Conference

Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

_______________________________________________

iText-questions mailing list

iText-***@lists.sourceforge.net<mailto:iText-***@lists.sourceforge.net>

https://lists.sourceforge.net/lists/listinfo/itext-questions



iText(R) is a registered trademark of 1T3XT BVBA.

Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/ Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php

------------------------------------------------------------------------------

CONFIDENTIALITY AND DISCLAIMER NOTICE

This e-mail, including any attachments, is confidential and for use only by
the intended recipient. If you are not the intended recipient, please notify
us immediately and delete this e-mail from your system. Any use or disclosure
of the information contained herein is strictly prohibited. As internet
communications are not secure, we do not accept legal responsibility for the
contents of this message nor responsibility for any change made to this
message after it was sent by the original sender. We advise you to carry out
your own virus check as we cannot accept liability for damage resulting from
software viruses.
Leonard Rosenthol
2012-09-05 11:34:16 UTC
Permalink
Have you actually read the PDF/A-1 (ISO 19005-1) standard?
Have you read the PDF 1.4 specification, which PDF/A-1 is based on?

It seems like you are trying to do this entirely via guesswork rather than reading the relevant documentation and understanding them...

Leonard

From: Manulak Dissanayake [mailto:***@ifsworld.com]
Sent: Wednesday, September 05, 2012 12:29 AM
To: Post all your questions about iText here
Subject: Re: [iText-questions] [SPAM] Re: PDF Validation error with PDF/A1b complaince

Hi Again

I found and experienced that the conversion of an existing PDF to a PDF A complaint ones is merely impossible (or very hard and long process to do so) and still I found that the problem is with the PDF Schema values when the newly added metadata values are not matching with them.
I further found that it is quite possible to read a PDF and edit the PDF Schema meta data. So I tried reading the existing PDF to an existing PdfCopy, add metadata to it, and then forward it to the convertPdfA() method which is stated in my below mail.
But still it doesn't work. (Assume that the file1 is the existing PDF and the file2 is the PDFA complaint file which is the output)

PdfReader reader = new PdfReader(new RandomAccessFileOrArray(file1.getPath()), null);
PdfStamper stamper = new PdfStamper(reader, new FileOutputStream(newFile));
HashMap info = reader.getInfo();

info.put("Subject", "Report Executor");
info.put("Author", "Report building logic");
info.put("Keywords", "PDF/A compliant");
info.put("Title", "Report");
info.put("Creator", "Application reporting");
stamper.setMoreInfo(info);

ByteArrayOutputStream bo = new ByteArrayOutputStream();
XmpWriter xmp = new XmpWriter(bo, info);
xmp.close();
stamper.setXmpMetadata(bo.toByteArray());
stamper.close();
(I call this method before calling the convertToPdfA method, and then it will return file1 with modified PDF document information)

In my already existing PDF (which is to be converted to PDFA), only the following metadata are there.
(When executed - reader.getInfo() )
[0] "Type => Info"
[1] "Producer => null"

My PDF which was converted to PDFA from my convertToPdfA method compliance to PDFA/1b correctly when I removed the title, keywords and subject fields from the PDF information.
(Removed code)

//document.addTitle(reader.getInfo().get("Title").toString());

//document.addKeywords(reader.getInfo().get("Keywords").toString());

//document.addSubject(reader.getInfo().get("Subject").toString());

So it confirms that the above three properties are not existing in PDF dictionary values, and if anyhow we can add those values to the already created PDF and then pass it to conversion, it should work.
How can I change my approach? As this is not working for me, do you have any more suggestions?
Is that enough to update only the PDF Schema like this and then use my convertToPdfA method given below?

Thank you in advance.
-Manulak Dissanayake


From: Manulak Dissanayake
Sent: Tuesday, September 04, 2012 10:59 AM
To: itext-***@lists.sourceforge.net<mailto:itext-***@lists.sourceforge.net>
Subject: RE: [iText-questions] [SPAM] Re: PDF Validation error with PDF/A1b complaince


Hi



Thanks for the information.

Creating the PDFs as PDFA complaint files from the scratch is my second option as it is not possible right now. So I tried adding the schema values first to the created PDF, and then create a new file which is a PDFA conversion of the previous file.
In my method converToPDFA (which I explained in earlier messages), I added a call before all as follows.


public void convertToPdfA(File file1, File file2) { \\ This "file2" will be the newly converted file to PDFA
file1 = editPDFSchema(file1);
PdfReader reader = null;
Document document = null;
......................



And I added that new method as follows...


private File editPDFSchema(File file1) {
File newFile = null;
PdfReader reader = null;
Document document = null;

File newFile = null;
try {
PdfReader reader = new PdfReader(new RandomAccessFileOrArray(file1.getPath()), null);
PdfStamper stamper = new PdfStamper(reader, new FileOutputStream(newFile));
HashMap info = reader.getInfo();
info.put("Subject", "Report Designer Operational Report");
info.put("Author", "Report ");
info.put("Keywords", "PDF/A compliant");
info.put("Title", " Designer Report");
info.put("Creator", "Application");
stamper.setMoreInfo(info);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
XmpWriter xmp = new XmpWriter(baos, info);
xmp.close();
stamper.setXmpMetadata(baos.toByteArray());
stamper.close();
return newFile;
} catch (Exception ex) {
writeLog(ex.getMessage());
return file1;

}



Still this makes the PDF as PDFA but does not validate.

Can you please help me to maybe update the already created PDF like that, and then do the PDFA conversion?

Thank you in advance...!

- Manulak





-----Original Message-----
From: mkl [mailto:***@wir-sind-cool.org]<mailto:[mailto:***@wir-sind-cool.org]>
Sent: Wednesday, August 29, 2012 2:07 PM
To: itext-***@lists.sourceforge.net<mailto:itext-***@lists.sourceforge.net>
Subject: [iText-questions] [SPAM] Re: PDF Validation error with PDF/A1b complaince



It is not strictly impossible to use iText to convert arbitrary PDFs to PDF/A as the iText low level API allows you to to nearly everything allowed in PDF. It is a very big project, though, especially if the PDFs to convert really are arbitrary. It's safe to assume that programming that as a single developer takes more than a year.

iText used to assume everyone uses the recommended namespace prefixes and, therefore, failed for source PDFs which didn't.



But the metadata are merely a tiny part of the conversion problem. I would propose you initially create PDFs as PDF/as, and for people who don't want that, you stamp those PDF/as in a non-compliant manner. (If such a distinction is required, that is!)



Regards, Michael







--

View this message in context: http://itext-general.2136553.n4.nabble.com/PDF-Validation-error-with-PDF-A1b-complaince-tp4655986p4656073.html

Sent from the iText - General mailing list archive at Nabble.com.



------------------------------------------------------------------------------

Live Security Virtual Conference

Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

_______________________________________________

iText-questions mailing list

iText-***@lists.sourceforge.net<mailto:iText-***@lists.sourceforge.net>

https://lists.sourceforge.net/lists/listinfo/itext-questions



iText(R) is a registered trademark of 1T3XT BVBA.

Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/ Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php

------------------------------------------------------------------------------



CONFIDENTIALITY AND DISCLAIMER NOTICE



This e-mail, including any attachments, is confidential and for use only by

the intended recipient. If you are not the intended recipient, please notify

us immediately and delete this e-mail from your system. Any use or disclosure

of the information contained herein is strictly prohibited. As internet

communications are not secure, we do not accept legal responsibility for the

contents of this message nor responsibility for any change made to this

message after it was sent by the original sender. We advise you to carry out

your own virus check as we cannot accept liability for damage resulting from

software viruses.
Manulak Dissanayake
2012-09-06 08:15:43 UTC
Permalink
Hi Leonard

Yes I read the specifications and documentations up to some extent. I have tried several methods according to fulfill the required standards to be PDFA complaint. One such is to edit the PDF Schema and add values to the "Keywords" property, and then use it to generate new file with PDFA compliance. This was not successful and have tried many solutions. Some said that iText cannot specifically convert PDF to PDFA complaint ones, and some said it is bit tricky and hardy to do so. But I didn't find any clear way.
My FOP version is mighty old (version 0.20.5) has got many customizations so that, I am in a problem of upgrading it to a newer version too. So without touching FOP side, I wanted to convert the PDF to PDFA.
So the intention I got is like you can convert PDF files to PDFA complaint once from iText and still no example or a such way was exposed.
I referred the recommendations of Apache FOP : PDFA<http://xmlgraphics.apache.org/fop/1.0/pdfa.html> as well, and no luck yet.

Thanks you for the reply and any help on this issue including suggestions are highly appreciated. I think my first mail (attached)consists of my situation, and wish it will helpful for you to reply me with an idea...!

BstRgds;
Manulak

From: Leonard Rosenthol [mailto:***@adobe.com]
Sent: Wednesday, September 05, 2012 5:04 PM
To: Post all your questions about iText here
Subject: Re: [iText-questions] [SPAM] Re: PDF Validation error with PDF/A1b complaince

Have you actually read the PDF/A-1 (ISO 19005-1) standard?
Have you read the PDF 1.4 specification, which PDF/A-1 is based on?

It seems like you are trying to do this entirely via guesswork rather than reading the relevant documentation and understanding them...

Leonard

From: Manulak Dissanayake [mailto:***@ifsworld.com]<mailto:[mailto:***@ifsworld.com]>
Sent: Wednesday, September 05, 2012 12:29 AM
To: Post all your questions about iText here
Subject: Re: [iText-questions] [SPAM] Re: PDF Validation error with PDF/A1b complaince

Hi Again

I found and experienced that the conversion of an existing PDF to a PDF A complaint ones is merely impossible (or very hard and long process to do so) and still I found that the problem is with the PDF Schema values when the newly added metadata values are not matching with them.
I further found that it is quite possible to read a PDF and edit the PDF Schema meta data. So I tried reading the existing PDF to an existing PdfCopy, add metadata to it, and then forward it to the convertPdfA() method which is stated in my below mail.
But still it doesn't work. (Assume that the file1 is the existing PDF and the file2 is the PDFA complaint file which is the output)

PdfReader reader = new PdfReader(new RandomAccessFileOrArray(file1.getPath()), null);
PdfStamper stamper = new PdfStamper(reader, new FileOutputStream(newFile));
HashMap info = reader.getInfo();

info.put("Subject", "Report Executor");
info.put("Author", "Report building logic");
info.put("Keywords", "PDF/A compliant");
info.put("Title", "Report");
info.put("Creator", "Application reporting");
stamper.setMoreInfo(info);

ByteArrayOutputStream bo = new ByteArrayOutputStream();
XmpWriter xmp = new XmpWriter(bo, info);
xmp.close();
stamper.setXmpMetadata(bo.toByteArray());
stamper.close();
(I call this method before calling the convertToPdfA method, and then it will return file1 with modified PDF document information)

In my already existing PDF (which is to be converted to PDFA), only the following metadata are there.
(When executed - reader.getInfo() )
[0] "Type => Info"
[1] "Producer => null"

My PDF which was converted to PDFA from my convertToPdfA method compliance to PDFA/1b correctly when I removed the title, keywords and subject fields from the PDF information.
(Removed code)

//document.addTitle(reader.getInfo().get("Title").toString());

//document.addKeywords(reader.getInfo().get("Keywords").toString());

//document.addSubject(reader.getInfo().get("Subject").toString());

So it confirms that the above three properties are not existing in PDF dictionary values, and if anyhow we can add those values to the already created PDF and then pass it to conversion, it should work.
How can I change my approach? As this is not working for me, do you have any more suggestions?
Is that enough to update only the PDF Schema like this and then use my convertToPdfA method given below?

Thank you in advance.
-Manulak Dissanayake


From: Manulak Dissanayake
Sent: Tuesday, September 04, 2012 10:59 AM
To: itext-***@lists.sourceforge.net<mailto:itext-***@lists.sourceforge.net>
Subject: RE: [iText-questions] [SPAM] Re: PDF Validation error with PDF/A1b complaince


Hi



Thanks for the information.

Creating the PDFs as PDFA complaint files from the scratch is my second option as it is not possible right now. So I tried adding the schema values first to the created PDF, and then create a new file which is a PDFA conversion of the previous file.
In my method converToPDFA (which I explained in earlier messages), I added a call before all as follows.


public void convertToPdfA(File file1, File file2) { \\ This "file2" will be the newly converted file to PDFA
file1 = editPDFSchema(file1);
PdfReader reader = null;
Document document = null;
......................



And I added that new method as follows...


private File editPDFSchema(File file1) {
File newFile = null;
PdfReader reader = null;
Document document = null;

File newFile = null;
try {
PdfReader reader = new PdfReader(new RandomAccessFileOrArray(file1.getPath()), null);
PdfStamper stamper = new PdfStamper(reader, new FileOutputStream(newFile));
HashMap info = reader.getInfo();
info.put("Subject", "Report Designer Operational Report");
info.put("Author", "Report ");
info.put("Keywords", "PDF/A compliant");
info.put("Title", " Designer Report");
info.put("Creator", "Application");
stamper.setMoreInfo(info);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
XmpWriter xmp = new XmpWriter(baos, info);
xmp.close();
stamper.setXmpMetadata(baos.toByteArray());
stamper.close();
return newFile;
} catch (Exception ex) {
writeLog(ex.getMessage());
return file1;

}



Still this makes the PDF as PDFA but does not validate.

Can you please help me to maybe update the already created PDF like that, and then do the PDFA conversion?

Thank you in advance...!

- Manulak





-----Original Message-----
From: mkl [mailto:***@wir-sind-cool.org]<mailto:[mailto:***@wir-sind-cool.org]>
Sent: Wednesday, August 29, 2012 2:07 PM
To: itext-***@lists.sourceforge.net<mailto:itext-***@lists.sourceforge.net>
Subject: [iText-questions] [SPAM] Re: PDF Validation error with PDF/A1b complaince



It is not strictly impossible to use iText to convert arbitrary PDFs to PDF/A as the iText low level API allows you to to nearly everything allowed in PDF. It is a very big project, though, especially if the PDFs to convert really are arbitrary. It's safe to assume that programming that as a single developer takes more than a year.

iText used to assume everyone uses the recommended namespace prefixes and, therefore, failed for source PDFs which didn't.



But the metadata are merely a tiny part of the conversion problem. I would propose you initially create PDFs as PDF/as, and for people who don't want that, you stamp those PDF/as in a non-compliant manner. (If such a distinction is required, that is!)



Regards, Michael







--

View this message in context: http://itext-general.2136553.n4.nabble.com/PDF-Validation-error-with-PDF-A1b-complaince-tp4655986p4656073.html

Sent from the iText - General mailing list archive at Nabble.com.



------------------------------------------------------------------------------

Live Security Virtual Conference

Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

_______________________________________________

iText-questions mailing list

iText-***@lists.sourceforge.net<mailto:iText-***@lists.sourceforge.net>

https://lists.sourceforge.net/lists/listinfo/itext-questions



iText(R) is a registered trademark of 1T3XT BVBA.

Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/ Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php

------------------------------------------------------------------------------



CONFIDENTIALITY AND DISCLAIMER NOTICE



This e-mail, including any attachments, is confidential and for use only by

the intended recipient. If you are not the intended recipient, please notify

us immediately and delete this e-mail from your system. Any use or disclosure

of the information contained herein is strictly prohibited. As internet

communications are not secure, we do not accept legal responsibility for the

contents of this message nor responsibility for any change made to this

message after it was sent by the original sender. We advise you to carry out

your own virus check as we cannot accept liability for damage resulting from

software viruses.
Leonard Rosenthol
2012-09-06 11:34:13 UTC
Permalink
Fix your FOP - that's the best bet!

Leonard

From: Manulak Dissanayake [mailto:***@ifsworld.com]
Sent: Thursday, September 06, 2012 4:16 AM
To: Post all your questions about iText here
Subject: Re: [iText-questions] [SPAM] Re: PDF Validation error with PDF/A1b complaince

Hi Leonard

Yes I read the specifications and documentations up to some extent. I have tried several methods according to fulfill the required standards to be PDFA complaint. One such is to edit the PDF Schema and add values to the "Keywords" property, and then use it to generate new file with PDFA compliance. This was not successful and have tried many solutions. Some said that iText cannot specifically convert PDF to PDFA complaint ones, and some said it is bit tricky and hardy to do so. But I didn't find any clear way.
My FOP version is mighty old (version 0.20.5) has got many customizations so that, I am in a problem of upgrading it to a newer version too. So without touching FOP side, I wanted to convert the PDF to PDFA.
So the intention I got is like you can convert PDF files to PDFA complaint once from iText and still no example or a such way was exposed.
I referred the recommendations of Apache FOP : PDFA<http://xmlgraphics.apache.org/fop/1.0/pdfa.html> as well, and no luck yet.

Thanks you for the reply and any help on this issue including suggestions are highly appreciated. I think my first mail (attached)consists of my situation, and wish it will helpful for you to reply me with an idea...!

BstRgds;
Manulak

From: Leonard Rosenthol [mailto:***@adobe.com]<mailto:[mailto:***@adobe.com]>
Sent: Wednesday, September 05, 2012 5:04 PM
To: Post all your questions about iText here
Subject: Re: [iText-questions] [SPAM] Re: PDF Validation error with PDF/A1b complaince

Have you actually read the PDF/A-1 (ISO 19005-1) standard?
Have you read the PDF 1.4 specification, which PDF/A-1 is based on?

It seems like you are trying to do this entirely via guesswork rather than reading the relevant documentation and understanding them...

Leonard

From: Manulak Dissanayake [mailto:***@ifsworld.com]<mailto:[mailto:***@ifsworld.com]>
Sent: Wednesday, September 05, 2012 12:29 AM
To: Post all your questions about iText here
Subject: Re: [iText-questions] [SPAM] Re: PDF Validation error with PDF/A1b complaince

Hi Again

I found and experienced that the conversion of an existing PDF to a PDF A complaint ones is merely impossible (or very hard and long process to do so) and still I found that the problem is with the PDF Schema values when the newly added metadata values are not matching with them.
I further found that it is quite possible to read a PDF and edit the PDF Schema meta data. So I tried reading the existing PDF to an existing PdfCopy, add metadata to it, and then forward it to the convertPdfA() method which is stated in my below mail.
But still it doesn't work. (Assume that the file1 is the existing PDF and the file2 is the PDFA complaint file which is the output)

PdfReader reader = new PdfReader(new RandomAccessFileOrArray(file1.getPath()), null);
PdfStamper stamper = new PdfStamper(reader, new FileOutputStream(newFile));
HashMap info = reader.getInfo();

info.put("Subject", "Report Executor");
info.put("Author", "Report building logic");
info.put("Keywords", "PDF/A compliant");
info.put("Title", "Report");
info.put("Creator", "Application reporting");
stamper.setMoreInfo(info);

ByteArrayOutputStream bo = new ByteArrayOutputStream();
XmpWriter xmp = new XmpWriter(bo, info);
xmp.close();
stamper.setXmpMetadata(bo.toByteArray());
stamper.close();
(I call this method before calling the convertToPdfA method, and then it will return file1 with modified PDF document information)

In my already existing PDF (which is to be converted to PDFA), only the following metadata are there.
(When executed - reader.getInfo() )
[0] "Type => Info"
[1] "Producer => null"

My PDF which was converted to PDFA from my convertToPdfA method compliance to PDFA/1b correctly when I removed the title, keywords and subject fields from the PDF information.
(Removed code)

//document.addTitle(reader.getInfo().get("Title").toString());

//document.addKeywords(reader.getInfo().get("Keywords").toString());

//document.addSubject(reader.getInfo().get("Subject").toString());

So it confirms that the above three properties are not existing in PDF dictionary values, and if anyhow we can add those values to the already created PDF and then pass it to conversion, it should work.
How can I change my approach? As this is not working for me, do you have any more suggestions?
Is that enough to update only the PDF Schema like this and then use my convertToPdfA method given below?

Thank you in advance.
-Manulak Dissanayake


From: Manulak Dissanayake
Sent: Tuesday, September 04, 2012 10:59 AM
To: itext-***@lists.sourceforge.net<mailto:itext-***@lists.sourceforge.net>
Subject: RE: [iText-questions] [SPAM] Re: PDF Validation error with PDF/A1b complaince


Hi



Thanks for the information.

Creating the PDFs as PDFA complaint files from the scratch is my second option as it is not possible right now. So I tried adding the schema values first to the created PDF, and then create a new file which is a PDFA conversion of the previous file.
In my method converToPDFA (which I explained in earlier messages), I added a call before all as follows.


public void convertToPdfA(File file1, File file2) { \\ This "file2" will be the newly converted file to PDFA
file1 = editPDFSchema(file1);
PdfReader reader = null;
Document document = null;
......................



And I added that new method as follows...


private File editPDFSchema(File file1) {
File newFile = null;
PdfReader reader = null;
Document document = null;

File newFile = null;
try {
PdfReader reader = new PdfReader(new RandomAccessFileOrArray(file1.getPath()), null);
PdfStamper stamper = new PdfStamper(reader, new FileOutputStream(newFile));
HashMap info = reader.getInfo();
info.put("Subject", "Report Designer Operational Report");
info.put("Author", "Report ");
info.put("Keywords", "PDF/A compliant");
info.put("Title", " Designer Report");
info.put("Creator", "Application");
stamper.setMoreInfo(info);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
XmpWriter xmp = new XmpWriter(baos, info);
xmp.close();
stamper.setXmpMetadata(baos.toByteArray());
stamper.close();
return newFile;
} catch (Exception ex) {
writeLog(ex.getMessage());
return file1;

}



Still this makes the PDF as PDFA but does not validate.

Can you please help me to maybe update the already created PDF like that, and then do the PDFA conversion?

Thank you in advance...!

- Manulak





-----Original Message-----
From: mkl [mailto:***@wir-sind-cool.org]<mailto:[mailto:***@wir-sind-cool.org]>
Sent: Wednesday, August 29, 2012 2:07 PM
To: itext-***@lists.sourceforge.net<mailto:itext-***@lists.sourceforge.net>
Subject: [iText-questions] [SPAM] Re: PDF Validation error with PDF/A1b complaince



It is not strictly impossible to use iText to convert arbitrary PDFs to PDF/A as the iText low level API allows you to to nearly everything allowed in PDF. It is a very big project, though, especially if the PDFs to convert really are arbitrary. It's safe to assume that programming that as a single developer takes more than a year.

iText used to assume everyone uses the recommended namespace prefixes and, therefore, failed for source PDFs which didn't.



But the metadata are merely a tiny part of the conversion problem. I would propose you initially create PDFs as PDF/as, and for people who don't want that, you stamp those PDF/as in a non-compliant manner. (If such a distinction is required, that is!)



Regards, Michael







--

View this message in context: http://itext-general.2136553.n4.nabble.com/PDF-Validation-error-with-PDF-A1b-complaince-tp4655986p4656073.html

Sent from the iText - General mailing list archive at Nabble.com.



------------------------------------------------------------------------------

Live Security Virtual Conference

Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

_______________________________________________

iText-questions mailing list

iText-***@lists.sourceforge.net<mailto:iText-***@lists.sourceforge.net>

https://lists.sourceforge.net/lists/listinfo/itext-questions



iText(R) is a registered trademark of 1T3XT BVBA.

Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/ Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php

------------------------------------------------------------------------------



CONFIDENTIALITY AND DISCLAIMER NOTICE



This e-mail, including any attachments, is confidential and for use only by

the intended recipient. If you are not the intended recipient, please notify

us immediately and delete this e-mail from your system. Any use or disclosure

of the information contained herein is strictly prohibited. As internet

communications are not secure, we do not accept legal responsibility for the

contents of this message nor responsibility for any change made to this

message after it was sent by the original sender. We advise you to carry out

your own virus check as we cannot accept liability for damage resulting from

software viruses.

Loading...