Note: To be able to use the samples you must install novaPDF SDK
as samples work only with it. Download it here: nova PDF SDK.
The VBNet Converter sample demonstrates how to convert an existing file by printing it to novaPDF Printer using the ShellExecute function. It also demonstrates how to set different options and manage profiles. The same approach should be used if you print using a "Print()" method from another object (like an internet browser or a report control). Just replace the ShellExecute call with the call of your Print method. When the application starts, it creates a few profiles and makes different settings in the profiles. Then it shows a dialog from where the user can select the active profile and change its settings using the controls from the dialog. After that a document can be selected from the harddisk and printed to novaPDF Printer using the ShellExecute function call. When using this technique to convert a file to PDF, you have to take care of the fact that ShellExecute prints to the default printer. This function returns immediately and does not wait until the print is finished (it may return before the printing is actually started). Therefore you have to set the default printer to novaPDF Printer before calling ShellExecute (using the SetDefaultPrinter method), wait the process to be started (using WaitForExit()), restore the default printer (with the RestoreDefaultPrinter method). This way you made sure that the default printer was restored and your document is printed to novaPDF Printer. Source Code Snippets
1. Declare INovaPdfOptions variable Private mobjNovaOptios As NovaPdfOptionsClass 2. Initialize INovaPdfOptions mobjNovaOptios = New NovaPdfOptionsClass ' initialize the NovaPdfOptions object AddSmallProfile() 3. Set novaPDF Printer Options Try mobjNovaOptios.SetOptionLong2(NovaOptions.NOVAPDF_SAVE_PROMPT, 1, SMALL_SIZE_PROFILE, PROFILE_IS_PUBLIC) Catch ComException As System.Runtime.InteropServices.COMException
4. Start a print job Private Sub btnStartPrinting_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStartPrinting.Click UpdateProfileFromDialog() |
Add comment


