基本信息
源码名称:PDF电子发票发票打印
源码大小:0.24M
文件格式:.zip
开发语言:C#
更新时间:2018-07-04
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):78630559

本次赞助数额为: 3 元 
   源码介绍

可一次性打印全部*屏蔽的关键字*,不限定格式

需安装 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