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

熱點內容
文件包加密是什麼意思 瀏覽:500
南方加密狗多少錢一隻 瀏覽:839
php100張恩民視頻 瀏覽:640
安卓手機復制門禁卡加密 瀏覽:754
有哪些程序員特有的技能 瀏覽:399
痞幼資源包解壓密碼 瀏覽:699
pdf版本的ppt 瀏覽:176
網站伺服器地址在哪裡 瀏覽:715
python發行版常用包 瀏覽:212
nginx無法解析php 瀏覽:829
單片機編程基礎語言 瀏覽:308
私有雲伺服器怎麼設置 瀏覽:957
程序員的晚上生活 瀏覽:585
visualc的編譯鍵不見了 瀏覽:856
51單片機畢業設計論文 瀏覽:666
3doutline怎麼擴展命令 瀏覽:861
程序員生活費200 瀏覽:339
方舟編譯器與小米 瀏覽:184
佳明app訓練怎麼用 瀏覽:989
如何查看data有沒有加密 瀏覽:502