Пример #1
0
        internal void SaveToStream(TPdfStream DataStream, TXRefSection XRef, TAcroFormRecord AcroForm)
        {
            XRef.SetObjectOffset(Id, DataStream);
            TIndirectRecord.SaveHeader(DataStream, Id);
            BeginDictionary(DataStream);
            SaveKey(DataStream, TPdfToken.TypeName, TPdfTokens.GetString(TPdfToken.PagesName));

            SaveKids(DataStream, XRef);

            SaveKey(DataStream, TPdfToken.CountName, FList.Count);
            WriteLine(DataStream, TPdfTokens.GetString(TPdfToken.ResourcesName));
            Resources.SaveResourceDesc(DataStream, XRef, true);
            EndDictionary(DataStream);
            TIndirectRecord.SaveTrailer(DataStream);

            int aCount = FList.Count;

            for (int i = 0; i < aCount; i++)
            {
                TPageInfo PInfo = FList[i];
                TPageRecord.SaveToStream(DataStream, Id, PInfo, AcroForm, XRef, i, aCount);
                PInfo.Annots.SaveToStream(DataStream, XRef);
            }

            Resources.SaveObjects(DataStream, XRef);
        }
Пример #2
0
        internal void SaveToStream(TPdfStream DataStream, TXRefSection XRef, TPageInfo ParentPage)
        {
            int aCount = Count;

            for (int i = 0; i < aCount; i++)
            {
                Fields[i].SaveToStream(DataStream, XRef, ParentPage);
            }
        }
Пример #3
0
        internal void SaveToStream(TPdfStream DataStream, TXRefSection XRef, TPageInfo ParentPage)
        {
            if (FieldList.Count <= 0)
            {
                return;                                    //No AcroForm in this file.
            }
            XRef.SetObjectOffset(GetId(DataStream, XRef), DataStream);
            TIndirectRecord.SaveHeader(DataStream, FId);
            BeginDictionary(DataStream);
            SaveKey(DataStream, TPdfToken.FieldsName, FieldList.GetCallArray(DataStream, XRef, false));

            SaveKey(DataStream, TPdfToken.SigFlagsName, SigFlags);
            EndDictionary(DataStream);
            TIndirectRecord.SaveTrailer(DataStream);

            FieldList.SaveToStream(DataStream, XRef, ParentPage);
        }
Пример #4
0
 internal static void SaveToStream(TPdfStream DataStream, int PageListId, TPageInfo PageInfo, TAcroFormRecord AcroForm, TXRefSection XRef, int PageNumber, int PageCount)
 {
     XRef.SetObjectOffset(PageInfo.Id, DataStream);
     TIndirectRecord.SaveHeader(DataStream, PageInfo.Id);
     BeginDictionary(DataStream);
     SaveKey(DataStream, TPdfToken.TypeName, TPdfTokens.GetString(TPdfToken.PageName));
     SaveKey(DataStream, TPdfToken.ParentName, TIndirectRecord.GetCallObj(PageListId));
     SaveKey(DataStream, TPdfToken.ContentsName, TIndirectRecord.GetCallObj(PageInfo.Contents.Id));
     SaveKey(DataStream, TPdfToken.MediaBoxName,
             TPdfTokens.GetString(TPdfToken.OpenArray) +
             "0 0 " +
             PdfConv.CoordsToString(PageInfo.Contents.PageSize.Width * 72 / 100) + " " +
             PdfConv.CoordsToString(PageInfo.Contents.PageSize.Height * 72 / 100) +
             TPdfTokens.GetString(TPdfToken.CloseArray)
             );
     if (PageInfo.Annots.HasAnnots(AcroForm, PageNumber, PageCount))
     {
         SaveKey(DataStream, TPdfToken.AnnotsName, PageInfo.Annots.GetCallArray(DataStream, XRef, AcroForm, PageNumber, PageCount));
     }
     EndDictionary(DataStream);
     TIndirectRecord.SaveTrailer(DataStream);
 }
Пример #5
0
        internal override void SaveToStream(TPdfStream DataStream, TXRefSection XRef, TPageInfo ParentPage)
        {
            BeginSaveToStream(DataStream, XRef);

            //Annot
            SaveKey(DataStream, TPdfToken.TypeName, TPdfTokens.GetString(TPdfToken.AnnotName));             //Annots and Fields mix their dictionaries. See "Digital Signature Appearances" to see why annots are required even in non visible sigs.
            SaveKey(DataStream, TPdfToken.SubtypeName, TPdfTokens.GetString(TPdfToken.WidgetName));

            RectangleF           Rect = new RectangleF(0, 0, 0, 0);
            TPdfVisibleSignature VSig = Signature as TPdfVisibleSignature;

            int APId = -1;

            if (VSig != null)
            {
                Rect = VSig.Rect;
                APId = SaveAPRef(DataStream, XRef);
            }

            SaveKey(DataStream, TPdfToken.RectName,
                    TPdfTokens.GetString(TPdfToken.OpenArray) +
                    String.Format(CultureInfo.InvariantCulture, "{0} {1} {2} {3}", Rect.Left, Rect.Top, Rect.Right, Rect.Bottom) +
                    TPdfTokens.GetString(TPdfToken.CloseArray)
                    );

            SaveKey(DataStream, TPdfToken.PName, TIndirectRecord.GetCallObj(ParentPage.Id));
            SaveKey(DataStream, TPdfToken.FName, 132);              //bits 3 and 8

            //Field
            SaveKey(DataStream, TPdfToken.FTName, TPdfTokens.GetString(TPdfToken.SigName));
            if (Signature.Name != null)
            {
                SaveUnicodeKey(DataStream, TPdfToken.TName, Signature.Name);
            }
            SaveKey(DataStream, TPdfToken.FfName, 1);

            XRef.SetObjectOffset(GetSigDictionaryId(DataStream, XRef), DataStream);
            SaveKey(DataStream, TPdfToken.VName, TIndirectRecord.GetCallObj(SigDictionaryId));

            EndSaveToStream(DataStream, XRef);

            if (VSig != null)
            {
                SaveAPObj(DataStream, XRef, APId, VSig);
            }

            SaveSigDictionary(DataStream, XRef, SigDictionaryId);
        }
Пример #6
0
 internal abstract void SaveToStream(TPdfStream DataStream, TXRefSection XRef, TPageInfo ParentPage);