简体   繁体   English

链接以打开保存在文件夹中的PDF文件?

[英]Link to open a PDF file that's saved in a folder?

Hi there. 嗨,您好。 I think this one is a tough one, but I hope someone can help. 我认为这是一项艰巨的任务,但希望有人能提供帮助。

I have a folder which is downloaded from my website. 我有一个从我的网站下载的文件夹。 The folder contains a Main PDF report on a housing property, and another folder containing pictures and more PDF reports on similar houses in the area. 该文件夹包含有关房屋属性的主PDF报告,以及包含有关该地区类似房屋的图片和更多PDF报告的另一个文件夹。

On my main PDF report I would like to have a link to open the other PDF folders. 在我的主要PDF报告中,我想要一个链接来打开其他PDF文件夹。

How would I go about creating a link to open a PDF report saved in a file? 如何创建一个链接来打开保存在文件中的PDF报告?

Looking at the picture below, where it says CS1.pdf, that is the name of the PDF and where the link will be. 看下面的图片,上面写着CS1.pdf,这是PDF的名称以及链接的位置。 This is a screen shot of a portion of my main PDF. 这是我的主要PDF的一部分的屏幕截图。

I don't mind if the PDF reports are opened in a webpage, in fact I would prefer it. 我不介意是否在网页中打开PDF报告,实际上我更喜欢它。 But, at the moment, I just need a simple link created that will open a PDF located in a folder. 但是,此刻,我只需要创建一个简单的链接即可打开文件夹中的PDF。

PDF的详细信息的屏幕截图


An explanation of the app flow: 应用流程的说明:

Here below I save the PDF that I want to link to later. 在下面,我保存了以后要链接的PDF。 It's saved to a temp location; 它已保存到临时位置。 the exact location is not important as it will be deleted after the file uploads. 确切位置并不重要,因为文件上传后将被删除。

The file I upload contains a few pictures, some PDFs and a data.XML file. 我上传的文件包含一些图片,一些PDF和一个data.XML文件。 When a person downloads the file, the data.XML file is used to create my main PDF, or report, in any format. 当人们下载文件时,data.XML文件将用于创建任何格式的主PDF或报告。 I need to send a link through the XML file that will appear on the report making it able to link to the other PDF files that were uploaded with the data.xml file. 我需要通过XML文件发送一个链接,该链接将出现在报告中,从而使其能够链接到与data.xml文件一起上传的其他PDF文件。

CS1[12].TagValue = ReportDS.Tables[9].Rows[0].ItemArray[0].ToString();

//Save PDF
//PDFName = System.Guid.NewGuid().ToString() + ".pdf";
string PDFName = "CS1" + ".pdf";
WebClient webClient = new WebClient();
webClient.DownloadFile(CS1[12].TagValue, "C://Users//Shaun//Documents//FormValue//" + PDFName);
CS1[12].TagValue = PDFName; //This is the value passed to the main PDF so this is where i should pass the link through.

The line CS1[12].TagValue = PDFName; CS1[12].TagValue = PDFName; is where I set the value to send though to the main PDF, and this is where my link should be sent through. 是我设置要发送到主PDF的值的地方,这是我的链接应该通过的地方。

I need something like CS1[12].TagValue = "http://C://Users//Shaun//Downloads//CS1.pdf"; 我需要类似CS1[12].TagValue = "http://C://Users//Shaun//Downloads//CS1.pdf"; but with the file path of the downloaded location. 但是带有下载位置的文件路径。

you are on a right way but you have some mistake like, when you giving location of pdf file from downloaded location, that must be a file type, its not from a server... 您使用的是正确的方法,但是却遇到一些错误,例如,当您从下载的位置提供pdf文件的位置时,该位置必须是文件类型,而不是来自服务器...

CS1[12].TagValue = "http://C://Users//Shaun//Downloads//CS1.pdf";

but it must like this 但它必须像这样

CS1[12].TagValue = "file://C://Users//Shaun//Downloads//CS1.pdf";

so that you have change one line in your code... 这样您就可以在代码中更改一行...

webClient.DownloadFile(CS1[12].TagValue, "file://C:/Users//Shaun//Documents//FormValue//" + PDFName);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 pdf下载链接,但文件可能存储在非公共文件夹中 - pdf download link, but file may be stored in a non-public folder 如何从ftp服务器的文件夹中检索pdf文件列表,并在aspx页中将其显示为.pdf链接? - how to retrieve list of pdf files from ftp server's folder and shown it as .pdf link in aspx page? 视频文件未保存在文件夹中 - Video file not getting saved in the folder 如何在asp.net C#应用程序中打开保存在本地目录/文件夹中的文件 - How to open file which saved on local directory/ folder in asp.net C# application 当我单击链接时,如何直接(从db中保存的二进制数据)打开文件? - How do I Open a file directly(from the binary data saved in db), when I will click a link? 如何共享PDF文件的路径并在我们的应用程序中打开它? - How to get sharing PDF file's path and open that in our app? 单击PDF文件中的链接 - Clicking a link in PDF file 打开.pdf文件(在axAcroPDF中)的功能/方法是什么?该文件存储在文件夹中,而其文件路径存储在数据库中? - What is the function/method to open a .pdf file (in axAcroPDF…), which is stored in a folder and its file path is stored in a database? 使用链接按钮打开文件 - Open file with link button 为什么默认情况下将此文件保存到IIS Express文件夹? - Why is this file saved by default to the IIS Express folder?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM