// Do not call this constructor from your code
        private LocationMarker
        (
            string LocMarkerName,
            PdfPage LoctionMarkerPage,
            LocMarkerScope Scope,
            DestFit FitArg,
            params double[] SideArg
        )
        {
            if (SideArg.Length != FitArguments[(int)FitArg])
            {
                throw new ApplicationException("AddDestination invalid number of arguments");
            }
            this.LocMarkerName = LocMarkerName;
            this.Scope         = Scope;
            StringBuilder BuildDest = new StringBuilder();

            BuildDest.AppendFormat("[{0} 0 R {1}", LoctionMarkerPage.ObjectNumber, FitString[(int)FitArg]);
            foreach (double Side in SideArg)
            {
                BuildDest.AppendFormat(NFI.PeriodDecSep, " {0}", LoctionMarkerPage.ToPt(Side));
            }
            BuildDest.Append("]");
            DestStr = BuildDest.ToString();
            return;
        }
Пример #2
0
 /// <summary>
 ///     Add location marker
 /// </summary>
 /// <param name="LocMarkerName">Location marker name</param>
 /// <param name="Scope">Location marker scope</param>
 /// <param name="FitArg">PDF reader display control</param>
 /// <param name="SideArg">Optional dimensions for FitArg control</param>
 public void AddLocationMarker
 (
     string LocMarkerName,
     LocMarkerScope Scope,
     DestFit FitArg,
     params double[] SideArg
 )
 {
     LocationMarker.Create(LocMarkerName, this, Scope, FitArg, SideArg);
 }
        /// <summary>
        /// Create unique location marker
        /// </summary>
        /// <param name="LocMarkerName">Location marker name (case sensitive)</param>
        /// <param name="LocMarkerPage">Location marker page</param>
        /// <param name="Scope">Location marker scope</param>
        /// <param name="FitArg">Fit enumeration</param>
        /// <param name="SideArg">Fit optional arguments</param>
        public static void Create
        (
            string LocMarkerName,
            PdfPage LocMarkerPage,
            LocMarkerScope Scope,
            DestFit FitArg,
            params double[] SideArg
        )
        {
            if (LocMarkerPage.Document.LocMarkerArray == null)
            {
                LocMarkerPage.Document.LocMarkerArray = new List <LocationMarker>();
            }
            int Index = LocMarkerPage.Document.LocMarkerArray.BinarySearch(new LocationMarker(LocMarkerName));

            if (Index >= 0)
            {
                throw new ApplicationException("Duplicate location marker");
            }
            LocMarkerPage.Document.LocMarkerArray.Insert(~Index, new LocationMarker(LocMarkerName, LocMarkerPage, Scope, FitArg, SideArg));
            return;
        }