이 문서는 dhtmlxScheduler 4.0 및 그 이전 버전에서의 내보내기 방법을 다룹니다. 4.1 이상 버전의 경우 여기에서 자세한 내용을 확인하세요.
4.1 버전부터 dhtmlxScheduler는 PDF로 스케줄러를 내보내는 새로운 방법인 온라인 내보내기 서비스를 도입하였습니다.
다양한 플랫폼용 패키지는 아래에서 확인할 수 있습니다:
Related sample: Export to PDF [Legacy]
스케줄러 페이지에서 PDF 내보내기를 활성화하려면 해당 확장 기능을 활성화해야 합니다:
scheduler.plugins({
pdf: true
});
스케줄러 데이터를 PDF로 내보내려면 toPDF() 메서드를 호출하는 버튼을 추가합니다. 이 메서드는 미리 설치한 스크립트의 URL을 필요로 합니다:
<input type="button" name="save" value="save"
onclick="scheduler.toPDF('path/to/folder/generate.php')"
style="right:300px; width:80px; position:absolute; top:1px;">
내보내기 옵션 설정은 클라이언트와 서버 양쪽에서 조정이 필요합니다.
toPDF() 메서드는 내보내기 프로세스를 시작합니다:
scheduler.toPDF(path, color, header, footer);
파라미터:
예를 들어, HTML 페이지에 아래와 같이 추가하면 그레이스케일 색상 테마로 toPDF()를 호출할 수 있습니다:
scheduler.toPDF('path/to/folder/generate.php','gray');
위에서 참조한 generate.php 파일이 내보내기 옵션을 처리합니다.
최소한의 예시는 다음과 같습니다:
$scPDF = new schedulerPDF();
$scPDF->printScheduler($xml);
printScheduler()를 호출하기 전에 다양한 사용자 설정을 적용할 수 있습니다:
요소 크기:
// 월간 보기에서 하루 컨테이너 헤더 높이
$scPDF->monthDayHeaderHeight = 6;
// 월간 헤더 높이
$scPDF->monthHeaderHeight = 8;
// 연간 보기에서 월 이름 컨테이너 높이
$scPDF->yearMonthHeaderHeight = 8;
// 아젠다 보기에서 행 높이
$scPDF->agendaRowHeight = 6;
// 일간 및 주간 보기에서 헤더 높이
$scPDF->dayTopHeight = 6;
// 일간 및 주간 보기에서 왼쪽 스케일 너비
$scPDF->dayLeftWidth = 16;
글꼴 크기:
// 글꼴 크기 설정
$scPDF->monthHeaderFontSize = 9;
$scPDF->monthDayHeaderFontSize = 8;
$scPDF->monthEventFontSize = 7;
$scPDF->yearHeaderFontSize = 8;
$scPDF->yearFontSize = 8;
$scPDF->agendaFontSize = 8;
$scPDF->dayHeaderFontSize = 7;
$scPDF->dayScaleFontSize = 8;
$scPDF->dayEventHeaderFontSize = 7;
$scPDF->dayEventBodyFontSize = 7;
$scPDF->todayFontSize = 11;
사용자 지정 색상 (클라이언트 측에서 컬러맵 이름으로 'custom'을 사용):
$scPDF->lineColor = '586A7E';
$scPDF->bgColor = 'C2D5FC';
$scPDF->dayHeaderColor = 'EBEFF4';
$scPDF->dayBodyColor = 'FFFFFF';
$scPDF->dayHeaderColorInactive = 'E2E3E6';
$scPDF->dayBodyColorInactive = 'ECECEC';
$scPDF->headerTextColor = '2F3A48';
$scPDF->textColor = '2F3A48';
$scPDF->eventTextColor = '887A2E';
$scPDF->eventBorderColor = 'B7A543';
$scPDF->eventColor = 'FFE763';
$scPDF->todayTextColor = '000000';
$scPDF->scaleColorOne = 'FCFEFC';
$scPDF->scaleColorTwo = 'DCE6F4';
$scPDF->yearDayColor = 'EBEFF4';
$scPDF->yearDayColorInactive = 'd6d6d6';
헤더 및 푸터:
// 헤더 높이
$scPDF->headerImgHeight = 40;
// 푸터 높이
$scPDF->footerImgHeight = 40;
// 헤더 이미지 경로
$scPDF->headerImg = './header.png';
// 푸터 이미지 경로
$scPDF->footerImg = './footer.png';
각 페이지에 맞춤 헤더와 푸터를 추가하려면 다음 단계를 따르세요:
scheduler.toPDF(url, "color", true, true);
이렇게 하면 생성된 PDF의 모든 페이지에 "header.png"와 "footer.png"가 각각 헤더와 푸터로 삽입됩니다.
PDF 생성이 실패하면 "error_report_xxxx.xml" 파일이 생성됩니다. 버그를 보고할 때 이 파일을 첨부해 주세요.
출력에 실패하지는 않지만 문제가 발생하는 경우, generate.php에서 아래와 같이 디버깅을 활성화할 수 있습니다:
$debug = false;
를
$debug = true;
로 변경하면 "debug_xxxxx.xml" 파일이 생성되며, 관련 오류 보고 시 함께 첨부해 주시기 바랍니다.
맨 위로