On 21/05/2013 5:57, Vaibhav Gandhi wrote:

Hi,

Can anybody help me in this issue, please ?


Yes, you should call HP and tell them their PDF has an inconsistency.

Please open your PDF in a text editor, and look at the first object (the one with number 9):

9 0 obj
<<
/Author (Ian Dallow)
/CreationDate ()
/Creator (HP Digital Sending Device)
/ModDate (D:20130508044059+04'00')
/Producer (HP Digital Sending Device)
/Subject (testing)
/Title (test title)
>>
endobj


As you can see, the value for the CreationDate is an empty string, which is EXACTLY what iText tells you when you ask iText for the CreationDate entry in the Info dictionary (and it's very frustrating when people imply that there's a bug in iText when iText is COMPLETELY CORRECT)!

Then why do you see a date when you open the PDF in Adobe Reader? Because there's a CreationDate in the XMP data. Scroll to object number 4, and you'll find a tag named CreateDate:

4 0 obj
<<
/Length 3652
/Subtype /XML
/Type /Metadata
>>
stream
<?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 5.4-c005 78.147326, 2012/08/23-13:03:03 ">
   <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";>
      <rdf:Description rdf:about=""
            xmlns:dc="http://purl.org/dc/elements/1.1/";
            xmlns:pdf="http://ns.adobe.com/pdf/1.3/";
            xmlns:xmp="http://ns.adobe.com/xap/1.0/";
            xmlns:xmpMM="http://ns.adobe.com/xap/1.0/mm/";>
         <dc:format>application/pdf</dc:format>
         <dc:creator>
            <rdf:Seq>
               <rdf:li>Ian Dallow</rdf:li>
            </rdf:Seq>
         </dc:creator>
         <dc:description>
            <rdf:Alt>
               <rdf:li xml:lang="x-default">testing</rdf:li>
            </rdf:Alt>
         </dc:description>
         <dc:title>
            <rdf:Alt>
               <rdf:li xml:lang="x-default">test title</rdf:li>
            </rdf:Alt>
         </dc:title>
         <pdf:CreationDate--Text/>
         <pdf:Producer>HP Digital Sending Device</pdf:Producer>
         <xmp:CreatorTool>HP Digital Sending Device</xmp:CreatorTool>
<xmp:ModifyDate>2013-04-23T16:54:07+01:00</xmp:ModifyDate>
<xmp:CreateDate>2013-04-23T16:53:22+01:00</xmp:CreateDate>
<xmp:MetadataDate>2013-04-23T16:54:07+01:00</xmp:MetadataDate>
<xmpMM:DocumentID>uuid:d600fdb0-1392-49dd-9132-0da4f9c5d597</xmpMM:DocumentID>
<xmpMM:InstanceID>uuid:d4fec41d-9fe9-43c4-9b8f-7308e820f417</xmpMM:InstanceID>
      </rdf:Description>
   </rdf:RDF>
</x:xmpmeta>
<?xpacket end="w"?>
endstream

In other words: you're looking at the wrong place for the date! You need to get the Metadata stream and parse it for the CreateDate.
------------------------------------------------------------------------------
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