putting a link to a pdf and using pdf as the image - html

I have a webpage that has a magazine on it. I have an img tag with a link to the pdf on the server. When the magazine changes I have to upload a new magazine and upload a new image as a thumbnail for the magazine. Is there a way to accomplish the same task by just uploading the pdf so that I don't have to create an image of the cover and then upload it also?
thanks,

Some browsers support embedding PDF files natively, but not all do. It is not currently possible to do this unless you have a PDF to jpeg conversion script on your server that will generate the thumbnail.

you can embed a pdf with an object element

Related

Images wont show up in html

Hi im fairly new to html and have run into a problem when adding images from a local folder.
<img src="C:\ComputerBuild Pics\DSC_0037.NEF">
<img src="C:\ComputerBuild%Pics\DSC_0037.NEF">
<img src="ComputerBuild%2520Pics\DSC_0037.NEF">
<img src="ComputerBuild%Pics\DSC_0037.NEF">
NEF image file is raw image, compress this file https://raw.pics.io/convert-nef-to-jpeg
A browser cannot render a NEF image file.
You need to convert it to a file format that a browser can interprete and render.
You need to convert it to supported images for web browsers.
On regards to that, there is this page in Wikipedia. See the chart for different images types and web browsers.
Convert the images in .png format which stands for "Portable Network Graphics"
You can use this site to convert: http://image.online-convert.com/convert-to-png
or you can use any graphics software of your choice

Display pdf image in markdown

Is this possible? Everything I'm google leads me to converting markdown to PDF. But I want to display a PDF image in a markdown file. This is my example:
![hustlin_erd](erd.pdf)
If i use a regular image, it works just fine. Also I'm aware of converting PDF to image.
Markdown itself doesn't have a mechanism for embedding a PDF. However, Markdown accepts raw HTML in its input and passes it through unaltered. So the question you might want to ask is: How would you embed a PDF in HTML? In other words, what HTML would one use to have a browser display a PDF embedded in an HTML page? You would just include that HTML in your Markdown document.
You can find lots of suggestions in answers to the question: Recommended way to embed PDF in HTML?. For example, this answer provides a nice solution with a fallback for older browsers (all credit goes to Suneel Omrey):
<object data="http://yoursite.com/the.pdf" type="application/pdf" width="700px" height="700px">
<embed src="http://yoursite.com/the.pdf">
<p>This browser does not support PDFs. Please download the PDF to view it: Download PDF.</p>
</embed>
</object>
I have found a better way by using xfun R package.
xfun::embed_file("homework.pdf")
This will embed your pdf file in the output of the Rmarkdown. MOre information can be seen via link.
I hope you will enjoy this.

Embed PDF in mobile browsers

