I'm attempting to create a simple C# application which can accept input on StdIn and process that with Ghostscript to create a PDF, eventually I'd like to do other things with the output PDF, but for now just creating the PDF is enough.
I was thinking of running the Ghostscript .exe with a Process, but then I found Ghostscript.NET, the thing I'm struggling with is how to pass the data received on StdIn to the Ghostscript.NET Processor.
using (GhostscriptProcessor ghostscript = new GhostscriptProcessor(gvi))
{
List<string> switches = new List<string>();
switches.Add("-sDEVICE=pdfwrite");
switches.Add("-r300");
switches.Add("-dBATCH");
switches.Add("-dNOPAUSE");
switches.Add("-dSAFER");
switches.Add("-dNOPROMPT");
switches.Add("-sPAPERSIZE=a4");
switches.Add("-sOutputFile = \"" + filename + "\"");
switches.Add("-c");
switches.Add(".setpdfwrite");
switches.Add(@"-f");
switches.Add("-");
ghostscript.Process(switches.ToArray(), new ConsoleStdIO(true, true, true));
}
This was from the GitHub repo, but I'm not sure if it's what I need or not:
public class ConsoleStdIO : Ghostscript.NET.GhostscriptStdIO
{
public ConsoleStdIO(bool handleStdIn, bool handleStdOut, bool handleStdErr) : base(handleStdIn, handleStdOut, handleStdErr) { }
public override void StdIn(out string input, int count)
{
char[] userInput = new char[count];
Console.In.ReadBlock(userInput, 0, count);
input = new string(userInput);
}
public override void StdOut(string output)
{
Console.Write(output);
}
public override void StdError(string error)
{
Console.Write(error);
}
}
答案 0 :(得分:0)
$result = DB:table('tableA')
->join('tableB','tableB.id','=','TableA.tid')
->join('tableC','tableB.sd','=','TableC.id')
->where('tableC.number', '=', '1')
->where('tableB.lang', '=', 'en')
->where(function ($q) use($regFilterVal) {
// Nested OR condition
$q->whereBetween('tableC.numberMin', $regFilterVal)
->orBetween('tableC.numberMin', $regFilterVal);
})