import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-documents',
templateUrl: './documents.component.html',
styleUrls: ['./documents.component.less']
})
export class DocumentsComponent implements OnInit {
pdfSrc: string = '';
pdfZoom:number = 1;
constructor() { }
ngOnInit() {
this.pdfSrc = '/assets/demo.pdf';
}
public zoomIn()
{
this.pdfZoom += 0.25;
}
public zoomOut()
{
if (this.pdfZoom > 1) {
this.pdfZoom -= 0.25;
}
}
}
<div class="m-portlet m-portlet--mobile">
<div class=modal-body align="center">
<span class="input-group-btn">
<button class="btn" name="zoomout" (click)="zoomOut()"><i class="fa fa-search-minus"> </i></button>
<button class="btn" name="zoomin" (click)="zoomIn()"><i class="fa fa-search-plus"> </i></button>
</span>
</div><br>
<div class="m-portlet__body" style="overflow-x:scroll; overflow-y: scroll;max-height:75vh;">
<pdf-viewer [src]="pdfSrc" [render-text]="true" [original-size]="false" [zoom]="pdfZoom" [page]="page"
[show-all]="true" [autoresize]="true" style="display: block;">
</pdf-viewer>
</div>
</div>
<!--<img src="assets/common/images/sampleProfilePics/a.jpg" height="432" width="405" />-->
我创建了一个布局。在此之上,我正在使用ng2-pdfviewer软件包在布局页面上添加pdf文档,并使用创建的zoomin和zoomout按钮以及溢出-x和溢出-y滚动条。不起作用的原因,因为pdf本身附带了水平滚动条。 因此,我想删除该预定义的水平滚动条。