Ejemplo n.º 1
0
        public BLOB etr_forms(bool Archive, string Author, string Creator, bool Nahled, string Producer, string Subject, string Title, string Type, BLOB docIN, out string error, out string stavOUT)
        {
            BLOB outBlob = new BLOB();

            if (logovani)
            {
                XmlDocument xmlSoapRequest = new XmlDocument();

                // Get raw request body
                using (Stream receiveStream = HttpContext.Current.Request.InputStream)
                {
                    receiveStream.Position = 0;
                    using (StreamReader readStream =
                               new StreamReader(receiveStream, System.Text.Encoding.UTF8))
                    {
                        xmlSoapRequest.Load(readStream);
                    }

                    xmlSoapRequest.Save(@"C:\Sluzby\602\etr_forms_" + DateTime.Now.ToString("yyyyMMdd_HHmmss") + ".xml");
                }
            }

            try
            {
                WS602Info = Database.getWS602Info();
            }
            catch (Exception ddd)
            {
                stavOUT = "FALSE";
                error   = ddd.Message;

                return(outBlob);
            }

            if (WS602Info.URL == "")
            {
                stavOUT = "FALSE";
                error   = "Není vyplněna URL adresa pro webovou službu Software602 LTD!";
                return(outBlob);
            }

            if (WS602Info.Certifikat == "")
            {
                //stavOUT = "FALSE";
                //error = "Není cesta k podepisujícímu systémovému certifikátu (značce / pečeti)!";
                //return outBlob;
            }


            stavOUT = "";
            error   = "";

            ConvertOptions ConvertOptions = new ConvertOptions();

            if (Archive)
            {
                ConvertOptions.PdfFormat = PdfFormat.PDF_A_2b;
                //ConvertOptions.PdfFormat = PdfFormat.PDF;
                //podepíšu:

                ConvertOptions.AddSignature = true;
                ConvertOptions.Signature    = new PdfSignature();

                /*if (Database.getSetting("aplikace_provozovatel") == "VS")
                 * {
                 *  ConvertOptions.Signature.CertificateID = WS602Info.Certifikat;
                 * }
                 * else
                 * {
                 *  ConvertOptions.Signature.CertificateID = "PEMfile:" + WS602Info.Certifikat;
                 * }*/

                ConvertOptions.Signature.CertificateID = WS602Info.Certifikat;

                ConvertOptions.Signature.AddTimeStamp = true;
            }
            else
            {
                ConvertOptions.PdfFormat = PdfFormat.PDF;
            }

            service.Url = WS602Info.URL;

            try
            {
                vysledek = service.ConvertFileEx(docIN.binaryData, "test." + Type, ConvertOptions, "", out output, out report, out error);
            }
            catch (Exception ddd)
            {
                error = ddd.Message;
            }

            if (vysledek == 0)
            {
                outBlob.binaryData  = output;
                outBlob.contentType = "application/pdf";
            }
            else
            {
                error = report;
            }

            return(outBlob);
        }
