given a PDF that is rendered in the browser using pdfjs, are there functions to do the following basic view operations:
If not, what are the best strategies I can use to do the operations above?
PDF. js leverages Asynchronous JavaScript and XML (AJAX) to download the PDF file from a web server and parse its contents. Once prepared, content is then rendered onto an HTML5 <canvas> element using canvas drawing commands.
A PDF library first needs to decompress the binary PDF file and parse its contents. Next, the PDF rendering engine converts parsed PDF file contents into drawing operations. Most often, the graphics in a PDF document will be encoded as one of two types of data: raster or vector.
PDF. js is part of Firefox since version 19. The extension is mostly used by developers and for bringing a newer version of the PDF. js library to an older Firefox version.
You can set rotation when you getting viewport form PdfPage object:
var viewport = pdfPage.getViewport(scale, rotation);
If you want to immediately set all the parameters, you can clone viewport, created with scale = 1:
var defaultViewport = pdfPage.getViewport(1);
var neededViewport = defaultViewport.clone({scale: needScale, rotation: needRotation, dontFlip: true});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With