Solved

PDF Embed pdfobject.js local path problem regular ASP

Posted on 2016-09-28
2
119 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

863 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

27 Experts available now in Live!

Get 1:1 Help Now