예제 #1
0
        private static void PDFConversion(string tempFile)
        {
            const string adAssistPrinterFolder = "AdAssistPrinter";
            const string printerOutput = "PrintFromADAssist.pdf";

            string localApplicationData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);

            string adAssistPrinterFolderFullPath = Path.Combine(localApplicationData, adAssistPrinterFolder);
            if (!Directory.Exists(adAssistPrinterFolderFullPath))
            {
                Directory.CreateDirectory(adAssistPrinterFolderFullPath);
            }

            string printerOutputFullPath = Path.Combine(adAssistPrinterFolderFullPath, printerOutput);
            if (File.Exists(printerOutputFullPath))
            {
                File.Delete(printerOutputFullPath);
            }

            _printerOutputFullPath = printerOutputFullPath;

            var gs = new GhostScript();
            gs.AddParam("-q");
            gs.AddParam("-dNOPAUSE");
            gs.AddParam("-dBATCH");
            gs.AddParam("-dQUIET");
            gs.AddParam("-sDEVICE=pdfwrite");
            gs.AddParam("-dSAFER");
            gs.AddParam("-sPAPERSIZE=letter");
            gs.AddParam("-sOutputFile=" + _printerOutputFullPath);
            gs.AddParam(tempFile);
            gs.Execute();
        }
예제 #2
0
        private static void PDFConversion(string tempFile)
        {
            const string adAssistPrinterFolder = "AdAssistPrinter";
            const string printerOutput         = "PrintFromADAssist.pdf";

            string localApplicationData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);

            string adAssistPrinterFolderFullPath = Path.Combine(localApplicationData, adAssistPrinterFolder);

            if (!Directory.Exists(adAssistPrinterFolderFullPath))
            {
                Directory.CreateDirectory(adAssistPrinterFolderFullPath);
            }

            string printerOutputFullPath = Path.Combine(adAssistPrinterFolderFullPath, printerOutput);

            if (File.Exists(printerOutputFullPath))
            {
                File.Delete(printerOutputFullPath);
            }

            _printerOutputFullPath = printerOutputFullPath;

            var gs = new GhostScript();

            gs.AddParam("-q");
            gs.AddParam("-dNOPAUSE");
            gs.AddParam("-dBATCH");
            gs.AddParam("-dQUIET");
            gs.AddParam("-sDEVICE=pdfwrite");
            gs.AddParam("-dSAFER");
            gs.AddParam("-sPAPERSIZE=letter");
            gs.AddParam("-sOutputFile=" + _printerOutputFullPath);
            gs.AddParam(tempFile);
            gs.Execute();
        }