i'm trying to rotate an object tag that contains a PDF viewed by Acrobat Plugin via AcroPdf.dll.
I already saw this solution but don't rotate the PDF itself on >=IE9 (works on chrome)
I'm using jQuery 1.11.3 and PDFObject 1.2 and i can't change the version of jQuery.
Any help will be appreciated. Regards
My simple code is this:
<!DOCTYPE html>
<html>
<head>
<style>
.rotate-90 {
-ms-filter: "progid:DXImageTransform.Microsoft.Matrix(M11=0.00000000, M12=-1.00000000, M21=1.00000000, M22=0.00000000,sizingMethod='auto expand')";
filter: progid:DXImageTransform.Microsoft.Matrix(M11=0.00000000, M12=-1.00000000, M21=1.00000000, M22=0.00000000,sizingMethod='auto expand');
transform: rotate(90deg);
-o-transform: rotate(90deg);
-ms-transform: rotate(90deg);
-webkit-transform: rotate(90deg);
-moz-transform: rotate(90deg);
}
</style>
<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
<script type="text/javascript" src="http://miorepository.altervista.org/pdfobject.js"></script>
</head>
<body>
<button onclick="rotatePdf();">Rotate 90 degree</button>
<div id="boxPdf"></div>
<script type='text/javascript'>
$(function(){
var pdfPath = './doc1.pdf';
var customParameter = {
page : '1',
view : 'FitH,0',
pagemode : 'none',
scrollbars : '0',
toolbar : '0',
statusbar : '0',
messages : '0',
navpanes : '0'
};
var myPDF = new PDFObject({
url : pdfPath,
pdfOpenParams : customParameter,
cid : 'objectBoxPdf'
}).embed('boxPdf');
});
function rotatePdf(){
$('#objectBoxPdf').toggleClass('rotate-90');
}
</script>
</body>
</html>
Try this code:
Note: replace "pdf.pdf" with the name of your pdf.
Basically what this code is doing is telling the page that when you click the button, it should append the class "rotate-90" to the element. The CSS tells the page that any element with the class "rotate-90" should be rotated by 90 degrees. When the class is appended, the element is rotated 90 degrees.
Hope this helps!