XMP 메타데이터 조작
EPS 파일에서 메타데이터를 손쉽게 추가, 편집 및 검색하여 문서 정보를 완전히 제어할 수 있습니다. Aspose.Page Solution for C++로 EPS 파일의 콘텐츠를 새로운 수준으로 높이세요!
XMP 메타데이터는 파일을 설명하는 속성의 모음입니다. XML 형식으로 작성됩니다. 메타데이터에는 파일 콘텐츠에 대한 정보, 다른 파일과 구별하는 식별 세부 정보, 그리고 파일의 생성, 수정 및 업로드 이력과 관련된 기타 데이터가 포함됩니다. 또한 파일의 생성, 편집 및 업로드에 기여한 사용자에 대한 세부 정보도 기록합니다.
C++ API 솔루션으로 EPS 파일의 잠재력을 발휘하세요! XMP 메타데이터와의 원활한 통합으로 EPS 문서를 완벽히 제어할 수 있습니다. 디지털 자산 관리, 저작권 정보 향상, 또는 창의적인 워크플로 최적화 등 어떤 작업을 하든 API가 프로세스를 단순화하여 정밀도와 효율성을 보장합니다. 메타데이터 처리 능력을 향상시키고 EPS 파일에 대한 더 깊은 통찰력을 얻으세요. C++ API 솔루션을 사용하여 XMP 메타데이터와의 원활한 통합을 경험하세요. 지금 솔루션을 구매하거나 무료 평가판을 이용하여 EPS 파일에서 메타데이터를 추가, 편집 및 검색하는 기능을 발견하세요! XMP 메타데이터 작업에 대한 자세한 내용과 예제는 GitHub 의 Aspose.Page API 설명서를 참조하세요. XMP 메타데이터 편집기 웹 앱도 사용해 보세요.
코드 예제를 실행하려면 다음이 필요합니다:
C++ 플랫폼을 위한 기능이 풍부하고 강력하며 사용하기 쉬운 문서 조작 및 변환 API인 Aspose.Page for C++ API.
최신 버전을 직접 다운로드할 수 있습니다. NuGet 패키지 관리자를 열고 Aspose.Page.Cpp를 검색하여 설치하세요. 패키지 관리자 콘솔에서 다음 명령을 사용할 수도 있습니다.
Package Manager Console Command
PM> Install-Package Aspose.Page.Cpp
C++로 EPS 파일에 XMP 메타데이터 추가하기
EPS에 XMP 메타데이터를 삽입하려면 XmpMetadata Class의 엔터티를 사용해야 합니다. 다음 단계를 따르세요:
- 문서가 있는 디렉터리의 경로를 설정합니다.
- EPS 파일에 대한 입력 스트림을 초기화합니다.
- PsDocument 클래스를 사용하여 입력 스트림에서 PS 파일을 만듭니다.
- GetXmpMetadata() 메서드를 호출하여 XMP 메타데이터를 검색합니다. EPS 파일에 XMP 메타데이터가 없으면 PS 메타데이터 주석의 값으로 채워진 새 메타데이터를 얻습니다.
- Save() 메서드를 호출하여 변경된 EPS 문서를 저장합니다.
XMP 메타데이터 추가
// The path to the documents directory.
System::String dataDir = RunExamples::GetDataDir_WorkingWithXMPMetadataInEPS();
// Initialize EPS file input stream
System::SharedPtr<System::IO::FileStream> psStream = System::MakeObject<System::IO::FileStream>(dataDir + u"add_input.eps", System::IO::FileMode::Open, System::IO::FileAccess::Read);
// Create PsDocument instance from stream
System::SharedPtr<PsDocument> document = System::MakeObject<PsDocument>(psStream);
{
auto __finally_guard_0 = ::System::MakeScopeGuard([&psStream]()
{
psStream->Close();
});
try
{
// Get XMP metadata. If EPS file doesn't contain XMP metadata we get new one filled with values from PS metadata comments (%%Creator, %%CreateDate, %%Title etc)
System::SharedPtr<XmpMetadata> xmp = document->GetXmpMetadata();
// Check metadata values extracted from PS metadata comments and set up in new XMP metadata
// Get "CreatorTool" value
if (xmp->Contains(u"xmp:CreatorTool"))
{
System::Console::WriteLine(System::String(u"CreatorTool: ") + xmp->idx_get(u"xmp:CreatorTool")->ToStringValue());
}
// Get "CreateDate" value
if (xmp->Contains(u"xmp:CreateDate"))
{
System::Console::WriteLine(System::String(u"CreateDate: ") + xmp->idx_get(u"xmp:CreateDate")->ToStringValue());
}
// Get "format" value
if (xmp->Contains(u"dc:format"))
{
System::Console::WriteLine(System::String(u"Format: ") + xmp->idx_get(u"dc:format")->ToStringValue());
}
// Get "title" value
if (xmp->Contains(u"dc:title"))
{
System::Console::WriteLine(System::String(u"Title: ") + xmp->idx_get(u"dc:title")->ToArray()->idx_get(0)->ToStringValue());
}
// Get "creator" value
if (xmp->Contains(u"dc:creator"))
{
System::Console::WriteLine(System::String(u"Creator: ") + xmp->idx_get(u"dc:creator")->ToArray()->idx_get(0)->ToStringValue());
}
// Get "MetadataDate" value
if (xmp->Contains(u"xmp:MetadataDate"))
{
System::Console::WriteLine(System::String(u"MetadataDate: ") + xmp->idx_get(u"xmp:MetadataDate")->ToStringValue());
}
// Save EPS file with new XMP metadata
// Create ouput stream
{
System::SharedPtr<System::IO::FileStream> outPsStream = System::MakeObject<System::IO::FileStream>(dataDir + u"output/" + u"add_output.eps", System::IO::FileMode::Create, System::IO::FileAccess::Write);
// Clearing resources under 'using' statement
System::Details::DisposeGuard<1> __dispose_guard_1({ outPsStream});
// ------------------------------------------
try
{
// Save EPS file
document->Save(outPsStream);
}
catch(...)
{
__dispose_guard_1.SetCurrentException(std::current_exception());
}
}
}
catch (...)
{
throw;
}
}
C++로 EPS 파일의 XMP 메타데이터 변경하기
XMP 메타데이터에 배열 항목을 추가하려면 동일한 엔터티를 사용하고 유사한 단계를 따라야 합니다. 추가 단계에서는 SetArrayItem 또는 AddArrayItem() 을 사용해야 합니다.
XMP 메타데이터 변경
// The path to the documents directory.
System::String dataDir = RunExamples::GetDataDir_WorkingWithXMPMetadataInEPS();
// Initialize EPS file input stream
System::SharedPtr<System::IO::FileStream> psStream = System::MakeObject<System::IO::FileStream>(dataDir + u"add_simple_props_input.eps", System::IO::FileMode::Open, System::IO::FileAccess::Read);
// Create PsDocument instance from stream
System::SharedPtr<PsDocument> document = System::MakeObject<PsDocument>(psStream);
{
auto __finally_guard_0 = ::System::MakeScopeGuard([&psStream]()
{
psStream->Close();
});
try
{
// Get XMP metadata. If EPS file doesn't contain XMP metadata we get new one filled with values from PS metadata comments (%%Creator, %%CreateDate, %%Title etc)
System::SharedPtr<XmpMetadata> xmp = document->GetXmpMetadata();
//Change XMP metadata values
// Add one more title. I will be added at the end of array by default.
xmp->AddArrayItem(u"dc:title", System::MakeObject<XmpValue>(u"NewTitle"));
// Add one more creator. It will be added in the array by an index (0).
xmp->AddArrayItem(u"dc:creator", 0, System::MakeObject<XmpValue>(u"NewCreator"));
// Save EPS file with changed XMP metadata
// Create ouput stream
{
System::SharedPtr<System::IO::FileStream> outPsStream = System::MakeObject<System::IO::FileStream>(dataDir + u"output/" + u"add_array_items_output.eps", System::IO::FileMode::Create, System::IO::FileAccess::Write);
// Clearing resources under 'using' statement
System::Details::DisposeGuard<1> __dispose_guard_1({ outPsStream});
// ------------------------------------------
try
{
// Save EPS file
document->Save(outPsStream);
}
catch(...)
{
__dispose_guard_1.SetCurrentException(std::current_exception());
}
}
}
catch (...)
{
throw;
}
}EPS EPS 파일 형식이란 무엇입니까?
EPS (Encapsulated PostScript) は、単一ページのレイアウトを記述する PostScript ベースのフォーマットです。ベクター画像やベクター‑ラスタ混合画像に最適で、インポート後は編集できないため、SVG や PDF など編集可能な形式に変換して使用します。