Solved

PDF Embed pdfobject.js local path problem regular ASP

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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
HTML5 storage and web apps 11 43
Jquery 7 28
What is the correct way to check for empty value in input field 2 15
ASP Error Handler 5 14
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

679 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