Ejemplo n.º 2
0
        public BLOB Add_watermark(BLOB DocIn, string Watermark_text_1, string Watermark_text_2, out string err_txt)
        {
            if (logovani)
            {
                XmlDocument xmlSoapRequest = new XmlDocument();

                // Get raw request body
                using (Stream receiveStream = HttpContext.Current.Request.InputStream)
                {
                    receiveStream.Position = 0;
                    using (StreamReader readStream =
                               new StreamReader(receiveStream, System.Text.Encoding.UTF8))
                    {
                        xmlSoapRequest.Load(readStream);
                    }

                    xmlSoapRequest.Save(@"C:\Sluzby\602\Add_watermark_" + DateTime.Now.ToString("yyyyMMdd_HHmmss") + ".xml");
                }
            }

            BLOB outBlob = new BLOB();

            try
            {
                WS602Info = Database.getWS602Info();
            }
            catch (Exception ddd)
            {
                err_txt = ddd.Message;
                return(outBlob);
            }

            if (WS602Info.URL == "")
            {
                err_txt = "Není vyplněna URL adresa pro webovou službu Software602 LTD!";
                return(outBlob);
            }

            if (WS602Info.Certifikat == "")
            {
                //err_txt = "Není cesta k podepisujícímu systémovému certifikátu (značce / pečeti)!";
                //return outBlob;
            }

            //public BLOB invoke() {

            err_txt = "";
            ConvertOptions ConvertOptions = new ConvertOptions();

            ConvertOptions.PdfFormat    = PdfFormat.PDF;
            ConvertOptions.AddWatermark = true;

            ConvertOptions.Watermark          = new PdfWatermark();
            ConvertOptions.Watermark.Angle    = 1;
            ConvertOptions.Watermark.FontSize = 20;
            ConvertOptions.Watermark.Text     = Watermark_text_1 + Environment.NewLine + Watermark_text_2;

            service.Url = WS602Info.URL;

            try
            {
                vysledek = service.ConvertFileEx(DocIn.binaryData, "test.rtf", ConvertOptions, "", out output, out report, out error);
            }
            catch (Exception ddd)
            {
                err_txt = ddd.Message;
                return(outBlob);
            }

            if (vysledek == 0)
            {
                outBlob.binaryData  = output;
                outBlob.contentType = "application/pdf";
            }
            else
            {
                err_txt = error;
                return(outBlob);
            }

            //pridani vodoznaku
            return(outBlob);
        }
