일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- AES
- scheduled
- mysql
- TailMe
- web server
- 접근장치
- FCM
- 암호화
- programmers
- 개발자도구
- window10
- dbms
- Was
- WebtoB
- @Scheduled
- 브라우저
- JEUS
- 물리적주소
- Firebase
- Login
- Oracle
- db
- 알고리즘
- User-Agent
- Java
- eGov
- Tomcat
- WINDOW11
- URLRewirte
- ua-parser
- Today
- Total
HD
PDF Object 본문
이전 mozilla PDF.js를 사용한 PDF VIEWER를 포스팅 해봤었다.
그런데 mozilla PDF외에 PDF Object를 발견해 한번 적용연습을 해봤다.
※예제 참고
PDFObject: A JavaScript utility for embedding PDFs
width [string]. Default: "100%" Will insert the width as an inline style via the style attribute on the element. If left unspecified, PDFObject will default to 100%. Is standard CSS, supports all units, including px, %, em, and rem. Tip: It's safer to spec
pdfobject.com
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>
※참고
Getting Started
Getting Started An introduction to PDF.js with examples. Introduction Before downloading PDF.js please take a moment to understand the different layers of the PDF.js project. Layer About Core The core layer is where a binary PDF is parsed and interpreted.
mozilla.github.io
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>
※코드 생성기도 제공하니 참고
PDFObject: Code Generator
Optional PDF Open Parameters PDF Open parameters allow you to customize the way a PDF file opens in Adobe Reader. You can show/hide toolbars, specify a page number, change the display size, and more. Read Adobe's specifications to learn more. These paramet
pdfobject.com
UI
'javascript > PDF.JS' 카테고리의 다른 글
mozilla PDF.js (1) | 2019.08.08 |
---|