/** * @public * @category PDF * @name OpenPDFViewerParams * @description PDF 뷰어를 열 때 필요한 파라미터예요. * @property {string} data - Base64 형식으로 인코딩된 PDF 데이터 문자열이에요. * @property {string} [filename] - PDF 파일 이름이에요. */ export interface OpenPDFViewerParams { data: string; filename?: string; } /** * @public * @category PDF * @name OpenPDFViewerResult * @description PDF 뷰어가 닫혔을 때 반환되는 결과예요. */ export type OpenPDFViewerResult = "CLOSE"; /** * @public * @category PDF * @name openPDFViewer * @description Base64로 인코딩된 PDF 데이터를 네이티브 PDF 뷰어로 열어요. 사용자가 뷰어를 닫으면 `'CLOSE'`를 반환해요. * * @param {OpenPDFViewerParams} params - PDF 데이터와 파일 이름을 담은 객체예요. * @returns {Promise} PDF 뷰어가 닫히면 `'CLOSE'`를 반환해요. * * @throws * - {code: `INVALID_REQUEST`}: 요청 파라미터가 올바르지 않을 때 * - {code: `INVALID_DATA`}: PDF 데이터가 유효하지 않을 때 * - {code: `PDF_VIEWER_ERROR`}: PDF 뷰어를 여는 과정에서 오류가 발생했을 때 * - {code: `UNSUPPORTED_APP_VERSION`}: 토스앱 버전이 5.261.0보다 낮을 때 * * @example * ```tsx * import { openPDFViewer } from '@apps-in-toss/web-framework'; * * async function showPdf() { * try { * const result = await openPDFViewer({ * data: 'JVBERi0xLjQK...', * filename: 'document.pdf', * }); * * if (result === 'CLOSE') { * console.log('PDF 뷰어가 닫혔어요.'); * } * } catch (error) { * console.error('PDF 뷰어 오류:', error); * } * } * ``` */ export declare function openPDFViewer(params: OpenPDFViewerParams): Promise; export {};