Example #1
0
        public void C2ViewDocument(String path, string objectId, bool openDocument)
        {
            D2Document         doc     = CurrentRepository.GetSysObjectById <D2Document>(objectId);
            C2Views            views   = doc.getC2Views();
            List <C2ViewEntry> entries = views.Entries;
            C2ViewEntry        entry   = entries[0];
            C2View             view    = entry.C2View;

            using (Stream stream = CurrentRepository.Client.GetRaw(view.Url))
            {
                if (stream == null)
                {
                    throw new Exception("Stream came back null. This is normally caused by an unreachable ACS Server (DNS problem or Method Server DOWN). ACS URL is: " + view.Url);
                }
                FileStream fs = File.Create(path + "\\Test.Pdf");
                stream.CopyTo(fs);
                fs.Dispose();
            }


            if (openDocument)
            {
                System.Diagnostics.Process.Start(path + "\\Test.pdf");
            }
        }