Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

WPF Printing -- how do I print text so print driver recognizes it as TEXT

$
0
0

I have a print application (in WPF/VB.NET) that uses the following method (boiled down sample) to print:

<pre>
        Dim fd As New FixedDocument()
        Dim pc As New PageContent()
        Dim fp As New FixedPage()

        Dim tb As TextBlock = New TextBlock
        tb.Text = "TEST TEXT, ON K PLANE?"
        tb.FontFamily = New System.Windows.Media.FontFamily("Arial")
        tb.FontStyle = FontStyles.Normal
        tb.FontSize = 32
        tb.FontWeight = FontWeights.Bold
        tb.Foreground = Brushes.Black

        'add the text box to the FixedPage
        fp.Children.Add(tb)
        'add the FixedPage to the PageContent 
        pc.Child = fp
        'add the PageContent to the FixedDocument
        fd.Pages.Add(pc)

        Dim printDialog As New PrintDialog()
        printDialog.PrintDocument(fd.DocumentPaginator, "NB Card Print Job")

</pre>

The problem is, it does NOT print the text as a TEXT object; it is encapsulated such that the printer doesn't recognize it as text. So, how can I print text such that the printer driver recognizes that text is present?

I am able to get text to the K Plane* using System.Drawing.Printing in a WinForms app, but I cannot use WinForms because I have to support OpenType fonts.

My Requirements:
-- must have duplex printing
-- must be able to support OpenType font families (as well as TrueType)
-- must be able to print images and vector graphics
-- must have robust text formatting capabilities

*In case it helps to know why: Printing to the K Plane
I have a print application that is used to print to a card printer with an overlay ribbon. Simply put, it has a special ribbon for printing certain things, usually text, in carbon black with what they call the K Plane. To get this to work in the typical way, you have to send text objects to the printer.

Thanks!


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>