Hello,

I'm using:
- Itext v5.4.1
- Oracle Java v1.7.0_17 32 Bits

My objective: Read a pdf file and fill the metadata. 

My code:

#> FOR PDF:
public static void main(String[] args) {
  Document document = new Document(PageSize.A4);
  PdfWriter writer = PdfWriter.getInstance(document, outputStream);
  
  String title    = new String("Test Title");
  String author   = new String("Test Author");
  String subject  = new String("Test Subject");
  String creator  = new String("Test Creator");
  String keywords = new String("Keyword Test0, Keyword Test1");

  document.addTitle(title);
  document.addAuthor(author);
  document.addSubject(subject);
  document.addCreator(creator);
  document.addKeywords(keywords);
  
  document.open();
  document.close();
  writer.close();

  outputStream.flush();
  outputStream.close(); 
}

#> FOR PDFA-1B:
public static void main(String[] args) {
  Document document = new Document(PageSize.A4);
  PdfAWriter writer = PdfAWriter.getInstance(document, outputStream,
PdfAConformanceLevel.PDF_A_1B);
  
  String title    = new String("Test Title");
  String author   = new String("Test Author");
  String subject  = new String("Test Subject");
  String creator  = new String("Test Creator");
  String keywords = new String("Keyword Test0, Keyword Test1");

  document.addTitle(title);
  document.addAuthor(author);
  document.addSubject(subject);
  document.addCreator(creator);
  document.addKeywords(keywords);
  writer.createXmpMetadata();
  
  document.open();
  document.close();
  writer.close();

  outputStream.flush();
  outputStream.close(); 
}

The Result:
#> For pdf: https://www.dropbox.com/s/bx80ro3kavxuwo5/pdfMetadataError.jpg
#> For pdfa-1b:
https://www.dropbox.com/s/d73pwenbvak40sb/pdfAMetadataError.jpg

In version 5.3.5 of Itext it's does not happen. 




--
View this message in context: 
http://itext-general.2136553.n4.nabble.com/Itext-5-4-1-Metadata-Bug-tp4658360.html
Sent from the iText - General mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
_______________________________________________
iText-questions mailing list
iText-questions@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

Reply via email to