I have the code below which is a perfect solution to what I need, which would essentially be embedding any of JPG, GIF, PNG or PDF files in my webpages. It works perfectly in PC browsers, but a critical requirement for the pages is to have them compatible in mobile browsers due to its target users.
<iframe src="uploads/test1.pdf" width="auto" height="auto"> </iframe>
Although image files work fine, PDF files are opened separately in the mobile browser and not embedded inline in the web page. What would be an alternative solution or implementation to this?
You can use PDFJs library. Using just JS you can render pdf files.
Please , check here : https://mozilla.github.io/pdf.js/
One simple option is that the the object element provides a fallback, so you can do:
<object data='some.pdf'>
<p>Oops! Your browser doesn't support PDFs!</p>
<p>Download Instead</p>
</object>
Then, when the mobile browser can't get the item, it'll just show this and you'll be all set, kinda.
Here is my solution to this problem.
<object data="mypdf.pdf" type="application/pdf" frameborder="0" width="100%" height="600px" style="padding: 20px;">
<embed src="https://drive.google.com/file/d/1CRFdbp6uBDE-YKJFaqRm4uy9Z4wgMS7H/preview?usp=sharing" width="100%" height="600px"/>
</object>
Explanation:
<object> tag has a feature that when it is unable to load item, it loads the content inside itself i.e tag.
Since object tag cannot load on mobile view, therefore on mobile devices, embed tag will become active.
Q) Why can't we directly use tag for all cases?
You can actually, but since the embed tag is loading file from
drive, it does not gives any user controls for the pdf that we see
with object tag (zoom, page no., etc.). So our code will give the user pdf view controls atleast in the desktop mode instead of not giving any controls at all.
Q) Direct drive links don't work....so why this solution?
In the above google drive URL, view is changed to preview.
drive.google.com/file/d/1CRFdbp6uBDE-YKJFaqRm4uy9Z4wgMS7H/view?usp=sharing
becomes,
drive.google.com/file/d/1CRFdbp6uBDE-YKJFaqRm4uy9Z4wgMS7H/preview?usp=sharing
So, we can make direct drive links work with this little modification
Google Docs viewer offers a feature, that lets you embed PDF files and PowerPoint presentations on a web page.
<iframe src="https://docs.google.com/viewer?url=http://infolab.stanford.edu/pub/papers/google.pdf&embedded=true" style="width:100%; height:650px;" frameborder="0"></iframe>
replace the URL(http://infolab.stanford.edu/pub/papers/google.pdf) with your own address, It's worked for me but it takes more time to load on
src:http://googlesystem.blogspot.com/2009/09/embeddable-google-document-viewer.html?utm_source=pocket_mylist
The only way I have found, which allows you to embed pdf is using Google drive, then select the menu button once you have opened your file, and select get embed code, you can only use a Google drive or Google docs reference. And you must also turn public sharing on otherwise others won't be able to view it without permission.
Using Adobe PDF Embed API solved my problem.
Adobe PDF Embed API
I ran into the same issue. As a new developer, I wasn't aware that mobile browsers have issues embedding PDF files in iframes. I am now... lol
I racked my resources trying to get this to work when it dawned on me that mobile browsers do not have an issue displaying PNG files in a new window. So, in my infinite wisdom, I opened the PDF files in Gimp 2.0 then exported them as PNG files. And then I created buttons for the user to click and now it opens the graphic instead of trying to embed the PDF.
Looks like this:
<input class="AG" id="UnityBtn" type="button" value="Unity" onclick="location.href='../Meeting_Info/Unity.png'" />
I don't know if this is possible for you, but it worked beautifully for me.
Use an object tag with a iframe tag inside your object tags.
The object data can be a pdf or png file by changing the type and can use any link you want stored wherever, however the I frame is the one which will be loaded for mobiles which has to be a link from Google drive or Google docs you also need to allow the files to be shared public otherwise others won't be able to view them.
I would share the code but this site has some rubbish rules about code and won't let me share them so I'll leave you to Google how object and iframe tags work by viewing better sites that actually wants the help from developers.
Have fun guys!

HTML5 and swiffy files in DFP

I trying to work out what to do after I've converted my SWF to HTML5 via Swiffy. Once converted I get a something.html file, which although great doesn't help with getting into DFP. Any tools that will give me the HTML5 code? Or unpackage the SWF so I can upload the frames?
Many thanks,
I accomplished that by copy and pasting the content of the something.html to a new Third Party creative in DFP.
The HTML content goes inside de "Code Snippet" box
Reply me if you still have problems...

Jpeg, png, gif format images are not displaying in any browser

I am designing a website, I am creating some images for that website by using the illustrator and photoshop software, storing those images in jpeg, png and gif formats. I am writing code for the website in the eclipse software, because I am using jsp and javascript to debug it.
My problem is, the images I have created and linked to the html file are displaying in the Eclipse browser (It is an inbuilt browser to check the code). But, they're not displaying in any other browsers like IE, CROME, FIREFOX.
Can anybody help me?
Thanks in advance.
Off hand, it sounds like you don't have the images linked properly. Aside from checking the code itself, I'd view source in Firefox ( CTRL + U ) and try clicking on the img src urls. If clicking them doesn't load the actual image file, your links are wrong.