如何从iframe将文件保存到服务器

如何从iframe将文件保存到服务器

问题描述:

嗨专家,



对你来说可能很简单,但我被困在这里,这里是场景:

- 我下载来自服务器的PDF文件,并在html表单的iframe中显示。



- 现在用户可以在iframe中旋转此图像。



我的目标是现在在服务器上保存这个旋转的图像,但不知道如何做到这一点。

保存时没有用户干预,用户只会点击仅保存按钮。



因此,如果我现在在我的HTML页面上点击SAVE按钮(示例中的链接),它应该将旋转的图像保存在我的SERVER路径上想要。



以下是显示我正在使用的pdf文件的简单表格:



Hi Experts,

may be quite simple for you but I am stuck here, here is the scenario:
- I download PDF files from the server and display it in iframe on the html form.

- Now users can rotate this image inside the iframe.

My target is to SAVE this rotated image on the server now, but not sure how to do this.
There will be no USER intervention in saving, user will just hit SAVE button only.

So if I hit SAVE button (link here in sample) on my HTML page now, it should save the rotated image on the SERVER path that I want.

Below is simple form for displaying of pdf files that I am using:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
    <script language="JavaScript" type="text/JavaScript">

    var now = true;
    function saveIt(){
    alert('in');
    if (now){document.execCommand("SaveAs");}
    }
    </script>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <iframe id="ipdf" src="aug2008.pdf" width="880" height="900"></iframe>
        </div>
        <div>
        <a href="javascript:;" onclick ="saveIt();">
        <img src="myLink.jpg" name="yourGraphic" border="0" width="50" height="50" />
        </a>
        </div>
    </form>
</body>
</html>









非常感谢任何帮助。



TIA!





Surinder





Any help is highly appreciated.

TIA!


Surinder

< title>



函数saveIt(){

imgURL = document.getElementById('external');

if(typeof imgURL =='object')

imgURL = imgURL.src;

window.win = open(imgURL);

setTimeout('win.resizeT o(0,0);',100);

setTimeout('win.moveTo(0,0);',200);

setTimeout('win。 document.execCommand(SaveAs)',500);

setTimeout('win.close()',1000);

}











value =保存/>





id =externalname =external& gt;













请试试IE 。
<title>

function saveIt() {
imgURL = document.getElementById('external');
if (typeof imgURL == 'object')
imgURL = imgURL.src;
window.win = open(imgURL);
setTimeout('win.resizeTo(0, 0);', 100);
setTimeout('win.moveTo(0, 0);', 200);
setTimeout('win.document.execCommand("SaveAs")', 500);
setTimeout('win.close()', 1000);
}





value="Save" />



id="external" name="external"&gt;






Please Try on IE.


Hi Surinder,



您应该使用PDFTK工具来执行此操作。您可以为用户提供选项,将pdf旋转90%或180%等,并将其保存在服务器上。只需谷歌就可以找到该工具。



谢谢,

Sathish Kumar
Hi Surinder,

You should use PDFTK tool to do this. You can give options to user to rotate pdf by 90% or 180% etc. and save it on the server. Just google it you will find the tool.

Thanks,
Sathish Kumar