Bug#424920: pdftk update_info corrupts the CreationDate and ModDate fields
The reason is that all the strings in the info directory are written in UTF-16, which is OK for all the keys but for ModDate and CreationDate, which need to be in ASCII. Until the sixth edition of the PDF reference book, it was unclear if this was accepted. (The text says that CreationDate and ModDate are of the date type, which in turn is a string which is different from a text string) (sections 3.8.0-2 and 8.2 of the second edition). The sixth edition mades clear however that dates are ASCII strings (table 10.2 and section 3.8.0-3). I suggest something like this patch to be applied. (note that I'm not familiar at all with C++ so I kind of guessed what had to be changed) Regards, Quentin Godfroy --- Signed-off by: Quentin Godfroy [EMAIL PROTECTED] diff -ruNp pdftk-1.41/pdftk/report.cc pdftk-1.41-patch/pdftk/report.cc --- pdftk-1.41/pdftk/report.cc 2006-09-06 01:49:32.0 +0200 +++ pdftk-1.41-patch/pdftk/report.cc2008-01-21 02:19:44.0 +0100 @@ -1228,7 +1228,7 @@ UpdateInfo( itext::PdfReader* reader_p, string_to_jcharstring( jvs, jvs_size, jvs_len, it-second ); info_p-put( new itext::PdfName( JvNewStringLatin1(it-first.c_str()) ), - new itext::PdfString( JvNewString(jvs, jvs_len), itext::PdfObject::TEXT_UNICODE ) ); + new itext::PdfString( JvNewString(jvs, jvs_len), (strcmp(it-first.c_str(), ModDate) strcmp(it-first.c_str(), CreationDate)) ? itext::PdfObject::TEXT_UNICODE : itext::PdfObject::TEXT_PDFDOCENCODING) ); } } } -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Bug#424920: pdftk update_info corrupts the CreationDate and ModDate fields
Package: pdftk Version: 1.40-2 Severity: important [Severity set to important as pdftk generates corrupt data.] On some PDF files, when I use pdftk, the CreationDate and ModDate fields get corrupt. For instance, with the attached pdftk-test.pdf file: $ pdftk pdftk-test.pdf dump_data | \ pdftk pdftk-test.pdf update_info - output out.pdf $ pdfinfo pdftk-test.pdf Creator:TeX Producer: pdfTeX-1.40.3 CreationDate: Tue May 15 17:13:44 2007 ModDate:Tue May 15 17:13:44 2007 Tagged: no Pages: 1 Encrypted: no Page size: 595.276 x 841.89 pts (A4) File size: 3179 bytes Optimized: no PDF version:1.4 $ pdfinfo out.pdf Creator:TeX Producer: pdfTeX-1.40.3 CreationDate: þÿ ModDate:þÿ Tagged: no Pages: 1 Encrypted: no Page size: 595.276 x 841.89 pts (A4) File size: 3339 bytes Optimized: no PDF version:1.4 -- System Information: Debian Release: lenny/sid APT prefers unstable APT policy: (500, 'unstable'), (500, 'stable') Architecture: i386 (i686) Kernel: Linux 2.6.18-4-686-bigmem (SMP w/2 CPU cores) Locale: LANG=POSIX, LC_CTYPE=en_US.ISO8859-1 (charmap=ISO-8859-1) Shell: /bin/sh linked to /bin/bash Versions of packages pdftk depends on: ii libc6 2.5-7 GNU C Library: Shared libraries ii libgcc1 1:4.1.2-5 GCC support library ii libgcj7-0 4.1.1-20 Java runtime library for use with ii libstdc++64.1.2-5The GNU Standard C++ Library v3 pdftk recommends no packages. -- no debconf information pdftk-test.pdf Description: Adobe PDF document