Exemplo n.º 1
0
        public static void SaveUsingDocumentFontsSubsystemWithDefaultFontFromStream()
        {
            // ExStart:SaveUsingDocumentFontsSubsystemWithDefaultFontFromStream
            // ExFor:Document.Save(System.IO.Stream, Aspose.Note.Saving.SaveOptions)
            // ExFor:SaveOptions.FontsSubsystem
            // ExFor:DocumentFontsSubsystem
            // ExFor:DocumentFontsSubsystem.UsingDefaultFontFromStream(System.IO.Stream,System.Collections.Generic.Dictionary{System.String,System.String})
            // ExSummary:Shows how to save a document in pdf format using default font from a stream.

            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

            string fontFile = Path.Combine(dataDir, "geo_1.ttf");

            // Load the document into Aspose.Note.
            Document oneFile = new Document(Path.Combine(dataDir, "missing-font.one"));

            // Save the document as PDF
            dataDir = dataDir + "SaveUsingDocumentFontsSubsystemWithDefaultFontFromStream_out.pdf";

            using (var stream = File.Open(fontFile, FileMode.Open, FileAccess.Read, FileShare.Read))
            {
                oneFile.Save(dataDir, new PdfSaveOptions()
                {
                    FontsSubsystem = DocumentFontsSubsystem.UsingDefaultFontFromStream(stream)
                });
            }

            // ExEnd:SaveUsingDocumentFontsSubsystemWithDefaultFontFromStream
        }
Exemplo n.º 2
0
        public static void SaveUsingDocumentFontsSubsystemWithDefaultFontName()
        {
            // ExStart:SaveUsingDocumentFontsSubsystemWithDefaultFontName
            // ExFor:Document.Save(System.IO.Stream, Aspose.Note.Saving.SaveOptions)
            // ExFor:SaveOptions.FontsSubsystem
            // ExFor:DocumentFontsSubsystem
            // ExFor:DocumentFontsSubsystem.UsingDefaultFont(System.String,System.Collections.Generic.Dictionary{System.String,System.String})
            // ExSummary:Shows how to save a document in pdf format using specified default font.

            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

            // Load the document into Aspose.Note.
            Document oneFile = new Document(Path.Combine(dataDir, "missing-font.one"));

            // Save the document as PDF
            dataDir = dataDir + "SaveUsingDocumentFontsSubsystemWithDefaultFontName_out.pdf";
            oneFile.Save(dataDir, new PdfSaveOptions()
            {
                FontsSubsystem = DocumentFontsSubsystem.UsingDefaultFont("Times New Roman")
            });

            // ExEnd:SaveUsingDocumentFontsSubsystemWithDefaultFontName
        }