jonathan
jonathan

Reputation: 67

how to create 2 pdf files at the same time with ghostscript?

How can I create 2 pdf files at the same time using GhostScript?

this is my code:

string gsPath = @"C:\Program Files (x86)\gs\gs9.26\bin\gswin32.exe";

                List gsArgsList = new List();
                gsArgsList.Add(" -dPDFA=2");
                gsArgsList.Add(" -dBATCH");
                gsArgsList.Add(" -dNOPAUSE");                
                gsArgsList.Add(" -sProcessColorModel=DeviceCMYK");
                gsArgsList.Add(" -sDEVICE=pdfwrite");
                gsArgsList.Add(" -dPDFACompatibilityPolicy=1");
                gsArgsList.Add(" -sOutputFile=" + nuevo);
                gsArgsList.Add(" " + rutaPdfNormal); 

                var gsArgs = String.Join(null, gsArgsList);

                string gs = gsPath + gsArgs;
                System.Diagnostics.Process.Start(gsPath, gsArgs);

Upvotes: 1

Views: 196

Answers (1)

KenS
KenS

Reputation: 31139

You cannot create two PDF files simultaneously in a single instance of Ghostscript. The pdfwrite device (which writes the PDF file) only writes to a single file.

I also cannot see the point in writing two files at the same time; perhaps if you explained what you were trying to achieve it might be possible to advise further.

The example you linked to above isn't writing two PDF files simultaneously. It starts by writing to the output file 'tiger.pdf' running the input file 'tiger.eps'. Then it switches to the output file 'colorcir.pdf' and runs the file 'colorcir.ps'. That's not simultaneous, it's sequential; it's exactly the same as running Ghostscript twice with different command lines.

Upvotes: 1

Related Questions