Ejemplo n.º 3
0
        public AssemblerResult konverze_DA(BLOB docIN_form, BLOB docIN_orig, string text_1, string text_2, string text_3, int tisk_prosty, [System.Xml.Serialization.XmlIgnoreAttribute()] bool tisk_prostySpecified, string typ, out string StatusKod, out string StatusText, out BLOB docOUT, out int muj_vystup)
        {
            if (logovani)
            {
                XmlDocument xmlSoapRequest = new XmlDocument();

                // Get raw request body
                using (Stream receiveStream = HttpContext.Current.Request.InputStream)
                {
                    receiveStream.Position = 0;
                    using (StreamReader readStream =
                               new StreamReader(receiveStream, System.Text.Encoding.UTF8))
                    {
                        xmlSoapRequest.Load(readStream);
                    }

                    xmlSoapRequest.Save(@"C:\Sluzby\602\konverze_DA_" + DateTime.Now.ToString("yyyyMMdd_HHmmss") + ".xml");
                }
            }

            //public BLOB invoke() {
            AssemblerResult outAsembler = new AssemblerResult();

            StatusText = "";
            docOUT     = new BLOB();
            muj_vystup = 0;
            StatusKod  = "0000";

            BLOB outBlob = new BLOB();

            try
            {
                WS602Info = Database.getWS602Info();
            }
            catch (Exception ddd)
            {
                StatusText = ddd.Message;
                StatusKod  = "1111";
                return(outAsembler);
            }

            if (WS602Info.URL == "")
            {
                StatusText = "Není vyplněna URL adresa pro webovou službu Software602 LTD!";
                StatusKod  = "2222";
                return(outAsembler);
            }

            if (WS602Info.Certifikat == "")
            {
                //StatusText = "Není cesta k podepisujícímu systémovému certifikátu (značce / pečeti)!";
                //StatusKod = "3333";
                //return outAsembler;
            }

            ConvertOptions ConvertOptions = new ConvertOptions();

            //dokumentu převedu do PDF
            //Je li tisk prosty, tak se přidá hlavička a patička
            //není li tisk, tak se vystup spoji se šablonou
            //Render_PDF_From_XML:<druh>A-D-69</druh> - actipn_upload_to_db.asp
            //Render_PDF_From_XML:<druh>D-A-69</druh> - prevedeni_dle_69
            //Render_PDF_From_XML:<druh>D-zmena-69</druh> - prevod_formatu

            if (tisk_prosty == 1)
            {
                //přidám k tomu hlavicku a paticku

                HF_Options hlavicka = new HF_Options();
                HF_Options paticka  = new HF_Options();
                //hlavicka.

                hlavicka.HorizontalAlignment = HorizontalPosition.Center;
                hlavicka.Mode = PlacementMode.AllPages;
                hlavicka.VerticalAlignment = VerticalPosition.Top;
                hlavicka.Text     = text_1 + "\n" + text_2 + "\n" + text_3;
                hlavicka.FontSize = 8;

                paticka.HorizontalAlignment = HorizontalPosition.Center;
                paticka.Mode = PlacementMode.AllPages;
                paticka.VerticalAlignment = VerticalPosition.Bottom;
                paticka.Text     = text_1 + "\n" + text_2 + "\n" + text_3;
                paticka.FontSize = 8;

                ConvertOptions.Header = hlavicka;
                ConvertOptions.Footer = paticka;

                ConvertOptions.PdfFormat = PdfFormat.PDF;

                //ConvertOptions.


                service.Url = WS602Info.URL;

                try
                {
                    vysledek = service.ConvertFileEx(docIN_orig.binaryData, "test." + typ, ConvertOptions, "", out output, out report, out error);
                }
                catch (Exception ddd)
                {
                    StatusText = ddd.Message;
                    StatusKod  = "4444";
                    return(outAsembler);
                }
            }
            else
            {
                List <ConcatFile> pole = new List <ConcatFile>();

                ConcatOptions conOptions = new ConcatOptions();

                ConcatFile source = new ConcatFile();
                ConcatFile att    = new ConcatFile();

                source.Data = docIN_orig.binaryData;
                source.Name = "original." + typ;

                att.Data = docIN_form.binaryData;
                att.Name = "sablona.rtf";

                pole.Add(source);
                pole.Add(att);


                ConvertOptions.PdfFormat = PdfFormat.PDF;

                //ConvertOptions.


                service.Url = WS602Info.URL;

                try
                {
                    vysledek = service.Concat(pole.ToArray(), conOptions, ConvertOptions, out output, out report);
                }
                catch (Exception ddd)
                {
                    StatusText = ddd.Message;
                    StatusKod  = "4555";
                    return(outAsembler);
                }
            }

            error = "";

            OperationContext context = OperationContext.Current;

            if (context != null && context.RequestContext != null)
            {
                //Message msg = context.RequestContext.RequestMessage;

                //string reqXML = msg.ToString();
            }

            if (vysledek == 0)
            {
                List <mapItem> itmMap = new List <mapItem>();
                mapItem        itmmm  = new mapItem();

                BLOB ret = new BLOB();
                ret.contentType = "application/pdf";
                ret.binaryData  = output;

                List <mapItem> atributes = new List <mapItem>();

                mapItem attmmm = new mapItem();
                attmmm.key   = (string)"basename";
                attmmm.value = (string)"DocumentOUT.pdf";
                atributes.Add(attmmm);

                attmmm.key   = (string)"basename";
                attmmm.value = (string)"DocumentOUT.pdf";
                atributes.Add(attmmm);

                attmmm.key   = (string)"file";
                attmmm.value = (string)"DocumentOUT.pdf";
                atributes.Add(attmmm);

                attmmm.key   = (string)"wsfilename";
                attmmm.value = (string)"DocumentOUT.pdf";
                atributes.Add(attmmm);

                attmmm.key   = (string)"ADOBE_SAVE_MODE_ATTRIBUTE";
                attmmm.value = (string)"INCREMENTAL";
                atributes.Add(attmmm);


                ret.attributes = atributes.ToArray();


                itmmm.key   = (string)"DocumentOUT";
                itmmm.value = (BLOB)ret;
                //itmmm.
                itmMap.Add(itmmm);
                outAsembler.documents = itmMap.ToArray();
            }
            else
            {
                StatusText = report;
                StatusKod  = "5555";
                return(outAsembler);
            }

            return(outAsembler);
        }
