ViewerConfig

클라이언트 뷰어 위젯 옵션

ViewerConfig (namespace Doconut) 은 브라우저 뷰어의 외관과 동작을 설명합니다. 문서 렌더링 품질에는 영향을 주지 않으며, 이를 위해서는 포맷 설정을 사용하십시오. C# 클래스와 레거시 JavaScript 플러그인은 기본값이 다르므로 값을 명시적으로 매핑해야 합니다.

C# properties

TypePropertyDefaultDescription
boolShowThumbstrue썸네일 패널을 표시합니다.
boolAutoLoadfalse초기화 후 자동으로 로드합니다. 일반 토큰 흐름에서는 View(token)을 명시적으로 호출합니다.
boolAutoFocustrue초기화 중에 브라우저 포커스/스크롤을 뷰어로 이동합니다.
boolAutoPageFocustrue페이지가 바뀔 때 현재 썸네일이 보이도록 유지합니다.
intPageZoom100초기 줌 비율(퍼센트)입니다.
intZoomStep10줌 명령으로 추가하거나 제거되는 퍼센트입니다.
intMaxZoom300최대 줌 비율(퍼센트)입니다.
boolShowToolTiptrue스크롤 중에 페이지 위치 툴팁을 표시합니다.
stringToolTipPageText"Page "페이지 툴팁에 사용되는 접두사입니다.
boolCacheEnabledfalse페이지 이미지의 이동 윈도우를 브라우저 메모리에 유지합니다. localStorage를 사용하지 않습니다.
boolLargeDocfalse큰 문서의 경우 페이지 요소를 시간 간격을 두고 배치합니다.
boolShowHyperlinksfalse서버 설정이 추출한 하이퍼링크 오버레이를 렌더링합니다.
boolFixedZoomtrue반응형 재계산 대신 고정 줌 비율을 사용합니다.
intFixedZoomPercent100고정 데스크톱 줌 비율입니다.
intFixedZoomPercentMobile75고정 모바일 줌 비율입니다.
stringBasePath"/"호스트가 UseDoconut()을 매핑하는 브랜치입니다.
stringResPath"doconut-res"위젯이 사용하는 리소스 기본 경로입니다. 일반 설정에서는 <ResourcesPath>/images 로 지정합니다.
stringFitType"width"자동 맞춤이 없을 경우 빈 문자열, "width", "height" 중 하나를 사용합니다. 현재 위젯에서는 "page"를 지원하지 않습니다.
boolRetryOn409false비동기/분산 페이지 요청이 409 응답을 받을 때 폴링을 활성화합니다. 일반 동기 뷰어에서는 필요하지 않습니다.
csharp
var config = new ViewerConfig
{
    ShowThumbs = true,
    AutoLoad = false,
    PageZoom = 100,
    MaxZoom = 300,
    FitType = "width",
    BasePath = "/doconut",
    ResPath = "/doconut-res/images",
    ShowHyperlinks = true
};

C# to JavaScript mapping

직렬화된 ViewerConfigdocViewer(...)에 직접 전달하지 마십시오. 대부분의 위젯 키는 camelCase이며, 세 개의 경로/맞춤 키는 PascalCase입니다.

C#JavaScript
ShowThumbsshowThumbs
AutoLoadautoLoad
AutoFocusautoFocus
AutoPageFocusautoPageFocus
PageZoompageZoom
ZoomStepzoomStep
MaxZoommaxZoom
ShowToolTipshowToolTip
ToolTipPageTexttoolTipPageText
CacheEnabledcacheEnabled
LargeDoclargeDoc
ShowHyperlinksshowHyperlinks
FixedZoomfixedZoom
FixedZoomPercentfixedZoomPercent
FixedZoomPercentMobilefixedZoomPercentMobile
BasePathBasePath
ResPathResPath
FitTypeFitType
RetryOn409retryOn409

JavaScript defaults

위젯은 C# 클래스와 다른 오래된 기본값을 가지고 있습니다. 아래 값들은 현재 docViewer.js 구현에서 가져온 것입니다.

OptionDefaultNotes
leftMinWidth / leftMaxWidth220 / 800썸네일 패널 너비 범위.
showThumbstrue초기 썸네일 표시 여부.
autoFocus / autoPageFocustrue / falseautoPageFocus 가 C# 기본값과 다릅니다.
thumbWidth / thumbHeight / thumbPadding150 / 200 / 10픽셀 단위 썸네일 크기와 패딩.
pageZoom / zoomStep / maxZoom100 / 10 / 200JavaScript maxZoom 은 C#(300)과 다릅니다.
showToolTip / toolTipPageTexttrue / "Page "페이지 위치 툴팁.
format / doc / AccessToken"" / 0 / ""내부 초기화 값; 보통 View(token)에 의해 채워집니다.
debugModefalse추가 클라이언트 진단.
FitType""제공되지 않으면 자동 맞춤이 없습니다.
BasePath"DocImage.axd"레거시 핸들러 기본값. ASP.NET Core에서는 명시적으로 설정하십시오.
ResPath""임베디드 이미지 경로를 명시적으로 설정하십시오.
cacheEnabled / cacheCount / cacheDelayfalse / 3 / 3메모리 내 페이지 사전 로드 윈도우와 지연 시간.
autoLoadfalse명시적인 토큰 흐름을 권장합니다.
largeDoctrueC# 기본값과 다릅니다.
fixedZoomfalseC# 기본값과 다릅니다.
fixedZoomPercent / fixedZoomPercentMobile100 / 50모바일 값이 C#(75)과 다릅니다.
showHyperlinkstrue오버레이를 표시하려면 서버 측 추출이 필요합니다.

