コード例 #1
0
ファイル: BasePdf.cs プロジェクト: internetgdl/swsdk
        public virtual async Task <PdfResponse> GenerarPdfDeaultAsync(string xml, string b64Logo, Dictionary <string, string> ObservacionesAdicionales = null, bool isB64 = false)
        {
            PdfResponseHandler handler = new PdfResponseHandler();

            try
            {
                string format  = isB64 ? "b64" : "";
                var    headers = await GetHeadersAsync();

                var request = new PdfRequest();
                request.xmlContent = xml;
                request.extras     = ObservacionesAdicionales;
                request.logo       = b64Logo;
                var content = new StringContent(JsonConvert.SerializeObject(
                                                    request, new JsonSerializerSettings
                {
                    NullValueHandling = NullValueHandling.Ignore
                }),
                                                Encoding.UTF8, "application/json");
                var proxy = Helpers.RequestHelper.ProxySettings(this.Proxy, this.ProxyPort);
                return(await handler.GetPostResponseAsync(_apiUrl,
                                                          string.Format("/pdf/v1/generate/default",
                                                                        _operation), headers, content, proxy));
            }
            catch (Exception ex)
            {
                return(handler.HandleException(ex));
            }
        }
コード例 #2
0
ファイル: BasePdf.cs プロジェクト: nomada2/sw-sdk-dotnet
        public virtual PdfResponse GenerarPdf(string xml, string templateId, Dictionary <string, string> ObservacionesAdicionales = null, bool isB64 = false)
        {
            PdfResponseHandler handler = new PdfResponseHandler();

            try
            {
                string format   = isB64 ? "b64" : "";
                var    xmlBytes = Encoding.UTF8.GetBytes(xml);
                var    request  = this.RequestPdf(xmlBytes, templateId);
                return(handler.GetResponse(request));
            }catch (Exception ex)
            {
                return(handler.HandleException(ex));
            }
        }
コード例 #3
0
ファイル: BasePdf.cs プロジェクト: HappyDevops/sw-sdk-netcore
        public virtual PdfResponse GenerarPdf(string xml, string templateId, Dictionary <string, string> ObservacionesAdicionales = null, bool isB64 = false)
        {
            PdfResponseHandler handler = new PdfResponseHandler();

            try
            {
                string format   = isB64 ? "b64" : "";
                var    xmlBytes = Encoding.UTF8.GetBytes(xml);
                var    headers  = GetHeaders();
                var    content  = GetMultipartContent(xmlBytes, ObservacionesAdicionales);
                var    proxy    = Helpers.RequestHelper.ProxySettings(Proxy, ProxyPort);
                return(handler.GetPostResponse(Url,
                                               string.Format("/pdf/v1/generate",
                                                             _operation), headers, content, proxy));
            }
            catch (Exception ex)
            {
                return(handler.HandleException(ex));
            }
        }