Embedding PDF files with the Content Editor Web Part #SP2010 #SP2013 #MSProject
Whilst working on a proof of concept for a knowledge portal. We had the need to embed PDF documents into a web page and do some fancy jiggery pokery ™ around expanding the PDF view to full screen dynamically etc..
Anyway, along my travels I came across the query string API when referencing PDF documents for embedding purposes and figured it might useful for others as well. So without further ado…
Blog post on the Adobe site:
File Download: PDF Open Parameters
Just for my own reference:
After the file name start with a #, then each parameter uses an &.
My Personal Example:
Code Example:
To demonstrate this, I added a Content Editor Web Part with some code to show the PDF file inside an iFrame.
For the purposes of my client who wanted to see if the PDF would scale if we resized the screen, I then wrapped some jQuery around it to resize the div and iFrame.
Code Download
Options:
- http://example.org/doc.pdf#Chapter6
- http://example.org/doc.pdf#page=3
- http://example.org/doc.pdf#page=3&zoom=200,250,100
- http://example.org/doc.pdf#zoom=50
- http://example.org/doc.pdf#page=72&view=fitH,100
- http://example.org/doc.pdf#pagemode=none
- http://example.org/doc.pdf#pagemode=bookmarks&page=2
- http://example.org/doc.pdf#page=3&pagemode=thumbs
- http://example.org/doc.pdf#collab=DAVFDF@http://review_server/Collab/user1
- http://example.org/doc.pdf#page=1&comment=452fde0e-fd22-457c-84aa-2cf5bed5a349
- http://example.org/doc.pdf#fdf=http://example.org/doc.fdf
- Further examples from the documentation:
Syntax | Description |
nameddest=destination | Specifies a named destination in the PDF document. |
page=pagenum | Specifies a numbered page in the document, using an integer value. The document’s first page has a pagenum value of 1. |
comment=commentID | Specifies a comment on a given page in the PDF document. Use the page command before this command. For example:#page=1&comment=452fde0e-fd22-457c-84aa-2cf5bed5a349 |
collab=setting | Sets the comment repository to be used to supply and store comments for the document. This overrides the default comment server for the review or the default preference. The setting is of the form store_type@location, where valid values for store_type are:lDAVFDF (WebDAV)lFSFDF (Network folder)lDB (ADBC)
For example: #collab=DAVFDF@http://review_server/Collab/user1 For more information on comment repositories, see Acrobat Online Collaboration: Setup and Administration. |
zoom=scalezoom=scale,left,top | Sets the zoom and scroll factors, using float or integer values. For example, a scale value of 100 indicates a zoom value of 100%.Scroll values left and top are in a coordinate system where 0,0 represents the top left corner of the visible page, regardless of document rotation. |
view=Fitview=FitHview=FitH,topview
=FitVview =FitV,leftview =FitBview =FitBHview =FitBH,topview =FitBVview=FitBV,left |
Set the view of the displayed page, using the keyword values defined in the PDF language specification. For more information, see the PDF Reference.Scroll values left and top are floats or integers in a coordinate system where 0,0 represents the top left corner of the visible page, regardless of document rotation.Use the page command before this command.Note:This parameter is not supported on the command line. |
viewrect=left,top,wd,ht | Sets the view rectangle using float or integer values in a coordinate system where 0,0 represents the top left corner of the visible page, regardless of document rotation.Use the page command before this command.Note:This parameter is not supported on the command line. |
pagemode
=bookmarkspagemode =thumbspagemode =none (default) |
Displays bookmarks or thumbnails. |
scrollbar=1|0 | Turns scrollbars on or off. |
search=wordList | Opens the Search panel and performs a search for any of the words in the specified word list. The first matching word is highlighted in the document.The words must be enclosed in quotation marks and separated by spaces. For example:#search=”word1 word2″You can search only for single words. You cannot search for a string of words. |
toolbar=1|0 | Turns the toolbar on or off. |
statusbar=1|0 | Turns the status bar on or off. |
messages=1|0 | Turns the document message bar on or off. |
navpanes=1|0 | Turns the navigation panes and tabs on or off. |
highlight=lt,rt,top,btm | Highlights a specified rectangle on the displayed page. Use the page command before this command.The rectangle values are integers in a coordinate system where 0,0 represents the top left corner of the visible page, regardless of document rotation. |
fdf=URL | Specifies an FDF file to populate form fields in the PDF file being opened. For example:#fdf=http://example.org/doc.fdfNote:The fdf parameter should be specified last in a URL. |
-
August 16, 2012 at 10:37Embedding PDF files in a SharePoint Content Editor Web Part - The Microsoft SharePoint Blog