導航:首頁 > 文檔加密 > netpdf

netpdf

發布時間:2022-10-05 09:03:24

❶ .net怎樣在網頁中打開pdf格式文件,不允許下載,只能在網頁中瀏覽,求大神

page.Response.AddHeader("Content-Disposition", "attachment;filename=" + downLoad + ".xls");
while (dataLength > 0 && page.Response.IsClientConnected)
{
int lengthRead = fs.Read(buffer, 0, Convert.ToInt32(ChunkSize));
page.Response.OutputStream.Write(buffer, 0, lengthRead);
page.Response.Flush();
dataLength = dataLength - lengthRead;
}
page.Response.Close();

這是導出xls的 "attachment;filename=" + downLoad + ".xls" 這是以附件的形式 所以代開的時候是以下載流打開的
你不要用 附件的形式,那麼它就不會允許下載
PDF document

<% response.ContentType ="application/pdf" %>
<!--#i nclude virtual="/myfile.pdf" --> 這是網頁顯示pdf的網頁內容頭
還有以後問問題 請上代碼

❷ net中怎麼打開指定路徑下的PDF文件

需要安裝adobereader

<objectclassid="clsid:CA8A9780-280D-11CF-A24D-444553540000"height="700px"width="755px">
<paramname="_Version"value="65539">
<paramname="_ExtentX"value="20108">
<paramname="_ExtentY"value="10866">
<paramname="_StockProps"value="0">
<paramname="SRC"value="D:TDDownloadAJAX實戰中文版AJAX實戰中文版AJAX實戰.pdf">
</object>

❸ 如何用.NET將DWG文件列印為PDF

執行步驟:打開一個dwg文件,用netload載入下面代碼所在的.dll文件,再輸入命令plottest,就得到輸出結果(一個.pdf文件)。

要用到的參考:

AcDbMgd.dll;AcMgd.dll;AutoCAD 2010 Type Library;System.Windows.Forms; AutoCAD/ObjectDBX Common 18.0 Type Library.

VB.NET:

Imports System

Imports Autodesk.AutoCAD.Runtime

Imports Autodesk.AutoCAD.Interop

Imports Autodesk.AutoCAD.Interop.Common

Imports Autodesk.AutoCAD.ApplicationServices

Imports Autodesk.AutoCAD.DatabaseServices

Imports Autodesk.AutoCAD.EditorInput

<Autodesk.AutoCAD.Runtime.CommandMethod("Plottest")> _

Public Sub PlotToPDF()

Dim activeDoc As Document = Application.DocumentManager.MdiActiveDocument

Dim ThisDrawing As AcadDocument = CType(activeDoc.AcadDocument, AcadDocument)

Dim layout As AcadLayout = ThisDrawing.ActiveLayout

Dim MediaName As String = layout.CanonicalMediaName

If MediaName.Equals("") Then

activeDoc.Editor.WriteMessage("There is no media set for the active layout.")

Return

Else

activeDoc.Editor.WriteMessage(("The media for the active layout is: " + MediaName))

End If

Try

Dim oplot As AcadPlotConfiguration = ThisDrawing.PlotConfigurations.Add("PDF", layout.ModelType)

oplot.PaperUnits = AcPlotPaperUnits.acMillimeters

oplot.StyleSheet = "monochrome.ctb"

oplot.PlotWithPlotStyles = True

oplot.ConfigName = "DWG To PDF.pc3"

oplot.UseStandardScale = True

oplot.StandardScale = AcPlotScale.acScaleToFit

oplot.PlotType = AcPlotType.acExtents

oplot.CenterPlot = True

Dim oMediaNames As Object = layout.GetCanonicalMediaNames

Dim mediaNames As ArrayList = New ArrayList(CType(oMediaNames, String()))

For Each sName As String In mediaNames

If sName.Contains(MediaName) Then

oplot.CanonicalMediaName = sName

layout.CopyFrom(oplot)

layout.PlotRotation = AcPlotRotation.ac0degrees

layout.RefreshPlotDeviceInfo()

ThisDrawing.SetVariable("BACKGROUNDPLOT", 0)

ThisDrawing.Plot.QuietErrorMode = True

ThisDrawing.Plot.PlotToFile("c:/temp/d1.pdf", "DWG To PDF.pc3")

oplot.Delete()

oplot = Nothing

Return

End If

Next

Catch es As System.Exception

System.Windows.Forms.MessageBox.Show(es.ToString)

End Try

End Sub

❹ .net如何將頁面生成pdf

