导航:首页 > 文档加密 > 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打印相关的资料

热点内容
pythonsocket编程书籍 浏览:615
云眸用什么app 浏览:205
前端程序员留在北上还是二线 浏览:394
基于单片机的门禁控制系统 浏览:969
计算机怎么折叠文件夹 浏览:150
什么是服务器拆机卡 浏览:281
ad18编译pcb 浏览:346
开原研究生管理系统源码 浏览:170
pdf擦除工具 浏览:373
帝国首页模板下载哪个文件夹 浏览:855
有没有用云服务器赚钱的 浏览:93
rubypdf 浏览:471
文艺复兴史pdf 浏览:733
PDFgps测量 浏览:982
2k16生涯模式文件夹 浏览:395
研发云服务器续费 浏览:447
php地址重写 浏览:344
网上练瑜伽用什么app最好 浏览:557
文件夹为何搜索不了 浏览:338
怎么快捷删除lol换肤文件夹 浏览:253