Consider the LEADTOOLS Virtual Printer SDK (https://www.leadtools.com/sdk/print/virtual-printer) which you can use to create a virtual printer that captures the EMF file from printing from any valid Windows application. You can then use this EMF output to
generate your desired PDF output.
(Disclaimer: I am an employee of this toolkit’s vendor)
The code for handling the captured EMF and saving it as PDF would look like this:
// Write the EMF as file to disk as PDF.
static void VirtualPrinter_EmfEvent( object sender, EmfEventArgs e )
{
string pdfPath = "Output.pdf";
// Create an instance of the LEADTOOLS DocumentWriter
DocumentWriter docWriter = new DocumentWriter();
docWriter.BeginDocument( pdfPath, DocumentFormat.Pdf );
DocumentEmfPage page = new DocumentEmfPage()
{
EmfHandle = new Metafile( e.Stream ) )
.GetHenhmetafile()
};
docWriter.AddPage( page );
docWriter.EndDocument();
}