Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

PDF Embed pdfobject.js local path problem regular ASP

Posted on 2016-09-28
2
Medium Priority
?
420 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 29

Accepted Solution

by:
Dan McFadden earned 1000 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 34

Assisted Solution

by:Big Monty
Big Monty earned 1000 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

A phishing scam that claims a recipient’s credit card details have been “suspended” is the latest trend in spoof emails.
This article discusses how to implement server side field validation and display customized error messages to the client.
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…
Suggested Courses

916 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