동작에 중요한 값들은 모두 명시적으로 설정하고, 기본값에 의존하지 마십시오:

html
<div id="divDocViewer"><div id="div_ctlDoc"></div></div>

<script>
const objViewer = $('#div_ctlDoc').docViewer({
    showThumbs: true,
    autoLoad: false,
    autoFocus: true,
    autoPageFocus: true,
    pageZoom: 100,
    zoomStep: 10,
    maxZoom: 300,
    FitType: 'width',
    cacheEnabled: false,
    largeDoc: false,
    showHyperlinks: true,
    fixedZoom: true,
    fixedZoomPercent: 100,
    fixedZoomPercentMobile: 75,
    BasePath: '/doconut',
    ResPath: '/doconut-res/images',
    onViewerReady: function () {},
    onError: function (message) { console.error('DocViewer:', message); }
});
</script>

Callbacks

CallbackArgumentsPurpose
onPageLoadingpageNum페이지 요청이 시작될 때 호출됩니다.
onPageLoadedpageNum페이지 이미지 로드가 완료될 때 호출됩니다.
onThumbnailClickedpageNum사용자가 썸네일을 클릭했을 때 호출됩니다.
onPageClickedpageNum사용자가 페이지를 클릭했을 때 호출됩니다.
onDoubleClicknone뷰어가 더블 클릭을 받았을 때 호출됩니다.
onViewerBusynone뷰어가 바쁜 상태에 들어갈 때 호출됩니다.
onViewerReadynone초기화가 완료될 때 호출됩니다.
onViewerErrornone뷰어가 오류 상태에 들어갈 때 호출됩니다.
onErrormessage작업이 오류 메시지를 반환할 때 호출됩니다.
onCopydata텍스트 복사 데이터가 제공될 때 호출됩니다.
onAutoLoadStatuspageNum자동 로드가 특정 페이지까지 진행될 때 호출됩니다.
onThumbsShownnone썸네일 패널이 표시될 때 호출됩니다.
onAnnLoadednone주석 데이터가 로드될 때 호출됩니다.
onAnnSavednone주석 데이터가 저장될 때 호출됩니다.
onAnnSaveErrornone주석 저장에 실패했을 때 호출됩니다.
onAnnClosednone주석 UI가 닫힐 때 호출됩니다.

콜백은 빠르게 처리하고, 텔레메트리는 비동기적으로 전송하며 페이지 렌더링을 차단하지 않도록 하십시오.

Public method groups

GroupCommon methods
LifecycleView(token, accessToken?), Close(server?), Token(), Init(), IsLoaded()
NavigationGotoPage(page), ShowPage(page, focus?), Next(next), CurrentPage(), TotalPages()
Zoom and fitZoom(zoomIn), CurrentZoom(), FitType(value), Refit()
OrientationRotate(page, angle), Flip(page, flipType)
ThumbnailsHideThumbs(hide), ThumbSize(size), ReloadThumbs(width), ScrollToThumb(thumb)
SearchCanSearch(), Search(...), SearchMatchCount(), SearchSummary(...), GotoSearchMatch(...)
AnnotationSaveAnnotations(), GetAnnotations(), PushAnnotations(...), CloseAnnotations(...), ShowAnnotations(...)
CopyCopy(...), CopyPage(pageNumber), CopyMode(enabled)

JavaScript 파일에는 내부 헬퍼도 포함되어 있습니다. 여기서 문서화된 메서드와 레퍼런스 UI에서 사용되는 메서드만 안정적인 통합 지점으로 간주하십시오.

Retry after HTTP 409

retryOn409 은 비동기 페이지 생성에 사용됩니다. 활성화되면 위젯은 다음 JavaScript 기본값으로 폴링합니다:

OptionDefault
retryInitialDelayMs250
retryBackoffFactor1.6
retryMaxDelayMs2500
retryMaxAttempts60
retryMaxTotalMs120000

일반 뷰어에서는 비활성화 상태를 유지하십시오. 이를 활성화해도 지원되지 않는 동기 렌더링을 비동기로 바꿀 수 없습니다.

Path checklist

  • DoconutOptions.MiddlewarePath 는 실제 매핑하는 브랜치를 설명해야 합니다.
  • BasePath 는 해당 브랜치를 가리켜야 합니다.
  • DoconutOptions.ResourcesPath 는 임베디드 리소스 경로입니다.
  • ResPath 는 일반적으로 /images 하위 폴더를 가리킵니다.
  • ExtractHyperlinks 가 서버 포맷 설정에서 활성화되어야 showHyperlinks 가 정상적으로 표시됩니다.

이 페이지가 도움이 되었나요?