Solved

PDF Embed pdfobject.js local path problem regular ASP

Posted on 2016-09-28
2
84 Views
Last Modified: 2016-09-29
We have this simply html regular asp page:

<script type="text/javascript" src="pdfobject.js"></script>

window.onload = function (){

 
    var pathcomplete = "C:/inetpub/wwwroot/pdf/pdftoview.pdf"

	var success = new PDFObject({ url: pathcomplete}).embed("pdf");
	
};

Open in new window


And the script can´t find the pdftoview.pdf to embed. If we put like this works:

<script type="text/javascript" src="pdfobject.js"></script>

window.onload = function (){

 
    var pathcomplete = "../pdf/pdftoview.pdf"

	var success = new PDFObject({ url: pathcomplete}).embed("pdf");
	
};

Open in new window


Why is not accepting local routes with c:/... or how can be modified the code to accept local routes?

The problem we have is because that kind of code will be a part of a IIs application and if we use the ../ way to call we are limited to the path of the virtual directory of the IIs application and wee need to go to other directories outside the virtual path of the application of IIs. That is the reason. And create a web html to call the files we can´t do for security because the links will be exposed of where are exposed the contents.

Or if there is a technique to embed PDF to call via local directories no matter if it is asp.net c# or regular asp.

Thank you
0
Comment
Question by:Alex E.
2 Comments
 
LVL 26

Accepted Solution

by:
Dan McFadden earned 250 total points
ID: 41821595
I would expect that you need to use a relative path to the pdf file.  What that means is the path after the site's URL.  For example:

http://www.YourSite.com/files/pdfs/myPdfFile.pdf

You would reference this in your code with the relative path of:  /files/pdfs/myPdfFile.pdf

If you look at the source of the examples in the PDFObject documenation, you will see that's how they embed a PDF in a page.  Example Link:  https://pdfobject.com/examples/embed-multiple-PDFs.html

Dan
0
 
LVL 32

Assisted Solution

by:Big Monty
Big Monty earned 250 total points
ID: 41821901
If you need to reference files outside of your website folder structure, you can create  virtual folders within IIS to point to folders outside of your web folder structure and reference them in your code as Dan explained above.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
This article discusses four methods for overlaying images in a container on a web page
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now