Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |
Tags
- web server
- dbms
- db
- FCM
- mysql
- eGov
- 브라우저
- scheduled
- AES
- window10
- WINDOW11
- Oracle
- JEUS
- 암호화
- @Scheduled
- Login
- TailMe
- 접근장치
- Java
- Firebase
- 개발자도구
- Was
- programmers
- 알고리즘
- URLRewirte
- WebtoB
- 물리적주소
- ua-parser
- Tomcat
- User-Agent
Archives
- Today
- Total
HD
PDF Object 본문
반응형
이전 mozilla PDF.js를 사용한 PDF VIEWER를 포스팅 해봤었다.
그런데 mozilla PDF외에 PDF Object를 발견해 한번 적용연습을 해봤다.
※예제 참고
script
pdfobject.min.js 필수
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<style>
/*
PDFObject appends the classname "pdfobject-container" to the target element.
This enables you to style the element differently depending on whether the embed was successful.
In this example, a successful embed will result in a large box.
A failed embed will not have dimensions specified, so you don't see an oddly large empty box.
*/
.pdfobject-container {
width: 100%;
max-width: 100%;
height: 100%;
}
</style>
<script src="/Web-home/pdfobject.min.js"></script>
<script>
$(document).ready(function () {
var options = {
pdfOpenParams: {
navpanes: 0,
toolbar: 0,
statusbar: 0,
view: "FitV",
pagemode: "",
page: 1
}
,forcePDFJS: true
//[PDFJS_URL]mozila PDF viewer.html
//https://mozilla.github.io/pdf.js/getting_started/#download 참고
,PDFJS_URL:"/Web-home/pdfjs/web/viewer.html"
};
var myPDF = PDFObject.embed("해당 pdf 경로", "#pdfContent", options);
console.log("myPDF : "+myPDF);
var el = document.querySelector("#results");
el.setAttribute("class", (myPDF) ? "success" : "fail");
el.innerHTML = (myPDF) ? "PDFObject was successful!" : "Uh-oh, the embed didn't work.";
});
</script>
※참고
HTML
<%@ page language="java" contentType="text/html; charset=UTF-8"pageEncoding="UTF-8"%>
<div class="application" style="height:80%">
<div id="results" class="hidden"></div>
<div id="pdfContent" style="height:100%"></div>
</div>
※코드 생성기도 제공하니 참고
UI
반응형
'javascript > PDF.JS' 카테고리의 다른 글
mozilla PDF.js (1) | 2019.08.08 |
---|
Comments