Home > Work > Embedding PDF files with the Content Editor Web Part #SP2010 #SP2013 #MSProject

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:

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.
Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: