Sign up for Office 365
Learn more about Office 365
I implemented this solution as directed in your link but it does not work for me. I still get the "Save ro Cancel" dialog box.
Furthermore, the getDoc() procedure does not contain a parameter to indicate which document it's supposed to get.
Can you provide further clarification?
OK, I figured it out. I have to use YOUR website, joshuabooker.com/.../pdf.aspx, to get this to work instead of MY website, http://<mywebsite>/Documents/pdf.aspx?file=http://<mywebsite>/Documents/<myfile>.pdf.
I was hoping to be able to implement this on my site because, no offense, I'd rather have the address bar of the browser window in which the PDF opens to reflect MY website, rather than yours. It may tend to confuse my viewers.
And again, I believe it's because I do not have access to your sp.js script. I guess I could reverse engineer it since I now believe I know how it works.
Not sure I get what you mean. I tested this with Josh a while back and it installs on your account and opens a document stored in your account with your address in the address window.
Click "pdf test" on this page:http://webbrewers2-web.sharepoint.com/Pages/test_pub2.aspx
Josh outlines the different approaches to public/private sites in his article.
Can you post an example?
http://webbrewers.com/ | | Get more out of Office 365
You should be able to open files on your own site. The Site template includes the utilities document library which contains pdf.aspx and sp.js. Everything is on your site.
Do you see the utilities library when under 'all site content'?
Did you upload a PDF file to the Documents Library of the new site? What happens when you click on PDFLink?
pdf.aspx is in the utilities doc lib.
If you please share your js code then it will be very helpful .
I am using gdoc as below but looks like your code is something different .
<iframe src="http://docs.google.com/gview?url=http://infolab.stanford.edu/pub/papers/google.pdf&embedded=true" style="width:600px; height:500px;" frameborder="0"></iframe>
Thanks for this nice post .
The code simply writes in an embed element, but has the option of using gview also.
I updated this post with more code and details:
I do not have a "Utilities Library" under the "All Site Content". Under "Document Libraries" I have "Documents", "Style Library", Templates" and "Web Pages". Under "Picture Libraries" I have "Images".
I may be able to "Create" a library, but I'm not sure which one I should create. "Web Page Library"? And even if I did create a new library and call it "Utilities", where do I get the sp.js file from to place in there?
And yes, I did upload a PDF file to the Document library.
Is this a limitation of the P1 Plan?
I tried as you suggested and got "The webpage can not be found". That is because I do not believe I have a "utilities" directory. And without a "utilities" directory I can't place the pdf.aspx file into it. Nor do I have a copy of the sp.js file to put there either.
If there was a problem with P1 plan I would think the solution would have failed to activate or the new site would have failed to create.
Did you create a new site using the PDF Site Template?
The site template includes a Doc Library called utilities which gets created at the subsite root.
If you create a sub site using the template called 'Docs' then the utilties lib will be here:
The site template also includes a library template called 'PDF Documents' that you can use the create new PDF enabled Doc Libraries.
The solution can't be activated in a P1 account. At least not in mine (but then mine is messed up and doc libraries won't even load anymore............)
I tried the utilities template too and that throws an error.
I am new to Sharepoint so I have no idea what your talking about. I did not create a new site using the PDF Template. I guess they must have been in your "Solution" - I haven't used "Solutions' so I didn't even try to use it.
document.write("<embed type='application/pdf' width='100%' height='100%' src='/Documents/"+pdf+"'/>");
Two lines of code. If you ask me, it's a lot easier to understand.
Placed the pdf.aspx file in the Documents Library of my website and it works just fine.
I'm sure you had your reasons fo doing it the way you did. If you would care to enlighten us or point out any deficiencies in my solution I would be more than happy to learn someting new.
Sorry....Please use these lines of code instead:
document.write("<embed type='application/pdf' width='100%' height='100%' src='"+pdf+"'/>");
This will allow you to use the absolute or relative address to the PDF document:
http://<yoursite>.sharepoint.com/Documents/<pdf file> or just /Documents/<pdf file>
Glad you found a solution that works for you. I just always use the getQueryString code because it allows more than one query string. In this case, presently there is only one query string so fewer lines is fine too.
Yes, the file query string is relative so in your case you could supply only the 'PDFFileName.pdf' if you want because you put the pdf.aspx in the same document library. However, if you want to use the same pdf.aspx to view PDF files from another library, then you'll have to provide the whole url to the other file in your query string.
That's why I put it in a separate utilities library so the file variable is alway relative to the site and there will only be one copy of PDF.aspx in case I want to make changes.
In sharepopint a 'solution' is a set of functionality saved in a single file that can be uploaded and activated for later use on a site. The PDF Site Template is a solution that adds a new site template to your templates gallery making it available to use when creating new sites. When you do so, many artifacts are created in that site including the following:
Utilities Library containing pdf.aspx and scripts
Customized Documents Library 'PDF Enabled'
PDF Document Library Template (for creating new doc libs 'PDF enabled')
New Item Workflow which sets a PDFLink column to the PDF.aspx having the correct relative file querystring
In a nut shell this makes the PDF file display in browser by clicking on the list item nearly the same as it does when Browser File Handling is set to Permissive.
Please let me know if you have any questions.