Пример #1
0
        internal void EndSave(TPdfStream DataStream, TXRefSection XRef, TPdfProperties Properties, TPdfSignature Signature)
        {
            FinishPage(DataStream, XRef);

            TPdfToken P = TPdfToken.None;

            switch (PageLayout)
            {
            case TPageLayout.Outlines: P = TPdfToken.UseOutlinesName; break;

            case TPageLayout.Thumbs: P = TPdfToken.UseThumbsName; break;

            case TPageLayout.FullScreen: P = TPdfToken.FullScreenName; break;
            }

            int OutlinesId = -1;

            if (Bookmarks.Count > 0)
            {
                OutlinesId = XRef.GetNewObject(DataStream);
            }

            TDocumentCatalogRecord.SaveToStream(DataStream, XRef, CatalogId, PageTree.Id, OutlinesId,
                                                AcroForm.GetId(DataStream, XRef), Perms.GetId(DataStream, XRef, AcroForm.SignatureFieldId(DataStream, XRef)), P);
            PageTree.SaveToStream(DataStream, XRef, AcroForm);
            SaveBookmarks(DataStream, XRef, OutlinesId);

            Info.SaveToStream(DataStream, XRef, Properties);

            Perms.SaveToStream(DataStream, XRef, AcroForm.SignatureFieldId(DataStream, XRef));

            AcroForm.SaveToStream(DataStream, XRef, PageTree.GetSigPage(Signature));             //We save it last because it needs to keep everything after it in memory for signing it.
        }
Пример #2
0
        internal void SaveToStream(TPdfStream DataStream, TXRefSection XRef, TPdfProperties p)
        {
            InfoId = XRef.GetNewObject(DataStream);
            TIndirectRecord.SaveHeader(DataStream, InfoId);
            BeginDictionary(DataStream);
            if (p.Title != null && p.Title.Length > 0)
            {
                SaveUnicodeKey(DataStream, TPdfToken.TitleName, p.Title);
            }
            if (p.Author != null && p.Author.Length > 0)
            {
                SaveUnicodeKey(DataStream, TPdfToken.AuthorName, p.Author);
            }
            if (p.Subject != null && p.Subject.Length > 0)
            {
                SaveUnicodeKey(DataStream, TPdfToken.SubjectName, p.Subject);
            }
            if (p.Keywords != null && p.Keywords.Length > 0)
            {
                SaveUnicodeKey(DataStream, TPdfToken.KeywordsName, p.Keywords);
            }
            if (p.Creator != null && p.Creator.Length > 0)
            {
                SaveUnicodeKey(DataStream, TPdfToken.CreatorName, p.Creator);
            }

            string Producer = TPdfTokens.GetString(TPdfToken.Producer);

            if (!PdfWriter.FTesting)
            {
                Producer += Assembly.GetExecutingAssembly().GetName().Version.ToString();
            }

            if (Producer != null && Producer.Length > 0)
            {
                SaveUnicodeKey(DataStream, TPdfToken.ProducerName, Producer);
            }

            DateTime dt = DateTime.Now;

            SaveKey(DataStream, TPdfToken.CreationDateName, TDateRecord.GetDate(dt));
            EndDictionary(DataStream);
            TIndirectRecord.SaveTrailer(DataStream);
        }