Ejemplo n.º 4
0
        public BLOB etr_konverze_pdfa(BLOB docIN, int forms, [System.Xml.Serialization.XmlIgnoreAttribute()] bool formsSpecified, int podepsat, [System.Xml.Serialization.XmlIgnoreAttribute()] bool podepsatSpecified, string podpis_pole, TSPOptionSpec razitko, string typ, Credential znacka, out string StatusText, out string StatusKod, out BLOB docOUT, out bool isPDF, out BLOB log)
        {
            BLOB outBlob = new BLOB();

            if (podepsatSpecified == false)
            {
                podepsat = 1;
            }


            if (logovani)
            {
                XmlDocument xmlSoapRequest = new XmlDocument();

                // Get raw request body
                using (Stream receiveStream = HttpContext.Current.Request.InputStream)
                {
                    receiveStream.Position = 0;
                    using (StreamReader readStream =
                               new StreamReader(receiveStream, System.Text.Encoding.UTF8))
                    {
                        xmlSoapRequest.Load(readStream);
                    }

                    xmlSoapRequest.Save(@"C:\Sluzby\602\etr_konverze_pdfa_" + DateTime.Now.ToString("yyyyMMdd_HHmmss") + ".xml");
                }
            }

            //WS_Adobe_Gen.etr_konverze_pdfa.BLOB outBlob = new WS_Adobe_Gen.etr_konverze_pdfa.BLOB();

            docOUT = new BLOB();
            log    = new BLOB();
            isPDF  = true;

            try
            {
                WS602Info = Database.getWS602Info();
            }
            catch (Exception ddd)
            {
                StatusText = ddd.Message;
                StatusKod  = "1111";
                return(outBlob);
            }

            if (WS602Info.URL == "")
            {
                StatusText = "Není vyplněna URL adresa pro webovou službu Software602 LTD!";
                StatusKod  = "2222";
                return(outBlob);
            }

            if (WS602Info.Certifikat == "")
            {
                //StatusText = "Není cesta k podepisujícímu systémovému certifikátu (značce / pečeti)!";
                //StatusKod = "3333";
                //return outBlob;
            }

            StatusText = "";
            StatusKod  = "0000";
            ConvertOptions ConvertOptions = new ConvertOptions();

            ConvertOptions.PdfFormat = PdfFormat.PDF_A_2b;


            if (podepsat == 1)
            {
                ConvertOptions.AddSignature = true;
                ConvertOptions.Signature    = new PdfSignature();

                /*if (Database.getSetting("aplikace_provozovatel") == "VS")
                 * {
                 *  ConvertOptions.Signature.CertificateID = WS602Info.Certifikat;
                 * }
                 * else
                 * {
                 *  ConvertOptions.Signature.CertificateID = "PEMfile:" + WS602Info.Certifikat;
                 * }
                 */

                ConvertOptions.Signature.CertificateID = WS602Info.Certifikat;

                ConvertOptions.Signature.AddTimeStamp = true;
            }

            service.Url = WS602Info.URL;

            try
            {
                vysledek = service.ConvertFileEx(docIN.binaryData, "test." + typ, ConvertOptions, "", out output, out report, out error);
            }
            catch (Exception ddd)
            {
                StatusText = ddd.Message + " [Service URL: " + service.Url + "]";
                StatusKod  = "4444";
                return(outBlob);
            }

            if (vysledek == 0)
            {
                outBlob.binaryData  = output;
                outBlob.contentType = "application/pdf";

                docOUT = outBlob;
            }
            else
            {
                StatusText = report;
                StatusKod  = "5555";
                return(outBlob);
            }

            return(outBlob);
        }