PUB 파일 오프너
PUB 파일을 읽습니다. .NET용 API로 게시자 열기
PUB 파일을 쉽게 볼 수 있습니다: MS Publisher가 필요 없습니다!
Microsoft Publisher(.pub) 파일은 뉴스레터, 브로셔 및 전단지를 만드는 데 일반적으로 사용됩니다. 인기가 있지만 Publisher 소프트웨어 없이 열기가 어려울 수 있습니다.
이때 크로스‑플랫폼 PUB Viewer 애플리케이션이 유용합니다. 파일 내용을 확인할 수 있어 프레젠테이션이나 검토와 같이 정보를 단순히 확인하고 싶을 때 이상적입니다. 이를 통해 파일 크기, 차원, 사용된 폰트, 필드 수, 색 구성표 등에 대한 정보를 얻을 수 있습니다.
또한 이 도구는 단순한 보기 기능을 넘어 PUB 문서 자체에 대한 유용한 세부 정보를 제공합니다. 여기에서 .NET API 솔루션을 사용하여 MS Publisher 문서의 크기, 너비, 높이, 사용된 폰트 이름, 필드 수 및 색상과 같은 속성을 확인할 수 있습니다.
.NET에서 PUB 파일을 여는 방법
PUB 파일 속성을 보려면 다음 단계를 수행해야 합니다:
- .NET PUB API를 통합합니다. 단일 페이지 문서뿐만 아니라 다중 페이지 .pub 파일도 지원합니다.
- PubFactory 클래스의 [CreateParser()] 메서드를 사용하여 PUB 파일을 업로드합니다.
- IPubParser 인터페이스의 [Parse()] 메서드를 사용하여 문서를 파싱합니다.
- 문서 properties 를 출력합니다.
.NET PUB API 시작하기
제품을 설치하는 방법은 두 가지가 있습니다:
- 명령줄에서
nuget install Aspose.PUB또는 Visual Studio의 Package Manager Console에서Install-Package Aspose.PUB로 설치합니다. - 또는 downloads 페이지에서 오프라인 MSI 설치 프로그램이나 ZIP 파일 형태의 DLL을 다운로드합니다.
PUB 파일 속성을 읽는 .NET 코드
// Load PUB file
var parser = PubFactory.CreateParser("sample.pub");
// Parse file
var doc = parser.Parse();
// Print document properties
Console.WriteLine($"Page width: {GetInchesString(doc.Width)}");
Console.WriteLine($"Page height: {GetInchesString(doc.Height)}");
Console.WriteLine($"Field count: {doc.FieldCount}");
string fontNames = GetCollectionString(doc.FontNames);
if (!string.IsNullOrEmpty(fontNames))
{
Console.WriteLine($"Fonts used in document: {fontNames}");
}
string colors = GetCollectionString(doc.Colors);
if (!string.IsNullOrEmpty(colors))
{
Console.WriteLine($"Colors used in document: {colors}");
}전체 코드 ReadPubDocument.cs 예제를 보려면 Aspose.PUB.Examples.sln 솔루션( Aspose.PUB 문서의 net‑examples)으로 이동하면 라이브러리 사용 방법에 대한 다른 예제도 찾을 수 있습니다.
// Description of invoked methods:
private string GetInchesString(uint size)
{
double value = (double)size / EMUsesInOneInch;
return Convert.ToString(value) + " inches";
}
private string GetCollectionString(ICollection array)
{
if (array.Count == 0)
{
return null;
}
StringBuilder sb = new StringBuilder();
int num = -1;
IEnumerator enumerator = array.GetEnumerator();
while (enumerator.MoveNext())
{
num++;
sb.Append(GetObjectStirng(enumerator.Current));
if (num < (array.Count - 1))
{
sb.Append(", ");
}
}
return sb.ToString();
}
private string GetObjectStirng(object value)
{
if (value is Color)
{
Color colorVal = (Color)value;
return $"RGB({colorVal.R}, {colorVal.G}, {colorVal.B})";
}
return value.ToString();
}자주하는 질문
1. Microsoft Publisher 파일을 보려면 어떻게 해야 합니까?
무료가 아닌 작은 소프트웨어로 게시자 파일을 열 수 있습니다. 그러나 파일의 내용을 온라인으로 보려면 크로스 플랫폼 Viewer 애플리케이션을 사용할 수 있습니다.
2. Word에서 Publisher 파일을 열 수 있습니까?
MS Word에서 PUB 파일을 열려면 PUB 파일이 필요합니다. 웹 Converter 애플리케이션을 사용하여 온라인으로 할 수 있습니다.
3. 기능은 무료인가요?
크로스 플랫폼 앱은 무료이며 API 솔루션의 경우 무료 평가판을 받은 후 필요한 경우 제품을 구입할 수 있습니다.