iTextSharp.text.pdf.PdfReader.RemoveUnusedObjects C# (CSharp) Метод

RemoveUnusedObjects() публичный Метод

public RemoveUnusedObjects ( ) : int
Результат int
        public int RemoveUnusedObjects() {
            bool[] hits = new bool[xrefObj.Count];
            RemoveUnusedNode(trailer, hits);
            int total = 0;
            if (partial) {
                for (int k = 1; k < hits.Length; ++k) {
                    if (!hits[k]) {
                        xref[k * 2] = -1;
                        xref[k * 2 + 1] = 0;
                        xrefObj[k] = null;
                        ++total;
                    }
                }
            }
            else {
                for (int k = 1; k < hits.Length; ++k) {
                    if (!hits[k]) {
                        xrefObj[k] = null;
                        ++total;
                    }
                }
            }
            return total;
        }
        

Usage Example

Пример #1
0
        /// <summary>
        /// Counts the number of pages to split
        /// </summary>
        /// <param name="files">The list of files to split</param>
        private void ProcessNbPages(string[] files)
        {
            this.nbpages       = 0;
            this.progressPages = 0;
            if (files == null)
            {
                return;
            }

            this.statut.Text = "Début du calcul du nombre total de pages";
            this.statut.Refresh();
            foreach (string filepath in files)
            {
                PdfReader reader    = null;
                int       pageCount = 0;
                string    dirPath   = Path.GetDirectoryName(filepath);
                System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding();
                reader = new iTextSharp.text.pdf.PdfReader(filepath);
                reader.RemoveUnusedObjects();
                pageCount     = reader.NumberOfPages;
                this.nbpages += pageCount;
            }

            this.progressBar1.Minimum = 1;
            this.progressBar1.Maximum = this.nbpages;
            this.progressBar1.Step    = 1;
            this.label1.Text          = "0 / " + this.nbpages;
            this.label1.Refresh();
            this.statut.Text = "Fin du calcul du nombre total de pages";
            this.statut.Refresh();
        }
All Usage Examples Of iTextSharp.text.pdf.PdfReader::RemoveUnusedObjects