Example #1
0
 protected void CloseIt()
 {
     for (int k = 0; k < readers.Count; ++k)
     {
         ((PdfReader)readers[k]).RemoveFields();
     }
     for (int r = 0; r < readers.Count; ++r)
     {
         PdfReader reader = (PdfReader)readers[r];
         for (int page = 1; page <= reader.NumberOfPages; ++page)
         {
             pageRefs.Add(GetNewReference(reader.GetPageOrigRef(page)));
             pageDics.Add(reader.GetPageN(page));
         }
     }
     MergeFields();
     CreateAcroForms();
     for (int r = 0; r < readers.Count; ++r)
     {
         PdfReader reader = (PdfReader)readers[r];
         for (int page = 1; page <= reader.NumberOfPages; ++page)
         {
             PdfDictionary        dic     = reader.GetPageN(page);
             PdfIndirectReference pageRef = GetNewReference(reader.GetPageOrigRef(page));
             PdfIndirectReference parent  = root.AddPageRef(pageRef);
             dic.Put(PdfName.PARENT, parent);
             Propagate(dic, pageRef, false);
         }
     }
     foreach (DictionaryEntry entry in readers2intrefs)
     {
         PdfReader reader = (PdfReader)entry.Key;
         try {
             file = reader.SafeFile;
             file.ReOpen();
             IntHashtable t    = (IntHashtable)entry.Value;
             int[]        keys = t.ToOrderedKeys();
             for (int k = 0; k < keys.Length; ++k)
             {
                 PRIndirectReference refi = new PRIndirectReference(reader, keys[k]);
                 AddToBody(PdfReader.GetPdfObjectRelease(refi), t[keys[k]]);
             }
         }
         finally {
             try {
                 file.Close();
                 reader.Close();
             }
             catch  {
                 // empty on purpose
             }
         }
     }
     pdf.Close();
 }
Example #2
0
 internal void WriteAllPages()
 {
     try {
         file.ReOpen();
         foreach (PdfImportedPage ip in importedPages.Values)
         {
             writer.AddToBody(ip.GetFormXObject(writer.CompressionLevel), ip.IndirectReference);
         }
         WriteAllVisited();
     }
     finally {
         try {
             reader.Close();
             file.Close();
         }
         catch  {
             //Empty on purpose
         }
     }
 }
Example #3
0
 /** Does the actual work of subsetting the font.
  * @throws IOException on error
  * @throws DocumentException on error
  * @return the subset font
  */
 internal byte[] Process()
 {
     try {
         rf.ReOpen();
         CreateTableDirectory();
         ReadLoca();
         FlatGlyphs();
         CreateNewGlyphTables();
         LocaTobytes();
         AssembleFont();
         return(outFont);
     }
     finally {
         try {
             rf.Close();
         }
         catch  {
             // empty on purpose
         }
     }
 }