将图像保存在Asp.net中 [英] save image in Asp.net

查看:79
本文介绍了将图像保存在Asp.net中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是代码:

this is code :

public int Convert(string sourceFileName, ImageFormat outPutImageFormat)
{
    if (pdfDoc.Open(sourceFileName))
    {

        // pdfapp.Hide();
        pageCount = pdfDoc.GetNumPages();

        for (int i = 0; i < pageCount; i++)
        {
            pdfPage = (Acrobat.CAcroPDPage)pdfDoc.AcquirePage(i);
            pdfPoint = (Acrobat.AcroPoint)pdfPage.GetSize();
            pdfRect.Left = 0;
            pdfRect.right = pdfPoint.x;
            pdfRect.Top = 0;
            pdfRect.bottom = pdfPoint.y;

            pdfPage.CopyToClipboard(pdfRect, 0, 0, 100);

            string outimg = "";
            string filename = sourceFileName.Substring(sourceFileName.LastIndexOf("\\") + 1);
            filename = filename.Remove(filename.LastIndexOf("."));
            if (pageCount == 1)
                outimg = strMapath + filename + "." + outPutImageFormat.ToString();
            else
                outimg = strMapath + filename + "_" + i.ToString() + "." + outPutImageFormat.ToString();


....................
我需要一种解决方案来将"outimg"保存在asp.net中.
请帮我.谢谢.


....................
I need a solution to save "outimg" in asp.net.
Pls help me.Thank a lots.

推荐答案



1-您使用的是哪个PDF组件?
2-您具有
Hi,

1 - Which PDF component you are using?
2 - You have
pdfPage.CopyToClipboard(...)

函数. PDF库中是否有其他功能可以将其复制到其他流中?例如文件流或二进制流?

3-使用上面的代码将数据复制到剪贴板,您可以从剪贴板 http://msdn中提取数据.microsoft.com/en-us/library/c2thcsx4.aspx [ ^ ],但您需要指定要提取的数据格式,例如文本/图像等.

在pdfPage.CopyToClipboard(...)函数之后,打开画笔,即MS Paint,然后按Ctrl + V,查看是否有图像.如果要在MS Paint中获取图像,则很有可能将数据另存为图像,但是如果没有获取图像,则可能无法将数据转换为图像.

谢谢,
hemant

编辑
我相信我已经找到了解决方案.您正在使用Adobe的Acrobat SDK将数据复制到剪贴板,我是对的,您可以从剪贴板获取数据.

[从Acrobat创建缩略图 ]
阅读上面的文章,它正是您所寻找的.

function. Do you have other function in the PDF library that can copy it to other stream.. for example File stream or binary stream?

3 - with the above code where you have copied data to Clipboard you can extract data from clipboard http://msdn.microsoft.com/en-us/library/c2thcsx4.aspx[^] but you will need to specify format of data being extracted i.e. text/image etc.

After pdfPage.CopyToClipboard(...) function open paint brush i.e. MS Paint and press Ctrl + V and see if you are getting any image. if you are getting an image in MS Paint then saving data as image is very much possible but if you are not getting an image then probably the data cannot be covnerted to image.

Thanks,
hemant

Edit
I believe i''ve found solution. You are using Adobe''s Acrobat SDK to copy data to clipboard and i was right that you can get data from clipboard.

[Create thumbnail from Acrobat]
Read the above article it has exactly what you are looking for.

Call pdfPage.CopyToClipboard(pdfRect, 0, 0, 100)

Dim clipboardData As IDataObject = Clipboard.GetDataObject()



希望这会有所帮助.

谢谢,
Hemant



Hope this will help.

Thanks,
Hemant


这可能有帮助 [

这篇关于将图像保存在Asp.net中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