How to center PDF content in embed? [duplicate] - pdf

This question already has an answer here:
Centering embed PDF content
(1 answer)
Closed 8 years ago.
I have a PDF file embed inside my web page. My HTML is:
<embed src="http://znaci.net/zb/4_1_19.pdf">
My CSS is:
embed {
width:500px;
height:600px;
}
Now I have a situation like this:
But I need this:
Is there a way to center a PDF content in embed?

You cannot control the embedded object in the embed tag. However, with PDF Open Parameters, you can exercise some control over the displayed PDF.
Here I have scaled the PDF to fit an iframe, with view=FitH.
<iframe
src="http://partners.adobe.com/public/developer/en/acrobat/PDFOpenParameters.pdf#page=1&view=FitH"
width="500" height="600">
</iframe>
There are other ways you can control zoom and scroll position. Please refer to linked document for more info.

Related

SVG with images with dataURL href not rendered correctly in some engine

This SVG originated from HTML5 canvas. Which looks fine and I added images that are represented in dataurl form to avoid CORS issues.
However, when opened in chrome the image showed up fine
When opened in Adobe Illustrator, the image did not show up.
When opened with macOS preview app, the image did not show up.
I looked up SVG2 specifications for using dataURL in svg's <image> tag href attribute and they said its okay to use. So I don't understand what is causing this rendering discrepancy between different viewers.
File for reference
In short, what is the standard way to embed images into SVG.
Okay I found out it is because only Chrome supports the newer SVG2 standard href attribute on <image> element of SVG. So I just needed to replace the href with xlink:href
Even though xlink:href attribute is deprecated in SVG2. It seems the other softwares aforementioned in the question are not SVG2-compliant.

ionic pdf thumbnail viewer

I want to add a pdf thumbnail to my ion-scroll view, basically I want to add something like this :
I have tried this code :
<iframe src="img/pdf1.pdf#view=fit,10&toolbar=0" style="width:220px;height:100%"></iframe>
<a href="img/pdf1.pdf" class="loupe">
<img src="img/loupe.png">
</a>
This works only on web browsers not on mobiles.
Any suggestions please?
If you want to open pdf in your app with scroll option, its better way to open pdf in in-app browser

show PDF in an Ext.Container SENCHA TOUCH 2

I am trying to show a pdf content in a Ext.Container of Sencha Touch 2. Tried several ways answered on SO but they all didn't work.
Few things tried, include:
Tried converting file content into html and extract the HTML inside the BODY tag and put it into Ext.XTemplate of the Container. This way I can only play cool with it, if HTML is being converted from a .doc file but if it was a .pdf file it messes up design because when I convert a pdf file into HTML then it adds position: absolute inside every DIV and with absolute position the parent element will not have any height and I am stuck with the scrolling issues.
for example:
<div style="position:relative;display:inline-block;;top:994px;left:712px;font-family:'Times New Roman';font-size:10pt;white-space:nowrap;">description</div>
Second try,
2. Tried putting PDF into IFRAME and EMBED tags as a link and put them into the Ext.XTemplate but these tags are also not working in mobile.
for example:
<embed type="application/pdf" width="800px" height="800px" src="example.pdf" />
<iframe style="position:absolute; z-index: 1; left: 0; top: 0;" width="100%" height="2000" src="example.pdf"></iframe>
Please give some idea how to display/open PDF(or its content, with atleast few formatting). Or do we have any plugin to display it. One final solution is showing using google docs but my initial requirement is showing PDF content in sencha touch 2 app not using any third party service(like google docs).
you can use inapp browser plugin for opening file in the iOS:
install inappbrowser cordoav plugin and open file like this:
function openPDF(){
ref = window.open('http://static.googleusercontent.com/media/www.google.com/en/us/webmasters/docs/search-engine-optimization-starter-guide.pdf', '_blank', 'location=no');
ref.addEventListener('exit', function() {
ref.removeEventListener('exit', function(){});
ref.close();
} );
}
It is very useful the PDFObject library, I have added this third-parties library to my project based on Sencha Touch 2 and its working in the browser, my current issue is show the pdf in Ipad.. :-(

Dijit ContentPane does not render a frame or frameset

I came across a problem today when I trying to render content from an external source into a
dijit.layout.ContentPane.
HTML
<div id="someId"></div>
JS
var cp = new dijit.layout.ContentPane({}, "someId");
htmlFromExtSrc = "<frameset> <frame src="http://www.google.com"></frameset>
Other Data ";
cp.set("content", htmlFromExtSrc);
What gets set in the html is only OtherData. Frameset and frame do not showup in the html.
I aim need to show the content from an external site rendered into the Pane correctly. Using Iframe solves the problem but I am looking for a better solution.
Is there a way to work around this problem?

Can I show a PDF inside a DIV with a zoom function?

I have a large PDF and I need to show it 50% reduced in size inside a div tag that is 600px 600px in size. I also need to offer the client a zoom function.
Should I use the "object" tag? But can I reduce the pdf size inside an "object"?
Is there a jquery example or anything out there?
Need help.
<div>
<object data="febrero2012.pdf" type="application/pdf" width="600px" height="600px">
alt : febrero2012.pdf
</object>
</div >
I coudn't find the way to set a default zoom level yet. If you find a way, please let me know.
No. PDFs cannot be displayed in a DIV, as they're not html or an image. You can convert the PDF to html/images on the server and display that, just like google's "quick view" function does. But in general, PDF rendering in-browser is dependent on the presence of a plugin (e.g. Adobe Reader, Chrome's built-in rendering engine notwithstanding). Plugins can't be displayed in divs, just embed/object/iframe sections.