Beispiel #1
0
        internal string GetCallArray(TPdfStream DataStream, TXRefSection XRef, TAcroFormRecord AcroForm, int PageNumber, int PageCount)
        {
            StringBuilder sb     = new StringBuilder();
            int           aCount = Count;

            for (int i = 0; i < aCount; i++)
            {
                int id = Annots[i].GetId(DataStream, XRef);
                if (i > 0)
                {
                    sb.Append(" ");
                }
                sb.Append(TIndirectRecord.GetCallObj(id));
            }

            string SignatureFields = AcroForm.GetSignatureFieldsCallArray(DataStream, XRef, PageNumber, PageCount);             //Signature Fields are also widget annotations.

            if (SignatureFields.Length > 0)
            {
                sb.Append(" ");
                sb.Append(SignatureFields);
            }

            if (sb.Length == 0)
            {
                return(String.Empty);
            }
            return(TPdfTokens.GetString(TPdfToken.OpenArray) + sb.ToString()
                   + TPdfTokens.GetString(TPdfToken.CloseArray));
        }
Beispiel #2
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);
        }
Beispiel #3
0
 internal bool HasAnnots(TAcroFormRecord AcroForm, int PageNumber, int PageCount)
 {
     if (Count > 0)
     {
         return(true);
     }
     return(AcroForm.HasSignatureFields(PageNumber, PageCount));
 }
Beispiel #4
0
        internal void BeginSave(TPdfStream DataStream, TXRefSection XRef, TPaperDimensions PageSize, TPdfSignature Signature, string aFallbackFontList, TFontEvents FontEvents)
        {
            CatalogId = XRef.GetNewObject(DataStream);
            int PageTreeId = XRef.GetNewObject(DataStream);

            PageTree = new TPageTreeRecord(PageTreeId, aFallbackFontList, Compress, FontEvents);
            Info     = new TInfoRecord();
            AcroForm = new TAcroFormRecord(Signature);
            Perms    = new TPermsRecord();

            CreateNewPage(DataStream, XRef, PageSize);
        }
Beispiel #5
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);
 }
Beispiel #6
0
        internal TPageInfo GetSigPage(TPdfSignature Signature)
        {
            int CurrentPage = TAcroFormRecord.GetSignaturePage(Signature, FList.Count);

            return(FList[CurrentPage]);
        }