導航:首頁 > 文檔加密 > 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列印相關的資料

熱點內容
php清理內存 瀏覽:966
徠卡參與華為的演算法沒 瀏覽:768
怎麼將項目部署在伺服器上 瀏覽:14
java當前位置 瀏覽:434
德福詞彙pdf 瀏覽:873
linux信號同步 瀏覽:48
德pdf 瀏覽:248
有一年開發經驗的程序員簡歷模板 瀏覽:910
opengl編程pdf 瀏覽:945
網路編程學習路線 瀏覽:806
安卓機為什麼會死機 瀏覽:845
python模塊交叉編譯 瀏覽:363
單片機音樂盒程序 瀏覽:607
網頁源碼改語言 瀏覽:358
三相電表容量演算法 瀏覽:833
linuxoracle查看sid 瀏覽:751
什麼的伺服器快 瀏覽:764
程序員看不起編程 瀏覽:764
python網頁狀態碼 瀏覽:17
10分的硬幣演算法 瀏覽:772