PDF调整大小(div pdf图像)

时间:2020-06-17 15:58:36

标签: javascript html css pdf resize

无法调整pdf大小。当我打开网页时,会显示pdf,但是我无法通过用鼠标拉右下角来调整其大小。怎么了?我用img-wrapper类比地制作了CSS。 我的代码是:

html:

<head>
<link rel="stylesheet" type="text/css" href="view_topic.css">
<link rel="stylesheet" type="text/css" href="view_pdf.css">
</head>

<div id="myPdfDiv" class="pdf-image">
</div>


<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>

<script src="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.2.228/pdf.min.js"></script>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="view_pdf.js" id="view_pdf" data-url="<?php echo $rows['img']; ?>"></script>

view_pdf.css:

.pdf-image {
overflow: auto;
height: 200px;
resize: both;
background-color: blue;
position: relative;
overflow-x:auto;
overflow-y:auto;
}

.pdf-image > img {
    display: block;
    height: auto;
    width: 100%;
    position: absolute;
    /*top: -50%;*/
vertical-align: top;
}

js:

imgUrl= document.getElementById("view_pdf").getAttribute( "data-url" );

$("body").append(`<p><embed src='${imgUrl}' + type='application/pdf', width='40%', height='40%', class='pdf_image'></p>`);                           

0 个答案:

没有答案