using System;
using System.IO;
using System.Text;
using System.Collections;

namespace PDFGenerator
{

public class PDFGenerator
{
static float pageWidth = 594.0f;
static float pageDepth = 828.0f;
static float pageMargin = 30.0f;
static float fontSize = 20.0f;
static float leadSize = 10.0f;

static StreamWriter pPDF=new StreamWriter("E:\\myPDF.pdf");

static MemoryStream mPDF= new MemoryStream();

static void ConvertToByteAndAddtoStream(string strMsg)
{
Byte[] buffer=null;
buffer=ASCIIEncoding.ASCII.GetBytes(strMsg);
mPDF.Write(buffer,0,buffer.Length);
buffer=null;
}

static string xRefFormatting(long xValue)
{
string strMsg =xValue.ToString();
int iLen=strMsg.Length;
if (iLen<10)
{
StringBuilder s=new StringBuilder();
int i=10-iLen;
s.Append('0',i);
strMsg=s.ToString() + strMsg;
}
return strMsg;
}

static void Main(string[] args)
{
ArrayList xRefs=new ArrayList();
//Byte[] buffer=null;
float yPos =0f;
long streamStart=0;
long streamEnd=0;
long streamLen =0;
string strPDFMessage=null;
//PDF文檔頭信息
strPDFMessage="%PDF-1.1\n";
ConvertToByteAndAddtoStream(strPDFMessage);

xRefs.Add(mPDF.Length);
strPDFMessage="1 0 obj\n";
ConvertToByteAndAddtoStream(strPDFMessage);
strPDFMessage="<< /Length 2 0 R >>\n";
ConvertToByteAndAddtoStream(strPDFMessage);
strPDFMessage="stream\n";
ConvertToByteAndAddtoStream(strPDFMessage);
////////PDF文檔描述
streamStart=mPDF.Length;
//字體
strPDFMessage="BT\n/F0 " + fontSize +" Tf\n";
ConvertToByteAndAddtoStream(strPDFMessage);
//PDF文檔實體高度
yPos = pageDepth - pageMargin;
strPDFMessage=pageMargin + " " + yPos +" Td\n" ;
ConvertToByteAndAddtoStream(strPDFMessage);
strPDFMessage= leadSize+" TL\n" ;
ConvertToByteAndAddtoStream(strPDFMessage);

//實體內容
strPDFMessage= "(http://www.wenhui.org)Tj\n" ;
ConvertToByteAndAddtoStream(strPDFMessage);
strPDFMessage= "ET\n";
ConvertToByteAndAddtoStream(strPDFMessage);
streamEnd=mPDF.Length;

streamLen=streamEnd-streamStart;
strPDFMessage= "endstream\nendobj\n";
ConvertToByteAndAddtoStream(strPDFMessage);
//PDF文檔的版本信息
xRefs.Add(mPDF.Length);
strPDFMessage="2 0 obj\n"+ streamLen + "\nendobj\n";
ConvertToByteAndAddtoStream(strPDFMessage);

xRefs.Add(mPDF.Length);
strPDFMessage="3 0 obj\n<</Type/Page/Parent 4 0 R/Contents 1 0 R>>\nendobj\n";
ConvertToByteAndAddtoStream(strPDFMessage);

xRefs.Add(mPDF.Length);
strPDFMessage="4 0 obj\n<</Type /Pages /Count 1\n";
ConvertToByteAndAddtoStream(strPDFMessage);
strPDFMessage="/Kids[\n3 0 R\n]\n";
ConvertToByteAndAddtoStream(strPDFMessage);
strPDFMessage="/Resources<</ProcSet[/PDF/Text]/Font<</F0 5 0 R>> >>\n";
ConvertToByteAndAddtoStream(strPDFMessage);
strPDFMessage="/MediaBox [ 0 0 "+ pageWidth + " " + pageDepth + " ]\n>>\nendobj\n";
ConvertToByteAndAddtoStream(strPDFMessage);

xRefs.Add(mPDF.Length);
strPDFMessage="5 0 obj\n<</Type/Font/Subtype/Type1/BaseFont/Courier/Encoding/WinAnsiEncoding>>\nendobj\n";
ConvertToByteAndAddtoStream(strPDFMessage);

xRefs.Add(mPDF.Length);
strPDFMessage="6 0 obj\n<</Type/Catalog/Pages 4 0 R>>\nendobj\n";
ConvertToByteAndAddtoStream(strPDFMessage);

streamStart=mPDF.Length;
strPDFMessage="xref\n0 7\n0000000000 65535 f \n";
for(int i=0;i<xRefs.Count;i++)
{
strPDFMessage+=xRefFormatting((long) xRefs[i])+" 00000 n \n";
}
ConvertToByteAndAddtoStream(strPDFMessage);
strPDFMessage="trailer\n<<\n/Size "+ (xRefs.Count+1)+"\n/Root 6 0 R\n>>\n";
ConvertToByteAndAddtoStream(strPDFMessage);

strPDFMessage="startxref\n" + streamStart+"\n%%EOF\n";
ConvertToByteAndAddtoStream(strPDFMessage);
mPDF.WriteTo(pPDF.BaseStream);

mPDF.Close();
pPDF.Close();
}
}

另外:C#中生成PDF文件的方法挺多,可以使用iTextSharp控制項,還有aspose的控制項也可以。這些控制項的功能都很強大,所以控制項的大小也會很大

❺ 在.net下如何提取PDF的文字並檢索相關數據

FileStream ReadPdf = new FileStream(@"d:\books\vb.net\test.pdf", FileMode.Open);
long FileSize;
FileSize = ReadPdf.Length;
byte[] Buffer = new byte[(int)FileSize];
ReadPdf.Read(Buffer, 0, (int)ReadPdf.Length);
ReadPdf.Close();


FileStream CreatePdf = new FileStream(@"d:\books\vb.net\test1.pdf", FileMode.Create);
CreatePdf.Write(Buffer,0,Buffer.Length);
CreatePdf.Close();

希望能幫帶你的忙~告一段落~謝謝~

❻ 如何使用.net編程給pdf文件加水印(急)

我說錯了 我用的itextsharp 是用於.net的 現在的情況是找到了庫函數的寫法 但老是報錯 希望大俠們幫看一下:

PdfReader reader = new PdfReader("C:/Documents and Settings/zeng/桌 面/test1.pdf");
PdfStamper stamp = new PdfStamper(reader, new FileStream("C:/Documents and Settings/zeng/桌面/test1.pdf", FileMode.Create));
int n = reader.NumberOfPages;
int i = 0;
PdfContentByte under;
iTextSharp.text.Image im = iTextSharp.text.Image.GetInstance("C:/Documents and Settings/zeng/桌面/logo.jpg");
im.SetAbsolutePosition(440, 730);
im.ScaleAbsolute(160, 60);

while (i < n)
{
i++;
under = stamp.GetOverContent(i);
under.AddImage(im);
}
-----以上都正確
stamp.Close(); ---此處報異常 說文件在被另一個程序使用。
reader.Close();

看了半天 沒發現哪裡有打開文件沒有關閉的 真不知道該怎麼辦

❼ 在.NET中如何將pdf文件轉換成我word或者html。

這個基本上沒法做,要從程序上來說的話你得了解pdf和word的文件格式,太難。而且現在的商業軟體都很難解決這個問題。
不過有個簡單的方法就是利用online的service,網上有很多在線pdf轉word的,你可以在程序裡面與它們通信,提交pdf,下載word

❽ .net生成PDF文件的一個問題..

table.Padding = 0;
table.Spacing = 2; //設置這個值的大小可以解決這個問題

❾ 怎樣把.net頁面中的表格轉換成pdf

安裝Adobe
Acrobat軟體,安裝成功後網頁有個「將網頁轉換為PDF」的插件功能,能將任何網頁及文檔轉成PDF文檔。

閱讀全文

與netpdf相關的資料

熱點內容
新建文件夾1女演員三位 瀏覽:740
不用下載就能看的視頻網站 瀏覽:330
我一個神偷硬生生把國家偷成強國 瀏覽:600
樣子是五歲小男孩和郭富城演的 瀏覽:460
韓國演員也美娜 瀏覽:898
陸離是哪部小說的主角 瀏覽:49
華娛開局佟麗婭 瀏覽:17
男男生子小說現代攻姓章 瀏覽:541
永旺星星影院影訊 瀏覽:328
李彩潭巔峰之作 瀏覽:86
彎村紅羊電影 瀏覽:157
我和我的家教老師韓國 瀏覽:102
日本經典高分電影 瀏覽:627
動物真人版電影鳳凰定製 瀏覽:360
海客雲伺服器一個月怎麼算的 瀏覽:161
黑道小說主角外號瘋子 瀏覽:309
書包cc網電子書txt免費下載 瀏覽:354
帶一點黃的小說 瀏覽:257
法國倫理電影小僕人 瀏覽:187
印度搶打火機的電影叫什麼 瀏覽:291