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

熱點內容
android仿ios時間選擇器 瀏覽:380
見識pdf 瀏覽:83
男孩子慰菊手冊pdf 瀏覽:532
注冊表啟動項命令 瀏覽:109
89c51單片機定時器 瀏覽:687
一般不適合做程序員的適合做啥 瀏覽:923
點在多邊形內演算法 瀏覽:494
程序員下班急忙回家 瀏覽:359
安慶php全套源碼交友類型網站源碼 瀏覽:92
浪潮伺服器公司地址 瀏覽:733
密約聊天交友app怎麼賺錢 瀏覽:280
滴滴java 瀏覽:109
phpexpires 瀏覽:218
matlab編程用什麼語言 瀏覽:70
php查找字元是否存在 瀏覽:701
可編程函數發生器 瀏覽:881
單片機正極接地視頻 瀏覽:67
利用python爬火車票 瀏覽:375
androidaidl如何工作 瀏覽:856
第三胸椎壓縮骨折什麼症狀 瀏覽:507