Solved

PDF Embed pdfobject.js local path problem regular ASP

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

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 33

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

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
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 the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

821 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