Esempio n. 1
0
        public static void Run()
        {
            try
            {
                // Create necessary API instances
                var apiInstance = new ConvertApi(Constants.GetConfig());

                // Prepare convert settings
                var loadOptions = new OneLoadOptions
                {
                    FontSubstitutes = new Dictionary <string, string>
                    {
                        { "Tahoma", "Arial" }, { "Times New Roman", "Arial" }
                    }
                };

                var settings = new ConvertSettings
                {
                    StorageName = Constants.MyStorage,
                    FilePath    = "Note/sample.one",
                    Format      = "pdf",
                    LoadOptions = loadOptions,
                    OutputPath  = "converted"
                };


                // Convert to specified format
                var response = apiInstance.ConvertDocument(new ConvertDocumentRequest(settings));
                Console.WriteLine("Document converted successfully: " + response[0].Url);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
        }
        public void TestConversionFontSubs()
        {
            // Prepare convert settings
            var loadOptions = new OneLoadOptions
            {
                FontSubstitutes = new Dictionary <string, string>
                {
                    { "Tahoma", "Arial" }, { "Times New Roman", "Arial" }
                }
            };

            var settings = new ConvertSettings
            {
                FilePath    = TestFiles.OneNote.FullName,
                Format      = "pdf",
                LoadOptions = loadOptions,
                OutputPath  = "converted"
            };


            // Convert to specified format
            var response = ConvertApi.ConvertDocument(new ConvertDocumentRequest(settings));
        }