You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Manulak Dissanayake <ma...@ifsworld.com> on 2012/09/05 06:18:26 UTC

RE: Problem with the PDFA1B compliance

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 baos = new ByteArrayOutputStream();
      XmpWriter xmp = new XmpWriter(baos, info);
      xmp.close();
      stamper.setXmpMetadata(baos.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 [mailto:manulak.dissanayake@ifsworld.com]
Sent: Thursday, August 23, 2012 4:38 PM
To: fop-users@xmlgraphics.apache.org
Subject: Problem with the PDFA1B compliance


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



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



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.


Re: Problem with the PDFA1B compliance

Posted by Pascal Sancho <ps...@gmail.com>.
Hi,
By customizing a very old FOP version, you 'll take the risk to have
your own version of FOP, and getting help about it will become more
and more difficult for (at least) 2 reasons:
 - old design knowledge is smaller each year,
 - nobody else knows what changes you made in your customized FOP.
So, I understand that you are not ready to upgrade, but that should be
done as a start point to get some help. So I suggest you to upgrade
FOP, since current releases support natively PDFA.

On the other hand, tweaking PDF is a little bit out off topic here, so
I encourage you to ask such question on more relevant list, you'll get
more efficient responses.

2012/9/6 Manulak Dissanayake <ma...@ifsworld.com>:
> Hi Alex
>
>
>
> Thank you for the reply.
>
>
>
> I am using the FOP version 0.20.5 which is quite old, but with many
> customizations done form long time back. So it was not possible for me to
> upgrade the FOP version. I have followed those forums and recommendations
> from Apache but tried converting the already created PDF (using suggestions
> like changing the PDF Schema and make it complaint) as it looks more viable
> than touching the FOP.
>
> But what I am still wondering if it is possible or not to convert an
> existing PDF to be complaint to PDFA. I read many sources and found that the
> error “The property 'pdf:keywords' is not defined in schema 'Adobe PDF
> Schema” could be solved by updating the PDF Schema of the PDF which is
> already created, and then try converting to the PDFA complaint PDF. But it
> wasn’t successful. Do you think there is something to be tested more than
> that?
>
>
>
> Anyway, I will test your suggestion related to xmlgraphics as well as the
> XSL:FO input and will get back to you.
>
>
>
> Thanks again.
>
> -Manulak
>
>
>
>
>
> -----Original Message-----
> From: Alexios Giotis [mailto:alex.giotis@gmail.com]
> Sent: Wednesday, September 05, 2012 5:33 PM
> To: fop-users@xmlgraphics.apache.org
> Subject: Re: Problem with the PDFA1B compliance
>
>
>
> Hi Manulak,
>
>
>
> You have not written what version of FOP you use to create the original PDF.
> Instead of trying to make the PDF created by FOP PDF/A-1b compliant, why
> don't you directly tell FOP to create such a file ? Have you read [1] ?
>
>
>
> Although I read with interest your attempt to convert with iText an existing
> PDF to PDF/A-1b, I am afraid that is not a list for such issues. If [1] does
> not answer your questions or the output is still not PDF/A-1b compliant, you
> will also have to provide the XSL:FO input.
>
>
>
>
>
> [1] http://xmlgraphics.apache.org/fop/1.0/pdfa.html
>
>
>
> HTH,
>
> Alex Giotis
>
>
> On 5 Sep 2012, at 07:18, Manulak Dissanayake
> <ma...@ifsworld.com> wrote:
>
>
>
>> Hi Again


-- 
pascal

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


RE: Problem with the PDFA1B compliance

Posted by Manulak Dissanayake <ma...@ifsworld.com>.
Hi Alex



Thank you for the reply.



I am using the FOP version 0.20.5 which is quite old, but with many customizations done form long time back. So it was not possible for me to upgrade the FOP version. I have followed those forums and recommendations from Apache but tried converting the already created PDF (using suggestions like changing the PDF Schema and make it complaint) as it looks more viable than touching the FOP.

But what I am still wondering if it is possible or not to convert an existing PDF to be complaint to PDFA. I read many sources and found that the error "The property 'pdf:keywords' is not defined in schema 'Adobe PDF Schema" could be solved by updating the PDF Schema of the PDF which is already created, and then try converting to the PDFA complaint PDF. But it wasn't successful. Do you think there is something to be tested more than that?



Anyway, I will test your suggestion related to xmlgraphics as well as the XSL:FO input and will get back to you.



Thanks again.

-Manulak





-----Original Message-----
From: Alexios Giotis [mailto:alex.giotis@gmail.com]
Sent: Wednesday, September 05, 2012 5:33 PM
To: fop-users@xmlgraphics.apache.org
Subject: Re: Problem with the PDFA1B compliance



Hi Manulak,



You have not written what version of FOP you use to create the original PDF. Instead of trying to make the PDF created by FOP PDF/A-1b compliant, why don't you directly tell FOP to create such a file ? Have you read [1] ?



Although I read with interest your attempt to convert with iText an existing PDF to PDF/A-1b, I am afraid that is not a list for such issues. If [1] does not answer your questions or the output is still not PDF/A-1b compliant, you will also have to provide the XSL:FO input.





[1] http://xmlgraphics.apache.org/fop/1.0/pdfa.html



HTH,

Alex Giotis







On 5 Sep 2012, at 07:18, Manulak Dissanayake <ma...@ifsworld.com>> wrote:



> Hi Again

>

> I

...





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

To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org<ma...@xmlgraphics.apache.org>

For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org<ma...@xmlgraphics.apache.org>



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

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.


Re: Problem with the PDFA1B compliance

Posted by Alexios Giotis <al...@gmail.com>.
Hi Manulak,

You have not written what version of FOP you use to create the original PDF. Instead of trying to make the PDF created by FOP PDF/A-1b compliant, why don't you directly tell FOP to create such a file ? Have you read [1] ?

Although I read with interest your attempt to convert with iText an existing PDF to PDF/A-1b, I am afraid that is not a list for such issues. If [1] does not answer your questions or the output is still not PDF/A-1b compliant, you will also have to provide the XSL:FO input.


[1] http://xmlgraphics.apache.org/fop/1.0/pdfa.html

HTH,
Alex Giotis



On 5 Sep 2012, at 07:18, Manulak Dissanayake <ma...@ifsworld.com> wrote:

> Hi Again
>  
> I
...


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org