Aspose.Pdf.Examples.CSharp.AsposePDF.DocumentConversion.PDFToHTMLFormat.PrefixForFonts.Run C# (CSharp) Method

Run() public static method

public static Run ( ) : void
return void
        public static void Run()
        {
            try
            {
                // ExStart:PrefixForFonts
                // The path to the documents directory.
                string dataDir = RunExamples.GetDataDir_AsposePdf_DocumentConversion_PDFToHTMLFormat();

                Document doc = new Document(dataDir + "input.pdf");
                string outHtmlFile = dataDir + "PrefixForFonts_out.html";
                _desiredFontDir = Path.GetDirectoryName(outHtmlFile) + @"\36296_files\";
                if (!Directory.Exists(_desiredFontDir))
                {
                    Directory.CreateDirectory(_desiredFontDir);
                }
                // Reset counter for font names - this counter will be used in our custom code
                // To generate unigue font file names

                _fontNumberForUniqueFontFileNames = 0;

                // Create HtmlSaveOption with custom saving strategy that will do all the job
                HtmlSaveOptions saveOptions = new HtmlSaveOptions();
                saveOptions.CustomResourceSavingStrategy = new HtmlSaveOptions.ResourceSavingStrategy(CustomResourcesProcessing);
                doc.Save(outHtmlFile, saveOptions);
                // ExEnd:PrefixForFonts
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
        // ExStart:PrefixForFontsHelper