Disable ""SAVE PDF AS "" dialog .

Have questions about novaPDF (desktop or server), or having problems using it? Ask here for help.
Post Reply
ramesh
Posts: 3
Joined: Tue Sep 20, 2011 12:13 pm

Disable ""SAVE PDF AS "" dialog .

Post by ramesh »

HI,

I am using the nova pdf sdk to generate the pdf files,
I have installed the novapdf sdk and included the novalib library and Globals.cs, inserted the below code.

const string SMALL_SIZE_PROFILE = "Small Size Profile";
const string FULL_OPT_PROFILE = "Full Options Profile";
const int PROFILE_IS_PUBLIC = 0;
const string PRINTER_NAME = "novaPDF for SDK v7";
NovaPdfOptionsClass mobjNovaOptios;
mobjNovaOptios = new NovaPdfOptionsClass();
mobjNovaOptios.Initialize(PRINTER_NAME, "", "", "");

mobjNovaOptios.SetOptionLong2(NovaOptions.NOVAPDF_SAVE_PROMPT, 0, SMALL_SIZE_PROFILE, PROFILE_IS_PUBLIC);
// set generated PDF file destination folder "c:\"
mobjNovaOptios.SetOptionString2(NovaOptions.NOVAPDF_SAVE_FOLDER, "d:\\", SMALL_SIZE_PROFILE, PROFILE_IS_PUBLIC);
mobjNovaOptios.SetOptionString2(NovaOptions.NOVAPDF_SAVE_FILE, "sample_nova.pdf", SMALL_SIZE_PROFILE, PROFILE_IS_PUBLIC);

I am invoking the print using
ExecWB(SHDocVw.OLECMDID.OLECMDID_PRINT, SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_DONTPROMPTUSER, ref pvaIn, ref pvaOut);

Even though now i am getting the save pdf file as dialog.
Kindly assit to resolve the issue.

Claudiu (Softland)
Posts: 283
Joined: Wed Dec 16, 2009 12:46 pm

Re: Disable ""SAVE PDF AS "" dialog .

Post by Claudiu (Softland) »

Hello,

You set the options in the "Small Size Profile" but you have to set this profile as the "active profile" before printing the document, so novaPDF printer knows that this profile should be use. The code should be like this:

// create the NovaPdfOptions object
NovaPdfOptions pNova = new NovaPdfOptions();
pNova.Initialize(PRINTER_NAME, "", "", "");
// mark start changing options
pNova.StartUpdateProfiles();
pNova.AddProfile(SMALL_SIZE_PROFILE, PROFILE_IS_PUBLIC);
mobjNovaOptios.SetOptionLong2(NovaOptions.NOVAPDF_SAVE_PROMPT, 0, SMALL_SIZE_PROFILE, PROFILE_IS_PUBLIC);
mobjNovaOptios.SetOptionString2(NovaOptions.NOVAPDF_SAVE_FOLDER, "d:\\", SMALL_SIZE_PROFILE, PROFILE_IS_PUBLIC);
mobjNovaOptios.SetOptionString2(NovaOptions.NOVAPDF_SAVE_FILE, "sample_nova.pdf", SMALL_SIZE_PROFILE, PROFILE_IS_PUBLIC);
//in case a file with the same name exists in the selected folder, choose what to do
pNova.SetOptionLong2(NovaOptions.NOVAPDF_SAVE_CONFLICT_STRATEGY, NovaOptions.FILE_CONFLICT_STRATEGY_AUTONUMBER_NEW, SMALL_SIZE_PROFILE, p_bIsPublic);
// set the copy profile as active profile ...
pNova.SetActiveProfile(PROFILE_NAME, PROFILE_IS_PUBLIC);
// mark finish changing options so they are saved for the printer
pNova.EndUpdateProfiles();
//print document
//....

Thank you.
Follow us to stay updated:

ramesh
Posts: 3
Joined: Tue Sep 20, 2011 12:13 pm

Re: Disable ""SAVE PDF AS "" dialog .

Post by ramesh »

Now I have modifield the code and set the active profile.
First time it works well then build the application second time it's not generate the pdf file and then I have commented all the below code and run the application once again.
Now its working fine.I can not change the path for each file, it save the pdf file what I have set the first time.
How to change the file location for each file.

