set DefaultFileName

The Amyuni PDF Converter is our Printer Driver that enables you to convert any documents to PDF format. If you have any questions about installing and using the Amyuni PDF Converter please post them here.
Post Reply
tatiana
Posts: 2
Joined: Fri Jun 20 2008

set DefaultFileName

Post by tatiana »

Hello,
I am initializing the PDF Converter

private void Initialize()
{
// if already called then exit
if (initialized)
return;

// Set FileNameOptions and output file name.
cdiNet.FileNameOptions = Declarations.NoPrompt + Declarations.UseFileName;
cdiNet.DefaultFileName = "C:\\Work\\PDFtest.pdf";

// If not called than initialize it
cdiNet.DriverInit(Declarations.PrinterName);
//Enable the printer before each printout for the Developer version
cdiNet.EnablePrinter(Declarations.LicensedTo, Declarations.ActivationCode);

// Set the Printer as Default, this is needed only if you can not print to a specific printer
cdiNet.SetDefaultPrinter();

// Set initialized to true
initialized = true;
}

but the file created is c:\temp\OutputNet.pdf. I am wondering if the line of code
cdiNet.DefaultFileName = "C:\\Work\\PDFtest.pdf";
does it's job.

Thanks
Tatiana
tatiana
Posts: 2
Joined: Fri Jun 20 2008

Re: set DefaultFileName

Post by tatiana »

Well...
I found the answer -
I should have called DriverInit first; this code works fine:

Hello,
I am initializing the PDF Converter

private void Initialize()
{
// if already called then exit
if (initialized)
return;

// If not called than initialize it
cdiNet.DriverInit(Declarations.PrinterName);
//Enable the printer before each printout for the Developer version
cdiNet.EnablePrinter(Declarations.LicensedTo, Declarations.ActivationCode);

// Set FileNameOptions and output file name.
cdiNet.FileNameOptions = Declarations.NoPrompt + Declarations.UseFileName;
cdiNet.DefaultFileName = "C:\\Work\\PDFtest.pdf";

// Set the Printer as Default, this is needed only if you can not print to a specific printer
cdiNet.SetDefaultPrinter();

// Set initialized to true
initialized = true;
}

Tatiana
Joan
Amyuni Team
Posts: 2799
Joined: Wed Sep 11 2002
Contact:

Re: set DefaultFileName

Post by Joan »

Hello,

You are right, DriverInit should be called once when launching your application followed by EnablePrinter().

Then you will call EnablePrinter() right before each print out.

Hope this helps.
Custom Brand the Amyuni PDF Printer Driver http://www.amyuni.com/en/developer/branding/index.html

Amyuni PDF Converter tested for true PDF performance. View results - http://www.amyuni.com/benchmark
Post Reply