導航:首頁 > 文檔加密 > itextsharppdf列印

itextsharppdf列印

發布時間:2024-03-05 16:23:36

㈠ c#可以調用什麼工具把圖片轉換成pdf格式或者.swf格式嗎 如果可以,應該怎麼做呢

如果是把圖片轉換為pdf格式的,使用如下代碼:
首先要下載 iTextSharp.dll文件,之後添加到引用中
提供一個類 :
public void ExportDataIntoPDF(string pathName, String path)
{//導出至PDF
iTextSharp.text.Document document = new iTextSharp.text.Document();
try
{
iTextSharp .text .pdf .PdfWriter .GetInstance (document, new FileStream(pathName, FileMode.CreateNew ));
document.Open();
iTextSharp.text.pdf.BaseFont bfChinese = iTextSharp.text.pdf.BaseFont.CreateFont("C:\\WINDOWS\\Fonts\\simsun.ttc,1", iTextSharp.text.pdf.BaseFont.IDENTITY_H, iTextSharp.text.pdf.BaseFont.NOT_EMBEDDED);
iTextSharp.text.Font Titlefont = new iTextSharp.text.Font(bfChinese, 16, iTextSharp.text.Font.BOLD , new iTextSharp.text.Color(0, 0, 0));

document.Add(new Paragraph(" 將圖片轉成PDF:" + "\n", Titlefont));
iTextSharp.text.Image je = iTextSharp.text.Image.GetInstance(path);//path就是函數入參,即你要轉成PDF的圖片路徑
document.Add(je);
}

catch (Exception de)
{
MessageBox .Show (de.ToString());
}
document.Close();
}
調用這個類就ok了

如果轉換為swf格式的話 就需要使用商業的dll了

㈡ 怎麼用iTextSharp獲得PDF文件中的某一頁內容

本文實例講述了C#使用iTextSharp從PDF文檔獲取內容的方法。分享給大家供大家參考。具體實現方法如下:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using iTextSharp.text.pdf;
using iTextSharp.text.pdf.parser;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
ExtractTextFromPDFPage("c:\sample.pdf", 1);
}
public void ExtractTextFromPDFPage(string pdfFile, int pageNumber)
{
PdfReader reader = new PdfReader(pdfFile);
string text = PdfTextExtractor.GetTextFromPage(reader, pageNumber);
try { reader.Close(); }
catch { }
richTextBox1.Text = text;
}
}
}

㈢ c# 如何將網頁轉換成pdf檔

把網頁轉換為pdf?
好像很難。
我曾經搞過類型的項目。
網上有iTextSharp這樣的開源庫,可以操作pdf文件。
但是,要把網頁轉為pdf, 這涉及對網頁的渲染工作,這個只有IE才能完成。

如果運行的環境可控,可以考慮採用為運行環境安裝一個PDF列印機什麼的。然後用DDE技術調用IE直接把指定的網頁列印到PDF列印機。就生成了PDF文件。

如果運行環境不可控,那真得是很難。

閱讀全文

與itextsharppdf列印相關的資料

熱點內容
平板的訪客模式如何加密 瀏覽:139
釘釘加密有用嗎 瀏覽:112
加密u盤好還是不加密的 瀏覽:349
微觀經濟學平狄克第八版pdf 瀏覽:404
linux查看實時流量 瀏覽:557
如何存檔到伺服器 瀏覽:548
flash編程書籍推薦 瀏覽:835
php獲得數組鍵值 瀏覽:402
香港雲伺服器操作 瀏覽:303
wpe最新源碼 瀏覽:857
自己購買雲主伺服器推薦 瀏覽:422
個人所得稅java 瀏覽:761
多餘的伺服器滑道還有什麼用 瀏覽:192
pdf劈開合並 瀏覽:29
不能修改的pdf 瀏覽:752
同城公眾源碼 瀏覽:489
一個伺服器2個埠怎麼映射 瀏覽:298
java字元串ascii碼 瀏覽:79
台灣雲伺服器怎麼租伺服器 瀏覽:475
旅遊手機網站源碼 瀏覽:332