Page 1 of 1

Save.Path issue

Posted: Mon Mar 20, 2017 7:09 pm
by glima
The path provided cannot have an extension

We combine multiple files into a single PDF file using the driver. We then run a process with the completed PDF

string TempFolder = Path.Combine(Path.GetTempPath(), "[TEST]" + Path.GetRandomFileName());

PDFPrinter.set_Option("Save.Path", TempFolder);
PDFPrinter.set_Option("Save.File", Filename);
PDFPrinter.set_Option("Save.WhenExists", "Append");
PDFPrinter.ApplyOptions(0);

PrintDocument pd = new PrintDocument();
pd.PrinterSettings.PrinterName = printerName;
pd.DocumentName = "TEST 2017 - "+ inputfile; //Name that appears in the printer queue
pd.Print();

In this C# example the Path.GetRandomFileName() returns something like this "zpcx2wxf.yyt"

When appending documents the driver defaults to the pd.DocumentName or if omitted it defaults to "document.PDF"

if you do this everything works properly

string TempFolder = Path.Combine(Path.GetTempPath() "[TEST]" + Path.GetFileNameWithoutExtension(Path.GetRandomFileName()));

Re: Save.Path issue

Posted: Mon Mar 20, 2017 10:34 pm
by glima
That was not the cause of the problem. The issue is due to multiple instances of a virtual printer being generated

The files being converted so quickly that I get

TEST Printer
TEST Printer 1
TEST Printer 2
TEST Printer 3
TEST Printer 4

After editing the code the instance disappeared and did not appear because of stepping through the application.

How can we stop multiple instances. These files need to be processed sequentially.

Re: Save.Path issue

Posted: Tue Mar 21, 2017 11:54 am
by Tracker Supp-Stefan
Hello glima,

Can you wait for e.g. the OnFileSaved event:
https://help.pdf-xchange.com/DEV/de ... ynchronous
And only start the next document when the previous one has finished?

Cheers,
Stefan

Re: Save.Path issue

Posted: Wed Mar 22, 2017 8:25 pm
by glima
Oops.

This all happened when another developer added an instantiation of the driver using our wrapper class.Once we removed this everything is working fine.

Re: Save.Path issue

Posted: Thu Mar 23, 2017 9:39 am
by Tracker Supp-Stefan
Hi glima,

Glad to hear that you've found a solution to the problem!

Cheers,
Stefan