<commit_before>﻿using System.IO;
using System.Net;
using Aspose.Pdf;
using Microsoft.Azure;
using Microsoft.WindowsAzure.Storage;

namespace SFA.DAS.EAS.LegalAgreementPdfGenerator
{
    class Program
    {
        static void Main(string[] args)
        {
            CreatePdfDocument(true);
            CreatePdfDocument(false);
        }

        private static void CreatePdfDocument(bool withSubFields)
        {

            
            using (var licenseStream = GetBlobDataFromAzure("legal-agreements", "Aspose.Total.lic"))
            {
                var license = new License();
                licenseStream.Position = 0;
                license.SetLicense(licenseStream);
            }


            // Create a request for the URL.
            var httpsLocalhostServiceCreatelegalagreementTrue = withSubFields 
                ? "https://localhost/service/CreateLegalAgreement/true" 
                : "https://localhost/service/CreateLegalAgreement/false";
            
            var request = WebRequest.Create(httpsLocalhostServiceCreatelegalagreementTrue);
            request.Credentials = CredentialCache.DefaultCredentials;

            using (var response = (HttpWebResponse) request.GetResponse())
            {
                using (var dataStream = response.GetResponseStream())
                {
                    using (var reader = new StreamReader(dataStream))
                    {
                        var responseFromServer = reader.ReadToEnd();
                        var stream = new MemoryStream(System.Text.Encoding.UTF8.GetBytes(responseFromServer));
                        var options = new HtmlLoadOptions(httpsLocalhostServiceCreatelegalagreementTrue);


                        // Load HTML file
                        var pdfDocument = new Document(stream, options);

                        options.PageInfo.IsLandscape = false;

                        // Save output as PDF format
                        var legalAgreementSubPdf = withSubFields ? @".\_Agreement_v1_Sub.pdf" : @".\_Agreement_v1.pdf";
                        pdfDocument.Save(legalAgreementSubPdf);
                    }
                        
                }
                    <commit_msg>Filename change for agreement PDFs<commit_after>﻿using System.IO;
using System.Net;
using Aspose.Pdf;
using Microsoft.Azure;
using Microsoft.WindowsAzure.Storage;

namespace SFA.DAS.EAS.LegalAgreementPdfGenerator
{
    class Program
    {
        static void Main(string[] args)
        {
            CreatePdfDocument(true);
            CreatePdfDocument(false);
        }

        private static void CreatePdfDocument(bool withSubFields)
        {

            
            using (var licenseStream = GetBlobDataFromAzure("legal-agreements", "Aspose.Total.lic"))
            {
                var license = new License();
                licenseStream.Position = 0;
                license.SetLicense(licenseStream);
            }


            // Create a request for the URL.
            var httpsLocalhostServiceCreatelegalagreementTrue = withSubFields 
                ? "https://localhost/service/CreateLegalAgreement/true" 
                : "https://localhost/service/CreateLegalAgreement/false";
            
            var request = WebRequest.Create(httpsLocalhostServiceCreatelegalagreementTrue);
            request.Credentials = CredentialCache.DefaultCredentials;

            using (var response = (HttpWebResponse) request.GetResponse())
            {
                using (var dataStream = response.GetResponseStream())
                {
                    using (var reader = new StreamReader(dataStream))
                    {
                        var responseFromServer = reader.ReadToEnd();
                        var stream = new MemoryStream(System.Text.Encoding.UTF8.GetBytes(responseFromServer));
                        var options = new HtmlLoadOptions(httpsLocalhostServiceCreatelegalagreementTrue);


                        // Load HTML file
                        var pdfDocument = new Document(stream, options);

                        options.PageInfo.IsLandscape = false;

                        // Save output as PDF format
                        var legalAgreementSubPdf = withSubFields ? @".\_Agreement_V1_Sub.pdf" : @".\_Agreement_V1.pdf";
                        pdfDocument.Save(legalAgreementSubPdf);
                    }
                        
                }
                    
{'fraction_non_alphanumeric': 0.07576776507509526, 'fraction_numerical': 0.0017933198834342075, 'mean_word_length': 1.6170087976539589, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5103101', 'n_tokens_mistral': 1090, 'n_tokens_neox': 993, 'n_words': 202}