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();
        }

相关文章:

  • 2022-12-23
  • 2021-09-02
  • 2022-12-23
  • 2022-01-24
  • 2021-12-02
  • 2021-07-12
  • 2022-03-02
  • 2021-08-07
猜你喜欢
  • 2021-11-13
  • 2021-08-14
  • 2021-10-04
  • 2022-03-01
  • 2022-12-23
  • 2022-12-23
  • 2022-01-04
相关资源
相似解决方案