const string PRINTER_NAME = "novaPDF for SDK v7";
const string SMALL_SIZE_PROFILE = "rpi1cob";
const int PROFILE_IS_PUBLIC = 0;
//NovaPdfOptions pNova = new NovaPdfOptions();
/* pNova.Initialize(PRINTER_NAME, "", "", "");
// mark start changing options
pNova.StartUpdateProfiles();
pNova.AddProfile(SMALL_SIZE_PROFILE, PROFILE_IS_PUBLIC);
pNova.SetOptionLong2(NovaOptions.NOVAPDF_SAVE_PROMPT, 0, SMALL_SIZE_PROFILE, PROFILE_IS_PUBLIC);
pNova.SetOptionString2(NovaOptions.NOVAPDF_SAVE_FOLDER, "D:\\downlaod\\one\\two\\three\\four", SMALL_SIZE_PROFILE, PROFILE_IS_PUBLIC);
pNova.SetOptionString2(NovaOptions.NOVAPDF_SAVE_FILE, "sample_nova.pdf", SMALL_SIZE_PROFILE, PROFILE_IS_PUBLIC);
//in case a file with the same name exists in the selected folder, choose what to do
pNova.SetOptionLong2(NovaOptions.NOVAPDF_SAVE_CONFLICT_STRATEGY, NovaOptions.FILE_CONFLICT_STRATEGY_AUTONUMBER_NEW, SMALL_SIZE_PROFILE, PROFILE_IS_PUBLIC);
// set the copy profile as active profile ...
pNova.SetActiveProfile("rpi1cob", PROFILE_IS_PUBLIC);
// mark finish changing options so they are saved for the printer
pNova.EndUpdateProfiles();

ramesh
Posts: 3
Joined: Tue Sep 20, 2011 12:13 pm

Re: Disable ""SAVE PDF AS "" dialog .

Post by ramesh »

const string PRINTER_NAME = "novaPDF for SDK v7";
const string SMALL_SIZE_PROFILE = "rpi1cob";
const int PROFILE_IS_PUBLIC = 1;
NovaPdfOptions pNova = new NovaPdfOptions();
pNova.Initialize(PRINTER_NAME, "", "", "");
// mark start changing options
pNova.StartUpdateProfiles();
pNova.AddProfile(SMALL_SIZE_PROFILE, PROFILE_IS_PUBLIC);
pNova.SetOptionLong2(NovaOptions.NOVAPDF_SAVE_PROMPT, 0, SMALL_SIZE_PROFILE, PROFILE_IS_PUBLIC);
pNova.SetOptionString2(NovaOptions.NOVAPDF_SAVE_FOLDER, "D:\\downlaod\\one\\two\\three\\four\\", SMALL_SIZE_PROFILE, PROFILE_IS_PUBLIC);
pNova.SetOptionString2(NovaOptions.NOVAPDF_SAVE_FILE, "sample_nova.pdf", SMALL_SIZE_PROFILE, PROFILE_IS_PUBLIC);
//in case a file with the same name exists in the selected folder, choose what to do
pNova.SetOptionLong2(NovaOptions.NOVAPDF_SAVE_CONFLICT_STRATEGY, NovaOptions.FILE_CONFLICT_STRATEGY_AUTONUMBER_NEW, SMALL_SIZE_PROFILE, PROFILE_IS_PUBLIC);
// set the copy profile as active profile ...
pNova.SetActiveProfile("rpi1cob", PROFILE_IS_PUBLIC);
// mark finish changing options so they are saved for the printer
pNova.EndUpdateProfiles();

With out the above code application generate the pdf file and save the first time given location.
When uncomment the code it will not generate the pdf.

Claudiu (Softland)
Posts: 283
Joined: Wed Dec 16, 2009 12:46 pm

Re: Disable ""SAVE PDF AS "" dialog .

Post by Claudiu (Softland) »

Hello,

You need the code to set novaPDF options if you wish to change the settings (folder) each time you generate a profile file.
This code is working fine in our samples, I strongly recommend you open and study our C# "Hello World" sample and the Integration chapter in novaPDF SDK help file to understand how to integrate novaPDF in your application.
If the PDF file is not generated when you run your application second time, it means there is an exception. Catch the exceptions and see what error code is returned, that will be an indication where to look for the problem.
As general rules, create only one instance of NovaPdfOptions object, when application starts, and delete it when application exists. For profiles management, you either create it only once, either create it each time and delete it after you print. If you call AddProfile with a profile name that already exists, there will be raised an exception. You may also work directly with the "Default Profile" profile which you do not need to create or delete, just set the options there. All these are exmplified in the Hello World sample.
If you still cannot figure out how to use novaPDF in your application, please send your source code related to novaPDF usage and printing to novaPDF printer to [email protected] and we will check it.

Thank you.
Follow us to stay updated:

Post Reply