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

熱點內容
單片機學習指導 瀏覽:586
胸7椎體輕度壓縮 瀏覽:108
sk5伺服器什麼意思 瀏覽:554
什麼是廊坊交警app 瀏覽:294
衣櫃造價演算法 瀏覽:984
默認的web伺服器地址 瀏覽:694
單片機與發光二極體 瀏覽:320
pythonwebmodule 瀏覽:328
空調壓縮機不停了 瀏覽:115
python序列怎麼取 瀏覽:199
線上資料庫加密怎麼查詢 瀏覽:794
js中數據加密 瀏覽:470
穴pdf 瀏覽:549
阿里雲伺服器雲資料庫還需要嗎 瀏覽:146
在程序設計中常用的演算法有哪些 瀏覽:977
為什麼蘇州公積金app一直維護 瀏覽:805
有ip地址但是dhcp伺服器 瀏覽:446
三星手機加密中斷怎麼回事 瀏覽:538
訓練模型init源碼 瀏覽:840
程序編譯是誰的功能 瀏覽:505