1 /**************************************************************************** |
1 /**************************************************************************** |
2 ** |
2 ** |
3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
4 ** All rights reserved. |
4 ** All rights reserved. |
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
6 ** |
6 ** |
7 ** This file is part of the QtGui module of the Qt Toolkit. |
7 ** This file is part of the QtGui module of the Qt Toolkit. |
8 ** |
8 ** |
929 } |
929 } |
930 |
930 |
931 void QPdfEnginePrivate::writeInfo() |
931 void QPdfEnginePrivate::writeInfo() |
932 { |
932 { |
933 info = addXrefEntry(-1); |
933 info = addXrefEntry(-1); |
934 xprintf("<<\n" |
934 |
935 "/Title (%s)\n" |
935 // The 'text string' type in PDF is encoded either as PDFDocEncoding, or |
936 // "/Author (%s)\n" |
936 // Unicode UTF-16 with a Unicode byte order mark as the first character |
937 "/Creator (%s)\n" |
937 // (0xfeff), with the high-order byte first. |
938 "/Producer (Qt " QT_VERSION_STR " (C) 2009 Nokia Corporation and/or its subsidiary(-ies))\n", |
938 QByteArray array("<<\n/Title (\xfe\xff"); |
939 title.toUtf8().constData(), |
939 const ushort *utf16Title = title.utf16(); |
940 // author.toUtf8().constData(), |
940 for (int i=0; i < title.size(); ++i) { |
941 creator.toUtf8().constData()); |
941 array.append((*(utf16Title + i)) >> 8); |
|
942 array.append((*(utf16Title + i)) & 0xff); |
|
943 } |
|
944 array.append(")\n/Creator (\xfe\xff"); |
|
945 const ushort *utf16Creator = creator.utf16(); |
|
946 for (int i=0; i < creator.size(); ++i) { |
|
947 array.append((*(utf16Creator + i)) >> 8); |
|
948 array.append((*(utf16Creator + i)) & 0xff); |
|
949 } |
|
950 array.append(")\n/Producer (Qt " QT_VERSION_STR " (C) 2010 Nokia Corporation and/or its subsidiary(-ies))\n"); |
|
951 write(array); |
942 |
952 |
943 QDateTime now = QDateTime::currentDateTime().toUTC(); |
953 QDateTime now = QDateTime::currentDateTime().toUTC(); |
944 QTime t = now.time(); |
954 QTime t = now.time(); |
945 QDate d = now.date(); |
955 QDate d = now.date(); |
946 xprintf("/CreationDate (D:%d%02d%02d%02d%02d%02d)\n", |
956 xprintf("/CreationDate (D:%d%02d%02d%02d%02d%02d)\n", |