So, let's say the Supreme Court handed down a big ruling, or the Senate published a groundbreaking report of some sort, and you want other Kossacks to be able to read the PDF file. You could put a link to a PDF in a diary, but sometimes, the PDF file is restricted, or is available only to people who subscribe to a particular website, journal, or service.
Well, there's a way that you can embed the PDF directly into a Daily Kos diary or comment. In fact, you can also embed Powerpoint presentations, Microsoft Word documents, and even Excel spreadsheets into Daily Kos! The following is a how-to guide for doing just that, using the website Scribd. It's a pretty easy method that anyone can use.
Please consult the summary at the end of this diary for the quick recap.
Let's take the recent Supreme Court decision, Citizens United vs. Federal Election Commission. I found the following PDF on Scribd:
So, how do we embed this document into Daily Kos?
STEP #1: Getting the HTML code
First, find the document you're looking for in Scribd (in this case, simply by clicking on the link to the PDF above). If you click on the "Share" button, you'll open a small console that provides its own HTML code. Try copying and pasting the HTML code into your diary:
<a title="View Supreme Court ruling on campaign finance on Scribd" href="http://www.scribd.com/doc/25538673/Supreme-Court-ruling-on-campaign-finance" style="margin: 12px auto 6px auto; font-family: Helvetica,Arial,Sans-serif; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: normal; font-size-adjust: none; font-stretch: normal; xsystem-font: none; display: block; text-decoration: underline;">Supreme Court ruling on campaign finance</a> <object id="doc_354795149087756" name="doc_354795149087756" height="600" width="100%" type="application/x-shockwave-flash" data="http://d1.scribdassets.com/ScribdViewer.swf" style="outline:none;" > <param name="movie" value="http://d1.scribdassets.com/ScribdViewer.swf"> <param name="wmode" value="opaque"> <param name="bgcolor" value="#ffffff"> <param name="allowFullScreen" value="true"> <param name="allowScriptAccess" value="always"> <param name="FlashVars" value="document_id=25538673&access_key=key-6vs9o9qzgbzk69qqqqp&page=1&viewMode=list"> </object>
Nasty stuff. If you try to embed the code as is into Daily Kos, it won't work. What to do?
Well, all we're really interested in is the second half of the HTML code from Scribd. Those things specify the elements we'll need, like the fullscreen option and the document code. Only problem is, some of those tags are not allowed in Daily Kos diaries. It's also missing a "src" specification, which describes the web page where you got the document.
You'll notice there are a lot of "param" tags in the code which are not closed (meaning, that they don't have a </param> at the end). Rather than have you spend all that time adding </param> after each of the tags, I'll just give you the code for the following document, having removed all of the "param" tags. Here it is:
<embed src="http://d1.scribdassets.com/ScribdViewer.swf?document_id=25538673&access_key=key-6vs9o9qzgbzk69qqqqp&page=1&viewMode=list" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" play="true" loop="true" scale="showall" wmode="opaque" devicefont="false" name="354795149087756" menu="true" allowfullscreen="true" allowscriptaccess="always" type="application/x-shockwave-flash" align="middle" height="500" width="600"></embed>
This is the complete code for the PDF file above. This type of code works not only for PDFs, but also Powerpoint slides and Excel spreadsheets. I'll provide a template for embedding any Scribd document in the summary at the end, but let's first go through the major element that you'll need for future Scribd files.
STEP #2: Getting the Object and FlashVars Numbers
Now, if you go back to the original HTML code from Scribd, you'll see that I've bolded a couple of code numbers. One is the Object number, which is labeled "doc_" followed by a very long string of numbers -- in this case, 15 digits. The other is the FlashVars number, which is labeled "document_id." These are two distinct numbers and it's important to put them in their proper place.
For the Supreme Court document above, the Object number is 354795149087756. You will find this number right next to the "object" tag in the original HTML code. The Object number is not necessary for the final embed, but it IS necessary if you want to be able to view the document in full-screen mode.
The FlashVars number, however, is necessary for the embed. For the above document, the FlashVars number is:
25538673&access_key=key-6vs9o9qzgbzk69qqqqp&page=1&viewMode=list
You will find this particular number at the bottom of the original HTML code, next to the FlashVars variable and the "document_id" label. You will need the bit with "access_key" and everything that follows it, so be sure not to forget it when you're copying the FlashVars code. You can also use this part of the code to specify which page you'd like the document to start on when readers open the diary -- in case there were a reason to start it from anywhere beyond the beginning.
________________________________________________________________________
Summary for embedding PDFs/Powerpoint/Excel/Microsoft Word documents:
- Find the document you are looking for on Scribd. Click on the Share button when you've found it. Then, copy and paste the following code into your diary or comment:
<embed src="http://d1.scribdassets.com/ScribdViewer.swf?document_id=INSERT FLASHVARS NUMBER WITH ACCESS KEY HERE" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" play="true" loop="true" scale="showall" wmode="opaque" devicefont="false" name="INSERT OBJECT NUMBER HERE" menu="true" allowfullscreen="true" allowscriptaccess="always" type="application/x-shockwave-flash" align="middle" height="500" width="600"></embed>
- In the original HTML code from Scribd, find the FlashVars number and its access key (which is the string of numbers and letters after "document_id", at the bottom of the HTML); and the Object number (usually a 15-digit number found in the middle of the HTML after "doc_"). Copy and paste these strings into their appropriate places in the HTML code above.
With that, you should be good to go!
Important Note #1: Embedding files from Scribd will not work if the file has been made "private" by the Scribd user. Only public files will work.
Important Note #2: You can embed any public file from Scribd without having to log on to their website. But, if you want to upload your own documents to Scribd and embed them here, you need to register for Scribd, just like you would with Photobucket if you wanted to upload photos. It's free, so don't worry too much.