Please enable JavaScript to view this site.

Navigation: Developer Information

Windows Printer Interface

Scroll Prev Top Next More

Win2PDF interfaces with an application using standard Windows printer APIs.  Whenever possible, Win2PDF uses standard Windows APIs instead of defining new interfaces.  You can print to the Win2PDF printer just like a paper printer, and control page size, resolution, and orientation using standard APIs.

 

You can set the PDF file name from VB.NET or C# using the .NET framework Printersettings.PrintFileName property as documented by Microsoft at:

 

https://docs.microsoft.com/en-us/dotnet/api/system.drawing.printing.printersettings.printfilename

 

You should also set the PrinterSettings.PrintToFile property to TRUE:

 

PrintDocument.PrinterSettings.PrintFileName = "C:\Users\test\AppData\Local\Temp\aFile.pdf"

PrintDocument.PrinterSettings.PrintToFile = true;

 

If you are a Win32 software developer and are developing an application that uses Win2PDF, you can also control the output filename using the standard Win32 API. To specify the file name you need to use the Microsoft defined DOCINFO structure and the StartDoc function. Set the lpszOutput field of the DOCINFO structure to the fully qualified path name of the file, and then pass the DOCINFO structure to the Win32 StartDoc function. Using this method, each file can be created using a unique name.

 

You can control the orientation, resolution, and other settings using the Win32 API and the DEVMODE structure as defined in the Microsoft Platform SDK.  The Microsoft article at:

https://support.microsoft.com/en-us/help/167345/how-to-modify-printer-settings-with-the-documentproperties-function

describes how to change printer settings using the Win32 API.