Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
Aspose.PDF는 Document 클래스를 사용하여 PDF 포트폴리오 문서를 생성할 수 있습니다. FileSpecification 클래스를 사용하여 파일을 가져온 후 Document.Collection 객체에 파일을 추가합니다. 파일이 추가되면 Document 클래스의 Save 메서드를 사용하여 포트폴리오 문서를 저장합니다.
다음 예제는 Microsoft Excel 파일, Word 문서 및 이미지 파일을 사용하여 PDF 포트폴리오를 생성합니다.
아래 코드는 다음과 같은 포트폴리오를 생성합니다.
다음 코드 조각은 Aspose.PDF.Drawing 라이브러리와 함께 작동합니다.
// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET
private static void CreatePortfolio()
{
// The path to the documents directory
var dataDir = RunExamples.GetDataDir_AsposePdf_TechnicalArticles();
// Create PDF document
using (var document = new Aspose.Pdf.Document())
{
// Instantiate document Collection object
document.Collection = new Aspose.Pdf.Collection();
// Get Files to add to Portfolio
var excel = new Aspose.Pdf.FileSpecification(dataDir + "HelloWorld.xlsx");
var word = new Aspose.Pdf.FileSpecification(dataDir + "HelloWorld.docx");
var image = new Aspose.Pdf.FileSpecification(dataDir + "aspose-logo.jpg");
// Provide description of the files
excel.Description = "Excel File";
word.Description = "Word File";
image.Description = "Image File";
// Add files to document collection
document.Collection.Add(excel);
document.Collection.Add(word);
document.Collection.Add(image);
// Save PDF document
document.Save(dataDir + "CreatePortfolio_out.pdf");
}
}
PDF 포트폴리오는 다양한 출처(예: PDF, Word, Excel, JPEG 파일)의 콘텐츠를 하나의 통합 컨테이너로 모을 수 있게 해줍니다. 원본 파일은 개별 정체성을 유지하지만 PDF 포트폴리오 파일로 조립됩니다. 사용자는 각 구성 요소 파일을 다른 구성 요소 파일과 독립적으로 열고, 읽고, 편집하고, 형식을 지정할 수 있습니다.
Aspose.PDF는 Document 클래스를 사용하여 PDF 포트폴리오 문서를 생성할 수 있습니다. 또한 PDF 포트폴리오에서 파일을 추출하는 기능도 제공합니다.
다음 코드 조각은 PDF 포트폴리오에서 파일을 추출하는 단계를 보여줍니다.
// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET
private static void ExtractPortfolioFiles()
{
// The path to the documents directory
var dataDir = RunExamples.GetDataDir_AsposePdf_TechnicalArticles();
// Open PDF document
using (var document = new Aspose.Pdf.Document(dataDir + "PDFPortfolio.pdf"))
{
// Get collection of embedded files
Aspose.Pdf.EmbeddedFileCollection embeddedFiles = document.EmbeddedFiles;
// Iterate through individual file of Portfolio
foreach (Aspose.Pdf.FileSpecification fileSpecification in embeddedFiles)
{
// Get the attachment and write to file or stream
byte[] fileContent = new byte[fileSpecification.Contents.Length];
fileSpecification.Contents.Read(fileContent, 0, fileContent.Length);
string filename = Path.GetFileName(fileSpecification.Name);
// Save the extracted file to some location
using (FileStream fileStream = new FileStream(dataDir + filename + "_out", FileMode.Create))
{
fileStream.Write(fileContent, 0, fileContent.Length);
}
}
}
}
PDF 포트폴리오에서 파일을 삭제/제거하려면 다음 코드 줄을 사용해 보십시오.
// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET
private static void RemovePortfolioFiles()
{
// The path to the documents directory
var dataDir = RunExamples.GetDataDir_AsposePdf_TechnicalArticles();
// Open PDF document
using (var document = new Aspose.Pdf.Document(dataDir + "PDFPortfolio.pdf"))
{
document.Collection.Delete();
// Save PDF document
document.Save(dataDir + "NoPortFolio_out.pdf");
}
}
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.