Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
PDF의 아티팩트는 문서의 실제 콘텐츠에 포함되지 않는 그래픽 객체 또는 기타 요소입니다. 일반적으로 장식, 레이아웃 또는 배경 용도로 사용됩니다. 아티팩트의 예로는 페이지 헤더, 바닥글, 구분선 또는 의미를 전달하지 않는 이미지가 있습니다.
PDF에서 아티팩트의 목적은 콘텐츠와 비콘텐츠 요소를 구분할 수 있도록 하는 것입니다. 이는 접근성에 중요하며, 스크린 리더 및 기타 보조 기술이 아티팩트를 무시하고 관련 콘텐츠에 집중할 수 있습니다. 아티팩트는 인쇄, 검색 또는 복사에서 생략될 수 있으므로 PDF 문서의 성능과 품질을 향상시킬 수 있습니다.
PDF에서 요소를 아티팩트로 만들려면 Artifact 클래스를 사용해야 합니다. 다음과 같은 유용한 속성이 포함되어 있습니다:
다음 클래스도 아티팩트 작업에 유용할 수 있습니다:
Adobe Acrobat으로 생성된 워터마크는 아티팩트라고 불립니다 (PDF 사양의 14.8.2.2 실제 콘텐츠 및 아티팩트에서 설명됨).
특정 페이지의 모든 워터마크를 가져오려면 Page 클래스의 Artifacts 속성을 사용합니다.
다음 코드 조각은 PDF 파일의 첫 번째 페이지에서 모든 워터마크를 가져오는 방법을 보여줍니다.
참고: 이 코드는 Aspose.PDF.Drawing 라이브러리와도 작동합니다.
// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET
private static void ExtractWatermarkFromPDF()
{
// The path to the documents directory
var dataDir = RunExamples.GetDataDir_AsposePdf();
// Open PDF document
using (var document = new Aspose.Pdf.Document(dataDir + "sample-w.pdf"))
{
// Get the watermarks from the first page artifacts
var watermarks = document.Pages[1].Artifacts
.Where(artifact =>
artifact.Type == Aspose.Pdf.Artifact.ArtifactType.Pagination
&& artifact.Subtype == Aspose.Pdf.Artifact.ArtifactSubtype.Watermark);
// Iterate through the found watermark artifacts and print details
foreach (Aspose.Pdf.WatermarkArtifact item in watermarks.Cast<Aspose.Pdf.WatermarkArtifact>())
{
Console.WriteLine($"{item.Text} {item.Rectangle}");
}
}
}
배경 이미지는 문서에 워터마크 또는 기타 미세한 디자인을 추가하는 데 사용할 수 있습니다. Aspose.PDF for .NET에서 각 PDF 문서는 페이지의 컬렉션이며 각 페이지는 아티팩트의 컬렉션을 포함합니다. BackgroundArtifact 클래스를 사용하여 페이지 객체에 배경 이미지를 추가할 수 있습니다.
다음 코드 조각은 BackgroundArtifact 객체를 사용하여 PDF 페이지에 배경 이미지를 추가하는 방법을 보여줍니다.
// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET
private static void AddBackgroundImageToPDF()
{
// The path to the documents directory
var dataDir = RunExamples.GetDataDir_AsposePdf();
// Open PDF document
using (var document = new Aspose.Pdf.Document(dataDir + "sample.pdf"))
{
// Create a new BackgroundArtifact and set the background image
var background = new Aspose.Pdf.BackgroundArtifact()
{
BackgroundImage = File.OpenRead(dataDir + "background.jpg")
};
// Add the background image to the first page's artifacts
document.Pages[1].Artifacts.Add(background);
// Save PDF document with the added background
document.Save(dataDir + "SampleArtifactsBackground_out.pdf");
}
}
어떤 이유로든 단색 배경을 사용하려면 이전 코드를 다음과 같이 변경하십시오:
// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET
private static void AddBackgroundColorToPDF()
{
// The path to the documents directory
var dataDir = RunExamples.GetDataDir_AsposePdf();
// Open PDF document
using (var document = new Aspose.Pdf.Document(dataDir + "sample.pdf"))
{
// Create a new BackgroundArtifact and set the background color
var background = new Aspose.Pdf.BackgroundArtifact()
{
BackgroundColor = Aspose.Pdf.Color.DarkKhaki
};
// Add the background color to the first page's artifacts
document.Pages[1].Artifacts.Add(background);
// Save PDF document
document.Save(dataDir + "SampleArtifactsBackground_out.pdf");
}
}
특정 유형의 아티팩트(예: 총 워터마크 수)를 계산하려면 다음 코드를 사용하십시오:
// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET
private static void CountPDFArtifacts()
{
// The path to the documents directory
var dataDir = RunExamples.GetDataDir_AsposePdf();
// Open PDF document
using (var document = new Aspose.Pdf.Document(dataDir + "sample.pdf"))
{
// Get pagination artifacts from the first page
var paginationArtifacts = document.Pages[1].Artifacts
.Where(artifact => artifact.Type == Aspose.Pdf.Artifact.ArtifactType.Pagination);
// Count and display the number of each artifact type
Console.WriteLine("Watermarks: {0}",
paginationArtifacts.Count(a => a.Subtype == Aspose.Pdf.Artifact.ArtifactSubtype.Watermark));
Console.WriteLine("Backgrounds: {0}",
paginationArtifacts.Count(a => a.Subtype == Aspose.Pdf.Artifact.ArtifactSubtype.Background));
Console.WriteLine("Headers: {0}",
paginationArtifacts.Count(a => a.Subtype == Aspose.Pdf.Artifact.ArtifactSubtype.Header));
Console.WriteLine("Footers: {0}",
paginationArtifacts.Count(a => a.Subtype == Aspose.Pdf.Artifact.ArtifactSubtype.Footer));
}
}
문서에 베이츠 번호 아티팩트를 추가하려면 AddBatesNumbering(BatesNArtifact batesNArtifact)
확장 메서드를 호출하고 PageCollection
에 BatesNArtifact
객체를 매개변수로 전달하십시오:
또는 PaginationArtifacts
의 컬렉션을 전달할 수 있습니다:
또는 액션 델리게이트를 사용하여 베이츠 번호 아티팩트를 추가할 수 있습니다:
베이츠 번호를 삭제하려면 다음 코드를 사용하십시오:
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.