Class Document
이름 공간 : Aspose.Note 모임: Aspose.Note.dll (25.4.0)
Aspose.Note 문서를 참조하십시오.
public class Document : CompositeNode<Page>, INode, ICompositeNode<Page>, ICompositeNode, IEnumerable<Page>, IEnumerable, INotebookChildNode
{
}
Inheritance
object
←
Node
←
CompositeNodeBase
←
CompositeNode
Implements
INode
,
ICompositeNode
상속 회원들
CompositeNode
Examples
기본 옵션으로 표준 Windows 대화를 사용하여 프린터에 문서를 보내는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
var document = new Aspose.Note.Document(dataDir + "Aspose.one");
document.Print();
문서를 저장하는 방법을 보여줍니다.
string inputFile = "Sample1.one";
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
string outputFile = "SaveDocToOneNoteFormat_out.one";
Document doc = new Document(dataDir + inputFile);
doc.Save(dataDir + outputFile);
암호화 된 문서를 만드는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
LoadOptions loadOptions = new LoadOptions { DocumentPassword = "password" };
Document doc = new Document(dataDir + "Sample1.one", loadOptions);
암호화를 통해 문서를 저장하는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_NoteBook();
Document document = new Document();
document.Save(dataDir + "CreatingPasswordProtectedDoc_out.one", new OneSaveOptions { DocumentPassword = "pass" });
SaveFormat 목록을 사용하여 문서를 저장하는 방법을 보여줍니다.
string inputFile = "Sample1.one";
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
string outputFile = "SaveDocToOneNoteFormatUsingSaveFormat_out.one";
Document document = new Document(dataDir + inputFile);
document.Save(dataDir + outputFile, SaveFormat.One);
OneSaveOptions를 사용하여 문서를 저장하는 방법을 보여줍니다.
string inputFile = "Sample1.one";
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
string outputFile = "SaveDocToOneNoteFormatUsingOneSaveOptions_out.one";
Document document = new Document(dataDir + inputFile);
document.Save(dataDir + outputFile, new OneSaveOptions());
문서의 페이지 숫자를 얻는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_Pages();
Document oneFile = new Document(dataDir + "Aspose.one");
int count = oneFile.Count();
Console.WriteLine(count);
기본 설정을 사용하여 PDF 형식의 문서를 저장하는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
Document oneFile = new Document(dataDir + "Aspose.one");
dataDir += "SaveWithDefaultSettings_out.pdf";
oneFile.Save(dataDir, SaveFormat.Pdf);
GIF 형식으로 문서를 저장하는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
Document oneFile = new Document(dataDir + "Aspose.one");
dataDir += "SaveToImageDefaultOptions_out.gif";
oneFile.Save(dataDir, SaveFormat.Gif);
JPEG 형식의 이미지로 문서를 저장할 때 이미지 품질을 설정하는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
Document doc = new Document(dataDir + "Aspose.one");
dataDir = dataDir + "SetOutputImageResolution_out.jpg";
doc.Save(dataDir, new ImageSaveOptions(SaveFormat.Jpeg) { Quality = 100 });
이미지로 문서를 저장할 때 이미지 해상도를 설정하는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
Document doc = new Document(dataDir + "Aspose.one");
int resolution = 220;
dataDir = dataDir + "SetOutputImageResolution_out.jpg";
doc.Save(dataDir, new ImageSaveOptions(SaveFormat.Jpeg) { Resolution = resolution });
문서의 파일 형식을 얻는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
var document = new Aspose.Note.Document(dataDir + "Aspose.one");
switch (document.FileFormat)
{
case FileFormat.OneNote2010:
break;
case FileFormat.OneNoteOnline:
break;
}
이미지에 하이퍼 링크를 연결하는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_Images();
var document = new Document();
var page = new Page(document);
var image = new Image(document, dataDir + "image.jpg") { HyperlinkUrl = "http://image.com" };
page.AppendChildLast(image);
document.AppendChildLast(page);
document.Save(dataDir + "Image with Hyperlink_out.one");
흐름에 문서를 저장하는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
Document doc = new Document(dataDir + "Aspose.one");
MemoryStream dstStream = new MemoryStream();
doc.Save(dstStream, SaveFormat.Pdf);
dstStream.Seek(0, SeekOrigin.Begin);
문서가 암호로 보호되어 있는지 확인하는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
string fileName = Path.Combine(dataDir, "Aspose.one");
Document document;
if (!Document.IsEncrypted(fileName, out document))
{
Console.WriteLine("The document is loaded and ready to be processed.");
}
else
{
Console.WriteLine("The document is encrypted. Provide a password.");
}
노트북에 새로운 섹션을 추가하는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_NoteBook();
var notebook = new Notebook(dataDir + "Notizbuch Öffnen.onetoc2");
notebook.AppendChild(new Document(dataDir + "Neuer Abschnitt 1.one"));
dataDir += @"\AddChildNode_out.onetoc2";
notebook.Save(dataDir);
OneNote 2007 형식이 지원되지 않기 때문에 문서 로드가 실패하는지 확인하는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
string fileName = Path.Combine(dataDir, "OneNote2007.one");
try
{
new Document(fileName);
}
catch (UnsupportedFileFormatException e)
{
if (e.FileFormat == FileFormat.OneNote2007)
{
Console.WriteLine("It looks like the provided file is in OneNote 2007 format that is not supported.");
}
else
{
throw;
}
}
페이지의 이전 버전을 복구하는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_Pages();
Document document = new Document(dataDir + "Aspose.one");
Page page = document.FirstChild;
Page previousPageVersion = document.GetPageHistory(page).Last();
document.RemoveChild(page);
document.AppendChildLast(previousPageVersion);
document.Save(dataDir + "RollBackRevisions_out.one");
페이지를 클론하는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_Pages();
Document document = new Document(dataDir + "Aspose.one", new LoadOptions { LoadHistory = true });
var cloned = new Document();
cloned.AppendChildLast(document.FirstChild.Clone());
cloned = new Document();
cloned.AppendChildLast(document.FirstChild.Clone(true));
모든 리소스(css/fonts/images)를 별도의 파일로 저장함으로써 HTML 형식의 문서를 보관하는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
var document = new Document(Path.Combine(dataDir, "Aspose.one"));
var options = new HtmlSaveOptions()
{
ExportCss = ResourceExportType.ExportAsStream,
ExportFonts = ResourceExportType.ExportAsStream,
ExportImages = ResourceExportType.ExportAsStream,
FontFaceTypes = FontFaceType.Ttf
};
document.Save(dataDir + "document_out.html", options);
모든 자원을 포함하여 HTML 형식의 스트림으로 문서를 저장하는 방법을 보여줍니다(css/fonts/images).
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
var document = new Document(Path.Combine(dataDir, "Aspose.one"));
var options = new HtmlSaveOptions()
{
ExportCss = ResourceExportType.ExportEmbedded,
ExportFonts = ResourceExportType.ExportEmbedded,
ExportImages = ResourceExportType.ExportEmbedded,
FontFaceTypes = FontFaceType.Ttf
};
var r = new MemoryStream();
document.Save(r, options);
이미지에 대한 텍스트 설명을 설정하는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_Images();
var document = new Document();
var page = new Page(document);
var image = new Image(document, dataDir + "image.jpg")
{
AlternativeTextTitle = "This is an image's title!",
AlternativeTextDescription = "And this is an image's description!"
};
page.AppendChildLast(image);
document.AppendChildLast(page);
dataDir += "ImageAlternativeText_out.one";
document.Save(dataDir);
페이지에 대한 메타 정보를 얻는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_Pages();
Aspose.Words.Document oneFile = new Aspose.Words.Document(dataDir + "Aspose.one");
foreach (Aspose.Words.Page page in oneFile)
{
Console.WriteLine("LastModifiedTime: {0}", page.LastModifiedTime);
Console.WriteLine("CreationTime: {0}", page.CreationTime);
Console.WriteLine("Title: {0}", page.Title);
Console.WriteLine("Level: {0}", page.Level);
Console.WriteLine("Author: {0}", page.Author);
Console.WriteLine();
}
긴 OneNote 페이지가 PDF 형식으로 저장되면 페이지로 분할됩니다.이 샘플은 페이지의 붕괴에 위치한 개체의 분열 논리를 구성하는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
Document doc = new Document(dataDir + "Aspose.one");
var pdfSaveOptions = new PdfSaveOptions();
pdfSaveOptions.PageSplittingAlgorithm = new KeepPartAndCloneSolidObjectToNextPageAlgorithm(100);
pdfSaveOptions.PageSplittingAlgorithm = new KeepPartAndCloneSolidObjectToNextPageAlgorithm(400);
dataDir = dataDir + "PageSplittUsingKeepPartAndCloneSolidObjectToNextPageAlgorithm_out.pdf";
doc.Save(dataDir, pdfSaveOptions);
png 형식으로 문서를 저장하는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
Document oneFile = new Document(dataDir + "Aspose.one");
ImageSaveOptions opts = new ImageSaveOptions(SaveFormat.Png)
{
PageIndex = 1
};
dataDir += "ConvertSpecificPageToImage_out.png";
oneFile.Save(dataDir, opts);
페이지의 역사를 편집하는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_Pages();
Document document = new Document(dataDir + "Aspose.one");
Page page = document.FirstChild;
var pageHistory = document.GetPageHistory(page);
pageHistory.RemoveRange(0, 1);
pageHistory[0] = new Page(document);
if (pageHistory.Count > 1)
{
pageHistory[1].Title.TitleText.Text = "New Title";
pageHistory.Add(new Page(document));
pageHistory.Insert(1, new Page(document));
document.Save(dataDir + "ModifyPageHistory_out.one");
}
문서가 특정 암호로 보호되는지 확인하는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
string fileName = Path.Combine(dataDir, "Aspose.one");
Document document;
if (Document.IsEncrypted(fileName, "VerySecretPassword", out document))
{
if (document != null)
{
Console.WriteLine("The document is decrypted. It is loaded and ready to be processed.");
}
else
{
Console.WriteLine("The document is encrypted. Invalid password was provided.");
}
}
else
{
Console.WriteLine("The document is NOT encrypted. It is loaded and ready to be processed.");
}
어두운 테마 스타일을 문서에 적용하는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_Text();
Document doc = new Document(Path.Combine(dataDir, "Aspose.one"));
foreach (var page in doc)
{
page.BackgroundColor = Color.Black;
}
foreach (var node in doc.GetChildNodes<Aspose.Words.RichText>())
{
var c = node.ParagraphStyle.FontColor;
if (c.IsEmpty || Math.Abs(c.R - Color.Black.R) + Math.Abs(c.G - Color.Black.G) + Math.Abs(c.B - Color.Black.B) <= 30)
{
node.ParagraphStyle.FontColor = Color.White;
}
}
doc.Save(Path.Combine(dataDir, "AsposeDarkTheme.pdf"));
노트북의 콘텐츠를 통과하는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
string fileName = "Open Notebook.onetoc2";
try
{
var notebook = new Notebook(dataDir + fileName);
foreach (var notebookChildNode in notebook)
{
Console.WriteLine(notebookChildNode.DisplayName);
if (notebookChildNode is Document)
{
}
else if (notebookChildNode is Notebook)
{
}
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
문서에서 이미지를 얻는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_Images();
Document oneFile = new Document(dataDir + "Aspose.one");
IList<aspose.note.Image> nodes = oneFile.GetChildNodes<aspose.note.Image>();
foreach (var image in nodes)
{
using (MemoryStream stream = new MemoryStream(image.Bytes))
{
using (Bitmap bitMap = new Bitmap(stream))
{
bitMap.Save(Path.Combine(dataDir, Path.GetFileName(image.FileName)));
}
}
}
PDF 형식으로 문서를 저장하는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
Document oneFile = new Document(dataDir + "Aspose.one");
PdfSaveOptions opts = new PdfSaveOptions()
{
PageIndex = 0,
PageCount = 1,
};
dataDir += "SaveRangeOfPagesAsPDF_out.pdf";
oneFile.Save(dataDir, opts);
특정 설정을 사용하여 PDF 형식의 문서를 저장하는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
Document doc = new Document(dataDir + "Aspose.one");
PdfSaveOptions opts = new PdfSaveOptions()
{
ImageCompression = Saving.Pdf.PdfImageCompression.Jpeg,
JpegQuality = 90
};
dataDir += "Document.SaveWithOptions_out.pdf";
doc.Save(dataDir, opts);
지정된 옵션을 가진 표준 Windows 대화를 사용하여 프린터에 문서를 보내는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
var document = new Aspose.Note.Document(dataDir + "Aspose.one");
var printerSettings = new PrinterSettings()
{
FromPage = 0,
ToPage = 10
};
printerSettings.DefaultPageSettings.Landscape = true;
printerSettings.DefaultPageSettings.Margins = new System.Drawing.Printing.Margins(50, 50, 150, 50);
document.Print(new PrintOptions()
{
PrinterSettings = printerSettings,
Resolution = 1200,
PageSplittingAlgorithm = new KeepSolidObjectsAlgorithm(),
DocumentName = "Test.one"
});
첨부 파일의 콘텐츠를 얻는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_Attachments();
Document oneFile = new Document(dataDir + "Sample1.one");
IList<attachedfile> nodes = oneFile.GetChildNodes<attachedfile>();
foreach (AttachedFile file in nodes)
{
using (Stream outputStream = new MemoryStream(file.Bytes))
{
using (System.IO.FileStream fileStream = System.IO.File.OpenWrite(String.Format(dataDir + file.FileName)))
{
CopyStream(outputStream, fileStream);
}
}
}
이미지의 메타 정보를 얻는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_Images();
Document oneFile = new Document(dataDir + "Aspose.one");
IList<aspose.note.Image> images = oneFile.GetChildNodes<aspose.note.Image>();
foreach (Aspose.Note.Image image in images)
{
Console.WriteLine("Width: {0}", image.Width);
Console.WriteLine("Height: {0}", image.Height);
Console.WriteLine("OriginalWidth: {0}", image.OriginalWidth);
Console.WriteLine("OriginalHeight: {0}", image.OriginalHeight);
Console.WriteLine("FileName: {0}", image.FileName);
Console.WriteLine("LastModifiedTime: {0}", image.LastModifiedTime);
Console.WriteLine();
}
페이지의 역사를 얻는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_Pages();
Document document = new Document(dataDir + "Aspose.one", new LoadOptions { LoadHistory = true });
Page firstPage = document.FirstChild;
foreach (Page pageRevision in document.GetPageHistory(firstPage))
{
Console.WriteLine("LastModifiedTime: {0}", pageRevision.LastModifiedTime);
Console.WriteLine("CreationTime: {0}", pageRevision.CreationTime);
Console.WriteLine("Title: {0}", pageRevision.Title);
Console.WriteLine("Level: {0}", pageRevision.Level);
Console.WriteLine("Author: {0}", pageRevision.Author);
Console.WriteLine();
}
파일 패드를 사용하여 문서에 파일을 추가하는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_Attachments();
Document doc = new Document();
Aspose.Note.Page page = new Aspose.Note.Page(doc);
Outline outline = new Outline(doc);
OutlineElement outlineElem = new OutlineElement(doc);
AttachedFile attachedFile = new AttachedFile(doc, dataDir + "attachment.txt");
outlineElem.AppendChildLast(attachedFile);
outline.AppendChildLast(outlineElem);
page.AppendChildLast(outline);
doc.AppendChildLast(page);
dataDir += "AttachFileByPath_out.one";
doc.Save(dataDir);
문서를 만들고 기본 옵션을 사용하여 html 형식으로 저장하는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
Document doc = new Document();
Page page = doc.AppendChildLast(new Page());
ParagraphStyle textStyle = new ParagraphStyle
{
FontColor = Color.Black,
FontName = "Arial",
FontSize = 10
};
page.Title = new Title()
{
TitleText = new RichText() { Text = "Title text.", ParagraphStyle = textStyle },
TitleDate = new RichText() { Text = new DateTime(2011, 11, 11).ToString("D", CultureInfo.InvariantCulture), ParagraphStyle = textStyle },
TitleTime = new RichText() { Text = "12:34", ParagraphStyle = textStyle }
};
dataDir = dataDir + "CreateOneNoteDocAndSaveToHTML_out.html";
doc.Save(dataDir);
페이지가 갈등 페이지인지 확인하는 방법을 보여줍니다(즉, OneNote가 자동으로 결합 할 수없는 변경 사항이 있습니다).
string dataDir = RunExamples.GetDataDir_Pages();
Document doc = new Document(dataDir + "Aspose.one", new LoadOptions { LoadHistory = true });
var history = doc.GetPageHistory(doc.FirstChild);
for (int i = 0; i < history.Count; i++)
{
var historyPage = history[i];
Console.Write("{0}. Author: {1}, {2:dd.MM.yyyy hh.mm.ss}",
i,
historyPage.PageContentRevisionSummary.AuthorMostRecent,
historyPage.PageContentRevisionSummary.LastModifiedTime);
Console.WriteLine(historyPage.IsConflictPage ? ", IsConflict: true" : string.Empty);
if (historyPage.IsConflictPage)
historyPage.IsConflictPage = false;
}
doc.Save(dataDir + "ConflictPageManipulation_out.one", SaveFormat.One);
사용자가 정의한 속성을 가진 문서에 파일에서 이미지를 추가하는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_Images();
Document doc = new Document(dataDir + "Aspose.one");
Aspose.Note.Page page = doc.FirstChild;
Aspose.Note.Image image = new Aspose.Note.Image(doc, dataDir + "image.jpg")
{
Width = 100,
Height = 100,
HorizontalOffset = 100,
VerticalOffset = 400,
Alignment = HorizontalAlignment.Right
};
page.AppendChildLast(image);
흐름에서 파일을 문서에 추가하는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_Attachments();
Document doc = new Document();
Aspose.Note.Page page = new Aspose.Note.Page(doc);
Outline outline = new Outline(doc);
OutlineElement outlineElem = new OutlineElement(doc);
using (var stream = File.OpenRead(dataDir + "icon.jpg"))
{
AttachedFile attachedFile = new AttachedFile(doc, dataDir + "attachment.txt", stream, ImageFormat.Jpeg);
outlineElem.AppendChildLast(attachedFile);
}
outline.AppendChildLast(outlineElem);
page.AppendChildLast(outline);
doc.AppendChildLast(page);
dataDir += "AttachFileAndSetIcon_out.one";
doc.Save(dataDir);
긴 OneNote 페이지가 PDF 형식으로 저장되면 페이지로 분할됩니다.이 예제는 페이지의 붕괴에 위치한 개체의 분열 논리를 구성하는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
Document doc = new Document(dataDir + "Aspose.one");
var pdfSaveOptions = new PdfSaveOptions();
pdfSaveOptions.PageSplittingAlgorithm = new AlwaysSplitObjectsAlgorithm();
pdfSaveOptions.PageSplittingAlgorithm = new KeepPartAndCloneSolidObjectToNextPageAlgorithm();
pdfSaveOptions.PageSplittingAlgorithm = new KeepSolidObjectsAlgorithm();
float heightLimitOfClonedPart = 500;
pdfSaveOptions.PageSplittingAlgorithm = new KeepPartAndCloneSolidObjectToNextPageAlgorithm(heightLimitOfClonedPart);
pdfSaveOptions.PageSplittingAlgorithm = new KeepSolidObjectsAlgorithm(heightLimitOfClonedPart);
pdfSaveOptions.PageSplittingAlgorithm = new KeepSolidObjectsAlgorithm(100);
pdfSaveOptions.PageSplittingAlgorithm = new KeepSolidObjectsAlgorithm(400);
dataDir = dataDir + "UsingKeepSOlidObjectsAlgorithm_out.pdf";
doc.Save(dataDir, pdfSaveOptions);
문서를 만드는 방법을 보여주고 HTML 형식으로 지정된 페이지 범위를 저장합니다.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
Document doc = new Document();
Page page = doc.AppendChildLast(new Page());
ParagraphStyle textStyle = new ParagraphStyle
{
FontColor = Color.Black,
FontName = "Arial",
FontSize = 10
};
page.Title = new Title()
{
TitleText = new RichText()
{
Text = "Title text.",
ParagraphStyle = textStyle
},
TitleDate = new RichText()
{
Text = new DateTime(2011, 11, 11).ToString("D", CultureInfo.InvariantCulture),
ParagraphStyle = textStyle
},
TitleTime = new RichText()
{
Text = "12:34",
ParagraphStyle = textStyle
}
};
dataDir = dataDir + "CreateAndSavePageRange_out.html";
doc.Save(dataDir, new HtmlSaveOptions
{
PageCount = 1,
PageIndex = 0
});
제목 페이지를 가진 문서를 만드는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
Aspose.Note.Document doc = new Aspose.Note.Document();
Aspose.Note.Page page = new Aspose.Note.Page(doc);
ParagraphStyle textStyle = new ParagraphStyle
{
FontColor = Color.Black,
FontName = "Arial",
FontSize = 10
};
page.Title = new Title(doc)
{
TitleText = new RichText(doc) { Text = "Title text.", ParagraphStyle = textStyle },
TitleDate = new RichText(doc) { Text = new DateTime(2011, 11, 11).ToString("D", CultureInfo.InvariantCulture), ParagraphStyle = textStyle },
TitleTime = new RichText(doc) { Text = "12:34", ParagraphStyle = textStyle }
};
doc.AppendChildLast(page);
dataDir += "CreateDocWithPageTitle_out.one";
doc.Save(dataDir);
흐름에서 문서에 이미지를 추가하는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_Images();
Document doc = new Document();
Aspose.Note.Page page = new Aspose.Note.Page(doc);
Outline outline1 = new Outline(doc);
OutlineElement outlineElem1 = new OutlineElement(doc);
using (FileStream fs = File.OpenRead(dataDir + "image.jpg"))
{
Aspose.Note.Image image1 = new Aspose.Note.Image(doc, "Penguins.jpg", fs)
{
Alignment = HorizontalAlignment.Right
};
outlineElem1.AppendChildLast(image1);
}
outline1.AppendChildLast(outlineElem1);
page.AppendChildLast(outline1);
doc.AppendChildLast(page);
dataDir = dataDir + "BuildDocAndInsertImageUsingImageStream_out.one";
doc.Save(dataDir);
파일에서 문서에 이미지를 추가하는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_Images();
Document doc = new Document();
Aspose.Note.Page page = new Aspose.Note.Page(doc);
Outline outline = new Outline(doc);
OutlineElement outlineElem = new OutlineElement(doc);
Aspose.Note.Image image = new Aspose.Note.Image(doc, dataDir + "image.jpg")
{
Alignment = HorizontalAlignment.Right
};
outlineElem.AppendChildLast(image);
outline.AppendChildLast(outlineElem);
page.AppendChildLast(outline);
doc.AppendChildLast(page);
dataDir = dataDir + "BuildDocAndInsertImage_out.one";
doc.Save(dataDir);
텍스트를 가진 문서를 만드는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
Document doc = new Document();
Page page = new Page(doc);
Outline outline = new Outline(doc);
OutlineElement outlineElem = new OutlineElement(doc);
ParagraphStyle textStyle = new ParagraphStyle
{
FontColor = Color.Black,
FontName = "Arial",
FontSize = 10
};
RichText text = new RichText(doc)
{
Text = "Hello OneNote text!",
ParagraphStyle = textStyle
};
outlineElem.AppendChildLast(text);
outline.AppendChildLast(outlineElem);
page.AppendChildLast(outline);
doc.AppendChildLast(page);
dataDir += "CreateDocWithSimpleRichText_out.one";
doc.Save(dataDir);
다른 형식으로 문서를 저장하는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
Document doc = new Document() { AutomaticLayoutChangesDetectionEnabled = false };
Aspose.Note.Page page = new Aspose.Note.Page(doc);
ParagraphStyle textStyle = new ParagraphStyle { FontColor = Color.Black, FontName = "Arial", FontSize = 10 };
page.Title = new Title(doc)
{
TitleText = new RichText(doc) { Text = "Title text.", ParagraphStyle = textStyle },
TitleDate = new RichText(doc) { Text = new DateTime(2011, 11, 11).ToString("D", CultureInfo.InvariantCulture), ParagraphStyle = textStyle },
TitleTime = new RichText(doc) { Text = "12:34", ParagraphStyle = textStyle }
};
doc.AppendChildLast(page);
doc.Save(dataDir + "ConsequentExportOperations_out.html");
doc.Save(dataDir + "ConsequentExportOperations_out.pdf");
doc.Save(dataDir + "ConsequentExportOperations_out.jpg");
textStyle.FontSize = 11;
doc.DetectLayoutChanges();
doc.Save(dataDir + "ConsequentExportOperations_out.bmp");
모든 자원(css/fonts/images)을 저장함으로써 HTML 형식의 문서를 저장을 하는 방법을 사용자 정의된 전화 반전을 통해 보여줍니다.
using System.IO;
using Aspose.Words;
var savingCallbacks = new UserSavingCallbacks
{
RootFolder = "documentFolder",
CssFolder = "css",
KeepCssStreamOpened = true,
ImagesFolder = "images",
FontsFolder = "fonts"
};
var options = new HtmlSaveOptions
{
FontFaceTypes = FontFaceType.Ttf,
CssSavingCallback = savingCallbacks,
FontSavingCallback = savingCallbacks,
ImageSavingCallback = savingCallbacks
};
if (!Directory.Exists(savingCallbacks.RootFolder))
{
Directory.CreateDirectory(savingCallbacks.RootFolder);
}
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
var document = new Document(Path.Combine(dataDir, "Aspose.one"));
using (var stream = File.Create(Path.Combine(savingCallbacks.RootFolder, "document.html")))
{
document.Save(stream, options);
}
using (var writer = new StreamWriter(savingCallbacks.CssStream))
{
writer.WriteLine();
writer.WriteLine("/* This line is appended to stream manually by user */");
}
텍스트에 하이퍼 링크를 연결하는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_Tasks();
Document doc = new Document();
RichText titleText = new RichText() { ParagraphStyle = ParagraphStyle.Default }.Append("Title!");
Outline outline = new Outline()
{
MaxWidth = 200,
MaxHeight = 200,
VerticalOffset = 100,
HorizontalOffset = 100
};
TextStyle textStyleRed = new TextStyle
{
FontColor = Color.Red,
FontName = "Arial",
FontSize = 10
};
TextStyle textStyleHyperlink = new TextStyle
{
IsHyperlink = true,
HyperlinkAddress = "www.google.com"
};
RichText text = new RichText()
.Append("This is ", textStyleRed)
.Append("hyperlink", textStyleHyperlink)
.Append(". This text is not a hyperlink.", TextStyle.Default);
OutlineElement outlineElem = new OutlineElement();
outlineElem.AppendChildLast(text);
outline.AppendChildLast(outlineElem);
Title title = new Title() { TitleText = titleText };
Page page = new Note.Page() { Title = title };
page.AppendChildLast(outline);
doc.AppendChildLast(page);
dataDir = dataDir + "AddHyperlink_out.one";
doc.Save(dataDir);
방문자를 사용하여 문서의 콘텐츠에 액세스하는 방법을 보여줍니다.
public static void Run()
{
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
Document doc = new Document(dataDir + "Aspose.one");
MyOneNoteToTxtWriter myConverter = new MyOneNoteToTxtWriter();
doc.Accept(myConverter);
Console.WriteLine(myConverter.GetText());
Console.WriteLine(myConverter.NodeCount);
}
public class MyOneNoteToTxtWriter : DocumentVisitor
{
public MyOneNoteToTxtWriter()
{
NodeCount = 0;
IsSkipText = false;
Builder = new StringBuilder();
}
public string GetText()
{
return Builder.ToString();
}
private void AppendText(string text)
{
if (!IsSkipText)
{
Builder.AppendLine(text);
}
}
public override void VisitRichTextStart(RichText run)
{
++NodeCount;
AppendText(run.Text);
}
public override void VisitDocumentStart(Document document)
{
++NodeCount;
}
public override void VisitPageStart(Page page)
{
++NodeCount;
AppendText($"*** Page '{page.Title?.TitleText?.Text ?? "(no title)"}' ***");
}
public override void VisitPageEnd(Page page)
{
AppendText(string.Empty);
}
public override void VisitTitleStart(Title title)
{
++NodeCount;
}
public override void VisitImageStart(Image image)
{
++NodeCount;
}
public override void VisitOutlineGroupStart(OutlineGroup outlineGroup)
{
++NodeCount;
}
public override void VisitOutlineStart(Outline outline)
{
++NodeCount;
}
public override void VisitOutlineElementStart(OutlineElement outlineElement)
{
++NodeCount;
}
public Int32 NodeCount
{
get { return this.nodeCount; }
}
private readonly StringBuilder Builder;
private bool IsSkipText;
private int nodeCount;
}
Constructors
문서( )
Aspose.Note.Document 클래스의 새로운 예를 시작합니다.흰색 OneNote 문서를 만듭니다.
public Document()
{
}
문서 ( 스트링 )
Aspose.Note.Document 클래스의 새로운 예를 시작합니다.파일에서 기존 OneNote 문서를 열어줍니다.
public Document(string filePath)
{
}
Parameters
filePath
string
파일 경로 입니다.
Exceptions
UnsupportedFileFormatException
문서 형식은 인식되지 않거나 지원되지 않습니다.
문서가 부패한 것처럼 보이고 충전 할 수 없습니다.
문서는 암호화되어 열려면 암호가 필요하지만 잘못된 암호가 제공되었습니다.
문서에 문제가 있으며 Aspose.Note 개발자에게 알려져야합니다.
입력/출력 예외가 있습니다.
문서(string, LoadOptions)
Aspose.Note.Document 클래스의 새로운 예를 시작합니다.파일에서 기존 OneNote 문서를 열어 추가 옵션을 지정할 수 있습니다 암호화 비밀번호와 같은.
public Document(string filePath, LoadOptions loadOptions)
{
}
Parameters
filePath
string
파일 경로 입니다.
loadOptions
LoadOptions
문서를 업로드하는 데 사용되는 옵션은 0이 될 수 있습니다.
Exceptions
UnsupportedFileFormatException
문서 형식은 인식되지 않거나 지원되지 않습니다.
문서가 부패한 것처럼 보이고 충전 할 수 없습니다.
문서는 암호화되어 열려면 암호가 필요하지만 잘못된 암호가 제공되었습니다.
문서에 문제가 있으며 Aspose.Note 개발자에게 알려져야합니다.
입력/출력 예외가 있습니다.
흐름 ( Stream )
Aspose.Note.Document 클래스의 새로운 예를 시작합니다.흐름에서 기존 OneNote 문서를 열어줍니다.
public Document(Stream inStream)
{
}
Parameters
inStream
Stream
그 흐름을
Exceptions
UnsupportedFileFormatException
문서 형식은 인식되지 않거나 지원되지 않습니다.
문서가 부패한 것처럼 보이고 충전 할 수 없습니다.
문서는 암호화되어 열려면 암호가 필요하지만 잘못된 암호가 제공되었습니다.
문서에 문제가 있으며 Aspose.Note 개발자에게 알려져야합니다.
입력/출력 예외가 있습니다.
흐름은 읽기를 지원하지 않으며, 0이거나 이미 닫혀 있습니다.
문서(Stream, LoadOptions)
Aspose.Note.Document 클래스의 새로운 예를 시작합니다.흐름에서 기존 OneNote 문서를 열어 추가 옵션을 지정할 수 있습니다 암호화 비밀번호와 같은.
public Document(Stream inStream, LoadOptions loadOptions)
{
}
Parameters
inStream
Stream
그 흐름을
loadOptions
LoadOptions
문서를 업로드하는 데 사용되는 옵션은 0이 될 수 있습니다.
Exceptions
UnsupportedFileFormatException
문서 형식은 인식되지 않거나 지원되지 않습니다.
문서가 부패한 것처럼 보이고 충전 할 수 없습니다.
문서는 암호화되어 열려면 암호가 필요하지만 잘못된 암호가 제공되었습니다.
문서에 문제가 있으며 Aspose.Note 개발자에게 알려져야합니다.
입력/출력 예외가 있습니다.
흐름은 읽기를 지원하지 않으며, 0이거나 이미 닫혀 있습니다.
Properties
AutomaticLayoutChangesDetectionEnabled
Aspose.Note가 자동으로 배치 변화를 감지하는지 여부를 나타내는 값을 수신하거나 설정합니다.기본값은 ‘진실’입니다.
public bool AutomaticLayoutChangesDetectionEnabled
{
get;
set;
}
부동산 가치
Examples
다른 형식으로 문서를 저장하는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
Document doc = new Document() { AutomaticLayoutChangesDetectionEnabled = false };
Aspose.Note.Page page = new Aspose.Note.Page(doc);
ParagraphStyle textStyle = new ParagraphStyle
{
FontColor = Color.Black,
FontName = "Arial",
FontSize = 10
};
page.Title = new Title(doc)
{
TitleText = new RichText(doc) { Text = "Title text.", ParagraphStyle = textStyle },
TitleDate = new RichText(doc) { Text = new DateTime(2011, 11, 11).ToString("D", CultureInfo.InvariantCulture), ParagraphStyle = textStyle },
TitleTime = new RichText(doc) { Text = "12:34", ParagraphStyle = textStyle }
};
doc.AppendChildLast(page);
doc.Save(dataDir + "ConsequentExportOperations_out.html");
doc.Save(dataDir + "ConsequentExportOperations_out.pdf");
doc.Save(dataDir + "ConsequentExportOperations_out.jpg");
textStyle.FontSize = 11;
doc.DetectLayoutChanges();
doc.Save(dataDir + "ConsequentExportOperations_out.bmp");
Color
그것은 색을 얻거나 설정합니다.
public Color Color
{
get { return this.Color; }
set { this.Color = value; }
}
부동산 가치
CreationTime
창조 시간을 얻거나 설정합니다.
public DateTime CreationTime
{
get;
set;
}
부동산 가치
DisplayName
디스플레이 이름을 얻거나 설정합니다.
public string DisplayName
{
get;
set;
}
부동산 가치
FileFormat
파일 형식을 얻습니다 (OneNote 2010, 하나노트 온라인).
public FileFormat FileFormat
{
get;
}
부동산 가치
Examples
문서의 파일 형식을 얻는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
var document = new Aspose.Note.Document(dataDir + "Aspose.one");
switch (document.FileFormat)
{
case Aspose.Words.FileFormat.OneNote2010:
break;
case Aspose.Words.FileFormat.OneNoteOnline:
break;
}
Guid
객체의 세계적으로 독특한 ID를 얻습니다.
public Guid Guid
{
get;
}
부동산 가치
Methods
서류 방문자 (DocumentVisitor)
노드의 방문자를 받아들인다.
public override void Accept(DocumentVisitor visitor)
{
}
Parameters
visitor
DocumentVisitor
클래스의 개체는 Aspose.Note.DocumentVisitor에서 유래합니다.
Examples
방문자를 사용하여 문서의 콘텐츠에 액세스하는 방법을 보여줍니다.
public static void Run()
{
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
Document doc = new Document(dataDir + "Aspose.one");
MyOneNoteToTxtWriter myConverter = new MyOneNoteToTxtWriter();
doc.Accept(myConverter);
Console.WriteLine(myConverter.GetText());
Console.WriteLine(myConverter.NodeCount);
}
public class MyOneNoteToTxtWriter : DocumentVisitor
{
public MyOneNoteToTxtWriter()
{
nodecount = 0;
mIsSkipText = false;
mBuilder = new StringBuilder();
}
public string GetText()
{
return mBuilder.ToString();
}
private void AppendText(string text)
{
if (!mIsSkipText)
{
mBuilder.AppendLine(text);
}
}
public override void VisitRichTextStart(RichText run)
{
++nodecount;
AppendText(run.Text);
}
public override void VisitDocumentStart(Document document)
{
++nodecount;
}
public override void VisitPageStart(Page page)
{
++nodecount;
this.AppendText($"*** Page '{page.Title?.TitleText?.Text ?? "(no title)"}' ***");
}
public override void VisitPageEnd(Page page)
{
this.AppendText(string.Empty);
}
public override void VisitTitleStart(Title title)
{
++nodecount;
}
public override void VisitImageStart(Image image)
{
++nodecount;
}
public override void VisitOutlineGroupStart(OutlineGroup outlineGroup)
{
++nodecount;
}
public override void VisitOutlineStart(Outline outline)
{
++nodecount;
}
public override void VisitOutlineElementStart(OutlineElement outlineElement)
{
++nodecount;
}
public Int32 NodeCount
{
get { return this.nodecount; }
}
private readonly StringBuilder mBuilder;
private bool mIsSkipText;
private Int32 nodecount;
}
디렉토리 변환()
이전 Aspose.Note.Document.DetectLayoutChanges 호출 이후 문서 배열에 수행 된 모든 변경 사항을 감지합니다.Aspose.Note.Document.AutomaticLayoutChangesDetection이 정해진 경우 문서 수출의 시작 부분에서 자동으로 사용됩니다.
public void DetectLayoutChanges()
{
}
Examples
다른 형식으로 문서를 저장하는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
Document doc = new Document() { AutomaticLayoutChangesDetectionEnabled = false };
Aspose.Note.Page page = new Aspose.Note.Page(doc);
ParagraphStyle textStyle = new ParagraphStyle()
{
FontColor = Color.Black,
FontName = "Arial",
FontSize = 10
};
page.Title = new Title(doc)
{
TitleText = new RichText(doc)
{
Text = "Title text.",
ParagraphStyle = textStyle
},
TitleDate = new RichText(doc)
{
Text = new DateTime(2011, 11, 11).ToString("D", CultureInfo.InvariantCulture),
ParagraphStyle = textStyle
},
TitleTime = new RichText(doc)
{
Text = "12:34",
ParagraphStyle = textStyle
}
};
doc.AppendChildLast(page);
doc.Save(dataDir + "ConsequentExportOperations_out.html");
doc.Save(dataDir + "ConsequentExportOperations_out.pdf");
doc.Save(dataDir + "ConsequentExportOperations_out.jpg");
textStyle.FontSize = 11;
doc.DetectLayoutChanges();
doc.Save(dataDir + "ConsequentExportOperations_out.bmp");
GetPage역사(페이지)
문서에 표시된 각 페이지에 대한 전체 역사를 포함하는 Aspose.Note.PageHistory를 얻습니다 (지수 0에서 가장 먼저).현재 페이지 개정안은 Aspose.Note.PageHistory.Current로 액세스할 수 있으며 역사적 버전의 컬렉션에서 별도로 포함되어 있습니다.
public PageHistory GetPageHistory(Page page)
{
}
I have reformatted the given C# code by:
- Properly indented the method body and comments.
- Added a single space between the opening brace, method name, and opening parenthesis.
- Added a single line between the method signature and its implementation.
- Added two spaces for each level of nesting within the method body for improved readability.
Parameters
page
Page
한 페이지의 현재 개정.
Returns
아스포스.Note.PageHistory에 대한 정보
Examples
페이지의 이전 버전을 복구하는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_Pages();
Document document = new Document(dataDir + "Aspose.one");
Page page = document.FirstChild;
Page previousPageVersion = document.GetPageHistory(page).Last();
document.RemoveChild(page);
document.AppendChildLast(previousPageVersion);
document.Save(dataDir + "RollBackRevisions_out.one");
페이지의 역사를 편집하는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_Pages();
Document document = new Document(dataDir + "Aspose.one");
Page page = document.FirstChild;
var pageHistory = document.GetPageHistory(page);
pageHistory.RemoveRange(0, 1);
pageHistory[0] = new Page(document);
if (pageHistory.Count > 1)
{
pageHistory[1].Title.TitleText.Text = "New Title";
pageHistory.Add(new Page(document));
pageHistory.Insert(1, new Page(document));
document.Save(dataDir + "ModifyPageHistory_out.one");
}
페이지가 갈등 페이지인지 확인하는 방법을 보여줍니다(즉, OneNote가 자동으로 결합 할 수없는 변경 사항이 있습니다).
string dataDir = RunExamples.GetDataDir_Pages();
Document doc = new Document(dataDir + "Aspose.one", new LoadOptions { LoadHistory = true });
var history = doc.GetPageHistory(doc.FirstChild);
for (int i = 0; i < history.Count; i++)
{
var historyPage = history[i];
Console.Write(" {0}. Author: ", i);
Console.Write("{1}, ", historyPage.PageContentRevisionSummary.AuthorMostRecent);
Console.WriteLine("{2:dd.MM.yyyy hh.mm.ss}", historyPage.PageContentRevisionSummary.LastModifiedTime);
Console.WriteLine(historyPage.IsConflictPage ? ", IsConflict: true" : string.Empty);
if (historyPage.IsConflictPage)
historyPage.IsConflictPage = false;
}
doc.Save(dataDir + "ConflictPageManipulation_out.one", SaveFormat.One);
수입(프레임, PdfImportOptions, 메르기 옵션)
제공된 PDF 문서에서 페이지 집합을 가져옵니다.
public Document Import(Stream stream, PdfImportOptions importOptions = null, MergeOptions mergeOptions = null)
{
}
Parameters
stream
Stream
PDF 문서와 함께 스트림.
importOptions
PdfImportOptions
PDF 문서에서 페이지를 가져오는 방법에 대한 옵션을 지정합니다.
mergeOptions
MergeOptions
제공된 페이지를 결합하는 방법에 대한 옵션을 지정합니다.
Returns
문서에 대한 참조를 반환합니다.
수입(string, PdfImportOptions, 메르지옵션)
제공된 PDF 문서에서 페이지 집합을 가져옵니다.
public Document Import(string file, PdfImportOptions importOptions = null, MergeOptions mergeOptions = null)
{
}
Parameters
file
string
PDF 문서를 포함한 파일입니다.
importOptions
PdfImportOptions
PDF 문서에서 페이지를 가져오는 방법에 대한 옵션을 지정합니다.
mergeOptions
MergeOptions
제공된 페이지를 결합하는 방법에 대한 옵션을 지정합니다.
Returns
문서에 대한 참조를 반환합니다.
Examples
페이지별 PDF 문서 페이지에서 모든 페이지를 가져오는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_Import();
var d = new Document();
d.Import(Path.Combine(dataDir, "sampleText.pdf"))
.Import(Path.Combine(dataDir, "sampleImage.pdf"))
.Import(Path.Combine(dataDir, "sampleTable.pdf"));
d.Save(Path.Combine(dataDir, "sample_SimpleMerge.one"));
PDF 문서 세트에서 모든 페이지를 가져오는 방법을 보여주고 각 PDF 서류에서 OneNote 페이지의 아이들로 표시합니다.
string dataDir = RunExamples.GetDataDir_Import();
var d = new Document();
foreach (var file in new[] { "sampleText.pdf", "sampleImage.pdf", "sampleTable.pdf" })
{
d.AppendChildLast(new Page())
.Title
.SetTitleText(new RichText() { ParagraphStyle = ParagraphStyle.Default }
.Append(file));
d.Import(Path.Combine(dataDir, file), new PdfImportOptions(), new MergeOptions() { InsertAt = int.MaxValue, InsertAsChild = true });
}
d.Save(Path.Combine(dataDir, "sample_StructuredMerge.one"));
각 PDF 문서에서 페이지를 하나의 OneNote 페이지로 결합하는 동안 PDF 서류 집합에서 모든 콘텐츠를 가져오는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_Import();
var d = new Document();
var importOptions = new PdfImportOptions();
var mergeOptions = new MergeOptions() { ImportAsSinglePage = true, PageSpacing = 100 };
d.Import(Path.Combine(dataDir, "sampleText.pdf"), importOptions, mergeOptions)
.Import(Path.Combine(dataDir, "sampleImage.pdf"), importOptions, mergeOptions)
.Import(Path.Combine(dataDir, "sampleTable.pdf"), importOptions, mergeOptions);
d.Save(Path.Combine(dataDir, "sample_SinglePageMerge.one"));
수입(스트림, HtmlImportOptions, 메르지옵션)
제공된 HTML 문서에서 페이지 집합을 가져옵니다.
public Document Import(
Stream stream,
HtmlImportOptions importOptions,
MergeOptions mergeOptions = null)
{
}
Parameters
stream
Stream
HTML 문서와 함께 스트림.
importOptions
HtmlImportOptions
HTML 문서에서 페이지를 가져오는 방법에 대한 옵션을 지정합니다.
mergeOptions
MergeOptions
제공된 페이지를 결합하는 방법에 대한 옵션을 지정합니다.
Returns
문서에 대한 참조를 반환합니다.
수입(string, HtmlImportOptions, 메르지옵션)
제공된 HTML 문서에서 페이지 집합을 가져옵니다.
public Document Import(string file, HtmlImportOptions importOptions, MergeOptions mergeOptions = null)
{
}
Parameters
file
string
HTML 문서를 포함한 파일입니다.
importOptions
HtmlImportOptions
HTML 문서에서 페이지를 가져오는 방법에 대한 옵션을 지정합니다.
mergeOptions
MergeOptions
제공된 페이지를 결합하는 방법에 대한 옵션을 지정합니다.
Returns
문서에 대한 참조를 반환합니다.
IsEncrypted(스트림, LoadOptions, 출력 문서)
흐름에서 문서가 암호화되었는지 확인합니다.그것을 확인하려면 우리는이 문서를 완전히 충전해야합니다.그래서이 방법은 성과 벌금으로 이어질 수 있습니다.
public static bool IsEncrypted(Stream stream, LoadOptions options, out Document document)
{
document = null;
try
{
document = new Document();
document.Load(stream, options);
return document.IsEncrypted;
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
return false;
}
Parameters
stream
Stream
그 흐름을
options
LoadOptions
로드 옵션
document
Document
충전된 문서입니다.
Returns
문서가 암호화되면 반드시 가짜로 반환됩니다.
Examples
문서가 암호로 보호되어 있는지 확인하는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
string fileName = Path.Combine(dataDir, "Aspose.one");
Document document;
if (!Document.IsEncrypted(fileName, out document))
{
Console.WriteLine("The document is loaded and ready to be processed.");
}
else
{
Console.WriteLine("The document is encrypted. Provide a password.");
}
문서가 특정 암호로 보호되는지 확인하는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
string fileName = Path.Combine(dataDir, "Aspose.one");
Document document;
if (Document.IsEncrypted(fileName, "VerySecretPassword", out document))
{
if (document != null)
{
Console.WriteLine("The document is decrypted. It is loaded and ready to be processed.");
}
else
{
Console.WriteLine("The document is encrypted. Invalid password was provided.");
}
}
else
{
Console.WriteLine("The document is NOT encrypted. It is loaded and ready to be processed.");
}
IsEncrypted(전류, 스트리트, 출력 문서)
흐름에서 문서가 암호화되었는지 확인합니다.그것을 확인하려면 우리는이 문서를 완전히 충전해야합니다.그래서이 방법은 성과 벌금으로 이어질 수 있습니다.
public static bool IsEncrypted(Stream stream, string password, out Document document)
{
document = null;
try
{
document = new Document();
document.Load(stream, Aspose.Words.FileFormatUtil.DetectEncryptionType(stream), password);
}
catch (Exception ex)
{
return false;
}
return true;
}
Parameters
stream
Stream
그 흐름을
password
string
암호는 문서를 해독합니다.
document
Document
충전된 문서입니다.
Returns
문서가 암호화되면 반드시 가짜로 반환됩니다.
Examples
문서가 암호로 보호되어 있는지 확인하는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
string fileName = Path.Combine(dataDir, "Aspose.one");
Document document;
if (!Document.IsEncrypted(fileName, out document))
{
Console.WriteLine("The document is loaded and ready to be processed.");
}
else
{
Console.WriteLine("The document is encrypted. Provide a password.");
}
문서가 특정 암호로 보호되는지 확인하는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
string fileName = Path.Combine(dataDir, "Aspose.one");
Document document;
if (Document.IsEncrypted(fileName, "VerySecretPassword", out document))
{
if (document != null)
{
Console.WriteLine("The document is decrypted. It is loaded and ready to be processed.");
}
else
{
Console.WriteLine("The document is encrypted. Invalid password was provided.");
}
}
else
{
Console.WriteLine("The document is NOT encrypted. It is loaded and ready to be processed.");
}
IsEncrypted(전류, 출력 문서)
흐름에서 문서가 암호화되었는지 확인합니다.그것을 확인하려면 우리는이 문서를 완전히 충전해야합니다.그래서이 방법은 성과 벌금으로 이어질 수 있습니다.
public static bool IsEncrypted(Stream stream, out Document document)
{
document = null;
try
{
document = new Document();
document.Load(stream);
return document.EncryptionSettings != null && document.EncryptionSettings.IsEncrypted;
}
catch
{
document = null;
throw;
}
}
Parameters
stream
Stream
그 흐름을
document
Document
충전된 문서입니다.
Returns
문서가 암호화되면 반드시 가짜로 반환됩니다.
Examples
문서가 암호로 보호되어 있는지 확인하는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
string fileName = Path.Combine(dataDir, "Aspose.one");
Document document;
if (!Document.IsEncrypted(fileName, out document))
{
Console.WriteLine("The document is loaded and ready to be processed.");
}
else
{
Console.WriteLine("The document is encrypted. Provide a password.");
}
문서가 특정 암호로 보호되는지 확인하는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
string fileName = Path.Combine(dataDir, "Aspose.one");
Document document;
if (Document.IsEncrypted(fileName, "VerySecretPassword", out document))
{
if (document != null)
{
Console.WriteLine("The document is decrypted. It is loaded and ready to be processed.");
}
else
{
Console.WriteLine("The document is encrypted. Invalid password was provided.");
}
}
else
{
Console.WriteLine("The document is NOT encrypted. It is loaded and ready to be processed.");
}
IsEncrypted(string, LoadOptions, 출력 문서)
파일에서 문서가 암호화되었는지 확인합니다.그것을 확인하려면 우리는이 문서를 완전히 충전해야합니다.그래서이 방법은 성과 벌금으로 이어질 수 있습니다.
public static bool IsEncrypted(string filePath, LoadOptions options, out Document document)
{
document = null;
try
{
using (var doc = new Document(File.OpenRead(filePath), options))
{
document = doc;
return false;
}
}
catch (InvalidPasswordException ex)
{
document = null;
return true;
}
}
Parameters
filePath
string
파일 경로 입니다.
options
LoadOptions
로드 옵션
document
Document
충전된 문서입니다.
Returns
문서가 암호화되면 반드시 가짜로 반환됩니다.
Examples
문서가 암호로 보호되어 있는지 확인하는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
string fileName = Path.Combine(dataDir, "Aspose.one");
Document document;
if (!Document.IsEncrypted(fileName, out document))
{
Console.WriteLine("The document is loaded and ready to be processed.");
}
else
{
Console.WriteLine("The document is encrypted. Provide a password.");
}
문서가 특정 암호로 보호되는지 확인하는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
string fileName = Path.Combine(dataDir, "Aspose.one");
Document document;
if (Document.IsEncrypted(fileName, "VerySecretPassword", out document))
{
if (document != null)
{
Console.WriteLine("The document is decrypted. It is loaded and ready to be processed.");
}
else
{
Console.WriteLine("The document is encrypted. Invalid password was provided.");
}
}
else
{
Console.WriteLine("The document is NOT encrypted. It is loaded and ready to be processed.");
}
IsEncrypted( 스트링, 출력 문서)
파일에서 문서가 암호화되었는지 확인합니다.그것을 확인하려면 우리는이 문서를 완전히 충전해야합니다.그래서이 방법은 성과 벌금으로 이어질 수 있습니다.
public static bool IsEncrypted(string filePath, out Document document)
{
document = null;
try
{
Aspose.Words.Document asposeDoc = new Aspose.Words.Document(filePath);
document = asposeDoc;
return asposeDoc.ProtectionSettings.EncryptionInfo != null;
}
catch (Exception ex)
{
}
document = null;
return false;
}
Parameters
filePath
string
파일 경로 입니다.
document
Document
충전된 문서입니다.
Returns
문서가 암호화되면 반드시 가짜로 반환됩니다.
Examples
문서가 암호로 보호되어 있는지 확인하는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
string fileName = Path.Combine(dataDir, "Aspose.one");
Document document;
if (!Document.IsEncrypted(fileName, out document))
{
Console.WriteLine("The document is loaded and ready to be processed.");
}
else
{
Console.WriteLine("The document is encrypted. Provide a password.");
}
문서가 특정 암호로 보호되는지 확인하는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
string fileName = Path.Combine(dataDir, "Aspose.one");
Document document;
if (Document.IsEncrypted(fileName, "VerySecretPassword", out document))
{
if (document != null)
{
Console.WriteLine("The document is decrypted. It is loaded and ready to be processed.");
}
else
{
Console.WriteLine("The document is encrypted. Invalid password was provided.");
}
}
else
{
Console.WriteLine("The document is NOT encrypted. It is loaded and ready to be processed.");
}
IsEncrypted(string, string, out 문서)
파일에서 문서가 암호화되었는지 확인합니다.그것을 확인하려면 우리는이 문서를 완전히 충전해야합니다.그래서이 방법은 성과 벌금으로 이어질 수 있습니다.
public static bool IsEncrypted(string filePath, string password, out Document document)
{
}
Parameters
filePath
string
파일 경로 입니다.
password
string
암호는 문서를 해독합니다.
document
Document
충전된 문서입니다.
Returns
문서가 암호화되면 반드시 가짜로 반환됩니다.
Examples
문서가 암호로 보호되어 있는지 확인하는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
string fileName = Path.Combine(dataDir, "Aspose.one");
Document document;
if (!Document.IsEncrypted(fileName, out document))
{
Console.WriteLine("The document is loaded and ready to be processed.");
}
else
{
Console.WriteLine("The document is encrypted. Provide a password.");
}
문서가 특정 암호로 보호되는지 확인하는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
string fileName = Path.Combine(dataDir, "Aspose.one");
Document document;
if (Document.IsEncrypted(fileName, "VerySecretPassword", out document))
{
if (document != null)
{
Console.WriteLine("The document is decrypted. It is loaded and ready to be processed.");
}
else
{
Console.WriteLine("The document is encrypted. Invalid password was provided.");
}
}
else
{
Console.WriteLine("The document is NOT encrypted. It is loaded and ready to be processed.");
}
숫자(Unnumerable)메르기 옵션 (MergeOptions)
문서에 몇 개의 페이지를 삽입합니다.
public Document Merge(IEnumerable<Page> pages, MergeOptions mergeOptions = null)
{
}
Parameters
pages
IEnumerable
<에 대한 정보
Page
>
몇 개의 페이지가 있습니다.
mergeOptions
MergeOptions
제공된 페이지를 결합하는 방법에 대한 옵션을 지정합니다.
Returns
문서에 대한 참조를 반환합니다.
Examples
PDF 문서의 모든 페이지를 5 페이지마다 하나의 OneNote 페이지로 그룹화하는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_Import();
var d = new Document();
var mergeOptions = new MergeOptions() { ImportAsSinglePage = true, PageSpacing = 100 };
IEnumerable<Page> pages = PdfImporter.Import(Path.Combine(dataDir, "SampleGrouping.pdf"));
while (pages.Any())
{
d.Merge(pages.Take(5), mergeOptions);
pages = pages.Skip(5);
}
d.Save(Path.Combine(dataDir, "sample_CustomMerge.one"));
프린트(
기본 프린터를 사용하여 문서를 인쇄합니다.
public void Print()
{
}
Examples
기본 옵션으로 표준 Windows 대화를 사용하여 프린터에 문서를 보내는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
var document = new Aspose.Note.Document(dataDir + "Aspose.one");
document.Print();
지정된 옵션을 가진 표준 Windows 대화를 사용하여 프린터에 문서를 보내는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
var document = new Aspose.Note.Document(dataDir + "Aspose.one");
var printerSettings = new PrinterSettings()
{
FromPage = 0,
ToPage = 10
};
printerSettings.DefaultPageSettings.Landscape = true;
printerSettings.DefaultPageSettings.Margins = new System.Drawing.Printing.Margins(50, 50, 150, 50);
document.Print(new PrintOptions()
{
PrinterSettings = printerSettings,
Resolution = 1200,
PageSplittingAlgorithm = new KeepSolidObjectsAlgorithm(),
DocumentName = "Test.one"
});
프린트 옵션 (Print Options)
기본 프린터를 사용하여 문서를 인쇄합니다.
public void Print(PrintOptions options)
{
}
Parameters
options
PrintOptions
문서를 인쇄하는 데 사용되는 옵션은 0이 될 수 있습니다.
스테인리스 ( String )
OneNote 문서를 파일로 저장합니다.
public void Save(string fileName)
{
}
Parameters
fileName
string
지정된 전체 이름을 가진 파일이 이미 존재한다면, 기존 파일은 과장됩니다.
Examples
문서를 저장하는 방법을 보여줍니다.
string inputFile = "Sample1.one";
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
string outputFile = "SaveDocToOneNoteFormat_out.one";
Document doc = new Document(dataDir + inputFile);
doc.Save(dataDir + outputFile);
Exceptions
IncorrectDocumentStructureException
문서 구조는 사양을 위반합니다.
UnsupportedSaveFormatException
요청된 저장 형식은 지원되지 않습니다.
흐름(Save Stream)
OneNote 문서를 스트림으로 저장합니다.
public void Save(Stream stream)
{
}
Parameters
stream
Stream
System.IO.Stream은 문서가 저장되는 곳입니다.
Exceptions
IncorrectDocumentStructureException
문서 구조는 사양을 위반합니다.
UnsupportedSaveFormatException
요청된 저장 형식은 지원되지 않습니다.
저장(String, SaveFormat)
OneNote 문서를 지정된 형식의 파일로 저장합니다.
public void Save(string fileName, Aspose.Words.SaveFormat format)
{
}
Parameters
fileName
string
지정된 전체 이름을 가진 파일이 이미 존재한다면, 기존 파일은 과장됩니다.
format
SaveFormat
문서를 저장할 수 있는 형식입니다.
Examples
SaveFormat 목록을 사용하여 문서를 저장하는 방법을 보여줍니다.
string inputFile = "Sample1.one";
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
string outputFile = "SaveDocToOneNoteFormatUsingSaveFormat_out.one";
Document document = new Document(dataDir + inputFile);
document.Save(dataDir + outputFile, SaveFormat.One);
GIF 형식으로 문서를 저장하는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
Document oneFile = new Document(dataDir + "Aspose.one");
dataDir += "SaveToImageDefaultOptions_out.gif";
oneFile.Save(dataDir, SaveFormat.Gif);
Exceptions
IncorrectDocumentStructureException
문서 구조는 사양을 위반합니다.
UnsupportedSaveFormatException
요청된 저장 형식은 지원되지 않습니다.
저장(Stream, SaveFormat)
OneNote 문서를 지정된 형식의 스트림으로 저장합니다.
public void Save(Stream stream, SaveFormat format)
{
}
Parameters
stream
Stream
System.IO.Stream은 문서가 저장되는 곳입니다.
format
SaveFormat
문서를 저장할 수 있는 형식입니다.
Examples
기본 설정을 사용하여 PDF 형식의 문서를 저장하는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
Document oneFile = new Document(dataDir + "Aspose.one");
string dataDirWithFileName = dataDir + "SaveWithDefaultSettings_out.pdf";
oneFile.Save(dataDirWithFileName, SaveFormat.Pdf);
흐름에 문서를 저장하는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
Document doc = new Document(dataDir + "Aspose.one");
MemoryStream dstStream = new MemoryStream();
doc.Save(dstStream, SaveFormat.Pdf);
dstStream.Seek(0, SeekOrigin.Begin);
어두운 테마 스타일을 문서에 적용하는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_Text();
Document doc = new Document(Path.Combine(dataDir, "Aspose.one"));
foreach (var page in doc)
{
page.BackgroundColor = Color.Black;
}
foreach (var node in doc.GetChildNodes<Aspose.Words.RichText>())
{
var c = node.ParagraphStyle.FontColor;
if (c.IsEmpty || Math.Abs(c.R - Color.Black.R) + Math.Abs(c.G - Color.Black.G) + Math.Abs(c.B - Color.Black.B) <= 30)
{
node.ParagraphStyle.FontColor = Color.White;
}
}
doc.Save(Path.Combine(dataDir, "AsposeDarkTheme.pdf"));
Exceptions
IncorrectDocumentStructureException
문서 구조는 사양을 위반합니다.
UnsupportedSaveFormatException
요청된 저장 형식은 지원되지 않습니다.
저장(string, SaveOptions)
OneNote 문서를 지정된 저장 옵션을 사용하여 파일에 보관합니다.
public void Save(string fileName, SaveOptions options)
{
}
Parameters
fileName
string
지정된 전체 이름을 가진 파일이 이미 존재한다면, 기존 파일은 과장됩니다.
options
SaveOptions
문서가 파일에 저장되는 방법에 대한 옵션을 지정합니다.
Examples
OneSaveOptions를 사용하여 문서를 저장하는 방법을 보여줍니다.
string inputFile = "Sample1.one";
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
string outputFile = "SaveDocToOneNoteFormatUsingOneSaveOptions_out.one";
Document document = new Document(dataDir + inputFile);
document.Save(dataDir + outputFile, new OneSaveOptions());
SaveFormat를 사용하여 Jpeg 형식의 이미지로 문서를 저장하는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
Document oneFile = new Document(dataDir + "Aspose.one");
dataDir += "SaveToJpegImageUsingSaveFormat_out.jpg";
oneFile.Save(dataDir, SaveFormat.Jpeg);
ImageSaveOptions를 사용하여 Bmp 형식의 이미지로 문서를 저장하는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
Document oneFile = new Document(dataDir + "Aspose.one");
dataDir += "SaveToBmpImageUsingImageSaveOptions_out.bmp";
oneFile.Save(dataDir, new ImageSaveOptions(SaveFormat.Bmp));
편지 페이지 레이아웃을 사용하여 PDF 형식으로 문서를 저장하는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
Document oneFile = new Document(dataDir + "OneNote.one");
var dst = Path.Combine(dataDir, "SaveToPdfUsingLetterPageSettings.pdf");
oneFile.Save(dst, new PdfSaveOptions() { PageSettings = PageSettings.Letter });
높이 제한없이 A4 페이지 레이아웃을 사용하여 PDF 형식으로 문서를 저장하는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
Document oneFile = new Document(dataDir + "OneNote.one");
var dst = Path.Combine(dataDir, "SaveToPdfUsingA4PageSettingsWithoutHeightLimit.pdf");
oneFile.Save(dst, new PdfSaveOptions() { PageSettings = PageSettings.A4NoHeightLimit });
그레이 스케일 이미지로 문서를 저장하는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
Document oneFile = new Document(dataDir + "Aspose.one");
dataDir += "SaveAsGrayscaleImage_out.png";
oneFile.Save(dataDir, new ImageSaveOptions(SaveFormat.Png)
{
ColorMode = ColorMode.GrayScale
});
PackBits 압축을 사용하여 Tiff 형식의 이미지로 문서를 저장하는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
Document oneFile = new Document(Path.Combine(dataDir, "Aspose.one"));
var dst = Path.Combine(dataDir, "SaveToTiffUsingPackBitsCompression.tiff");
oneFile.Save(dst, new ImageSaveOptions(SaveFormat.Tiff)
{
TiffCompression = TiffCompression.PackBits
});
Jpeg 압축을 사용하여 Tiff 형식의 이미지로 문서를 저장하는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
Document oneFile = new Document(Path.Combine(dataDir, "Aspose.one"));
var dst = Path.Combine(dataDir, "SaveToTiffUsingJpegCompression.tiff");
oneFile.Save(dst, new ImageSaveOptions(SaveFormat.Tiff)
{
TiffCompression = TiffCompression.Jpeg,
Quality = 93
});
CCITT 그룹 3 팩스 압축을 사용하여 Tiff 형식의 이미지로 문서를 저장하는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
Document oneFile = new Document(Path.Combine(dataDir, "Aspose.one"));
var dst = Path.Combine(dataDir, "SaveToTiffUsingCcitt3Compression.tiff");
oneFile.Save(dst, new ImageSaveOptions(SaveFormat.Tiff)
{
ColorMode = ColorMode.BlackAndWhite,
TiffCompression = TiffCompression.Ccitt3
});
PDF 형식으로 문서를 저장하는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
Document oneFile = new Document(dataDir + "Aspose.one");
PdfSaveOptions opts = new PdfSaveOptions()
{
PageIndex = 0,
PageCount = 1,
};
dataDir += "SaveRangeOfPagesAsPDF_out.pdf";
oneFile.Save(dataDir, opts);
특정 설정을 사용하여 PDF 형식의 문서를 저장하는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
Document doc = new Document(dataDir + "Aspose.one");
PdfSaveOptions opts = new PdfSaveOptions
{
ImageCompression = Saving.Pdf.PdfImageCompression.Jpeg,
JpegQuality = 90
};
dataDir += "Document.SaveWithOptions_out.pdf";
doc.Save(dataDir, opts);
Otsu의 방법을 사용하여 문서를 바이너리 이미지로 저장하는 법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
Document oneFile = new Document(dataDir + "Aspose.one");
dataDir += "SaveToBinaryImageUsingOtsuMethod_out.png";
oneFile.Save(dataDir, new ImageSaveOptions(SaveFormat.Png)
{
ColorMode = ColorMode.BlackAndWhite,
BinarizationOptions = new ImageBinarizationOptions()
{
BinarizationMethod = BinarizationMethod.Otsu,
}
});
고정 한계를 사용하여 이중 이미지로 문서를 저장하는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
Document oneFile = new Document(dataDir + "Aspose.one");
dataDir += "SaveToBinaryImageUsingFixedThreshold_out.png";
oneFile.Save(dataDir, new ImageSaveOptions(SaveFormat.Png)
{
ColorMode = ColorMode.BlackAndWhite,
BinarizationOptions = new ImageBinarizationOptions()
{
BinarizationMethod = BinarizationMethod.FixedThreshold,
BinarizationThreshold = 123
}
});
Exceptions
IncorrectDocumentStructureException
문서 구조는 사양을 위반합니다.
UnsupportedSaveFormatException
요청된 저장 형식은 지원되지 않습니다.
저장(Stream, SaveOptions)
OneNote 문서를 지정된 저장 옵션을 사용하여 스트림으로 저축합니다.
public void Save(Stream stream, SaveOptions options)
{
}
Parameters
stream
Stream
System.IO.Stream은 문서가 저장되는 곳입니다.
options
SaveOptions
문서가 흐름에 저장되는 방법에 대한 옵션을 지정합니다.
Examples
지정된 기본 글꼴을 사용하여 PDF 형식으로 문서를 저장하는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
Document oneFile = new Document(Path.Combine(dataDir, "missing-font.one"));
string dataDirWithOutputPath = dataDir + "SaveUsingDocumentFontsSubsystemWithDefaultFontName_out.pdf";
oneFile.Save(dataDirWithOutputPath, new PdfSaveOptions()
{
FontsSubsystem = DocumentFontsSubsystem.UsingDefaultFont("Times New Roman")
});
PDF 형식의 문서를 기본 글꼴을 사용하여 파일에서 저장하는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
string fontFile = Path.Combine(dataDir, "geo_1.ttf");
Document oneFile = new Document(Path.Combine(dataDir, "missing-font.one"));
string outputFile = dataDir + "SaveUsingDocumentFontsSubsystemWithDefaultFontFromFile_out.pdf";
oneFile.Save(outputFile, new PdfSaveOptions()
{
FontsSubsystem = DocumentFontsSubsystem.UsingDefaultFontFromFile(fontFile)
});
PDF 형식의 문서를 기본 글꼴을 사용하여 스트림에서 저장하는 방법을 보여줍니다.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
string fontFile = Path.Combine(dataDir, "geo_1.ttf");
Document oneFile = new Document(Path.Combine(dataDir, "missing-font.one"));
string fullDataDir = dataDir + "SaveUsingDocumentFontsSubsystemWithDefaultFontFromStream_out.pdf";
using (var stream = File.Open(fontFile, FileMode.Open, FileAccess.Read, FileShare.Read))
{
oneFile.Save(fullDataDir, new PdfSaveOptions()
{
FontsSubsystem = DocumentFontsSubsystem.UsingDefaultFontFromStream(stream)
});
}
Exceptions
IncorrectDocumentStructureException
문서 구조는 사양을 위반합니다.
UnsupportedSaveFormatException
요청된 저장 형식은 지원되지 않습니다.