Trying to print PDF to a virtaul printer for text extraction


We have a problem printing a specific pdf file to the BlackIce printer driver (

It has an option to extract text from the printed document, however the text would come out all garbled or blank.

After some testing we realised we get the same issue printing directly from Acrobat and other viewers.

We also tried another pdf printing software and the way the print seems to get around this issue. They have an option to embed fonts or to use System Fonts. From my limited understanding or pdf structure I was under the impression that this means the fonts used in the PDF document can be stored in the PDF or in the case of using system fonts it will always try to look for the fonts in the local system.

Currently our printing code looks like this which comes mostly from your PDFPrint sample

private void PrintPdf(MemoryStream pdfFS, int rawKind, PrinterItem pi)


_pdfdoc = new PDFDoc(pdfFS);


PrinterMode printerMode = new PrinterMode();





// printerMode.SetUseRleImageCompression(true);

// printerMode.SetDPI(300); // regardless of ordering, an explicit DPI setting overrides the OutputQuality setting


printerMode.SetNUp(PrinterMode.NUp.e_NUp_1_1, PrinterMode.NUpPageOrder.e_PageOrder_LeftToRightThenTopToBottom);



// If the XPS print path is being used, then the printer spooler file will

// ignore the grayscale option and be in full color





PageSet pagesToPrint = new PageSet(1, _pdfdoc.GetPageCount(), PageSet.Filter.e_all);

Print.StartPrintJob(_pdfdoc, _Factory.PrintConfigSetting.printerName, _pdfdoc.GetFileName(), “”, pagesToPrint, printerMode);


A: Is there a specific way why you are going down this convoluted way to extract text from PDF? A far sampler and more reliable option would be to use ‘pdftron.PDF.TextExtractor’ as shown in TextExtractor sample (

Printing a PDF file via printer driver is not guaranteed to maintain Unicode encoding. Printing PDF with system fonts may preserve Unicode encoding but will result in incorrect print output for many/most documents.