在好例子网,分享、交流、成长!
您当前所在位置:首页C# 开发实例C#语言基础 → PDF电子发票发票打印

PDF电子发票发票打印

C#语言基础

下载此实例
  • 开发语言:C#
  • 实例大小:0.24M
  • 下载次数:118
  • 浏览次数:3010
  • 发布时间:2018-07-04
  • 实例类别:C#语言基础
  • 发 布 人:东北偏北
  • 文件格式:.zip
  • 所需积分:3
 相关标签: pdf 打印 d 发票

实例介绍

【实例简介】可一次性打印全部*屏蔽的关键字*,不限定格式

需安装 axAcroPDF com组件,需安装adobe reader 

【实例截图】

【核心代码】


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

using System.IO;
using System.Drawing.Printing;
using System.Diagnostics;
using System.Collections.Specialized;

namespace InvoicePrinter
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        string path = "";
        private int nodecount = 0;

        private void label1_Click(object sender, EventArgs e)
        {

        }

        #region //NO effect
        /*  private void checkBox1_CheckedChanged(object sender, EventArgs e)
        {
            if (checkBox1.CheckState == CheckState.Checked)
            {
                checkBox2.CheckState = CheckState.Checked;
                checkBox10.CheckState = CheckState.Checked;
            }
            if (checkBox1.CheckState == CheckState.Unchecked)
            {
                checkBox2.CheckState = CheckState.Unchecked;
                checkBox10.CheckState = CheckState.Unchecked;
            }
        } 

        private void checkBox2_CheckedChanged(object sender, EventArgs e)
        {
            if (checkBox2.CheckState == CheckState.Checked)  
            {
                 string[] filearray = Directory.GetFiles(@"C:\Users\Administrator\Desktop","*张松.pdf",System.IO.SearchOption.AllDirectories);
                 if (filearray != string[0])
                 {

                 }
                 else
                 {
                     MessageBox.Show(" <*张松.pdf> File Does Not Exist");
                 }
            }          

        }


        private void checkBox10_CheckedChanged(object sender, EventArgs e)
        {
            
        }         */
        #endregion
        private void checkedListBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            //string[] filearray = Directory.GetFiles(@"C:\Users\Administrator\Desktop", "*张松.pdf", System.IO.SearchOption.AllDirectories);
            int selectedIndex = checkedListBox1.SelectedIndex;
            string selectfilePath = path   "\\"   (string)this.checkedListBox1.Items[selectedIndex];
            axAcroPDF1.LoadFile(selectfilePath);
        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {

        }

        private void Form1_Load(object sender, EventArgs e)
        {
            StreamReader sir = new StreamReader(@"D:\zhangsong\VSPrictice\InvoicePrinter\InvoicePrinter\bin\Debug\\Invoicepath.txt");
            //StreamReader sir = new StreamReader(@"H:\bin\Debug\\Invoicepath.txt");
            String line;
            if ((line = sir.ReadLine()) != null)
            {
                path = line.ToString();
            }
            this.textBox1.Text = path;
            foreach (string item in System.IO.Directory.GetFiles(path, "*.pdf"))
            {
                this.checkedListBox1.Items.Add(item.Substring(path.Length   1));
                nodecount  ;
            }

        }

        private void checkBox1_CheckedChanged(object sender, EventArgs e)
        {
            if (checkBox1.CheckState == CheckState.Checked)
            {
                for (int i = 0; i < nodecount; i  )
                {
                    checkedListBox1.SetItemChecked(i, true);
                }
            }
            else
            {
                for (int i = 0; i < nodecount; i  )
                {
                    checkedListBox1.SetItemChecked(i, false);
                }
            }
        }
        public void pdfprint(string filepath)
        { 
        PrintDocument pd = new PrintDocument();
            Process p = new Process();
            ProcessStartInfo startinfo = new ProcessStartInfo();
            startinfo.CreateNoWindow = true;
            startinfo.WindowStyle = ProcessWindowStyle.Hidden;
            startinfo.UseShellExecute = true;
            startinfo.FileName = filepath;
            startinfo.Verb = "print";
            startinfo.Arguments = @"/p /h \"   filepath   "\"\""   pd.PrinterSettings.PrinterName  "\"";
            p.StartInfo = startinfo;
            p.Start();
            p.WaitForExit();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            for(int i =0;i 


标签: pdf 打印 d 发票

网友评论

第 1 楼 乖乖宝贝 发表于: 2018-11-28 17:50 00
2468088493我的qq,加一下,有点问题咨询

支持(0) 盖楼(回复)

第 2 楼 qbadmin 发表于: 2019-11-27 11:28 44
程序又问题啊,运行不起来

支持(0) 盖楼(回复)

发表评论

(您的评论需要经过审核才能显示)

查看所有2条评论>>

小贴士

感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。

  • 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
  • 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
  • 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
  • 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。

关于好例子网

本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明

;
报警