FieldPrint not recognized correctly when printing

Hi Aspose Team,

we are having some trouble with printer commands when printing using Aspose.Words.

For highly complex workflow purposes, we need to place some control data inside of a field of type “Print”. After sending such a document to a PCL aware printer, this control data needs to remain “readable” in the resulting PCL output stream. When printing with MS Word, everything is Ok. But if we print from Aspose the output doesn’t contain the field code anymore.

Do you have any idea, whats going wrong here?

Please find attached the Word doc created with the code above, in addition the PCL output files, one from Aspose, the other created with printing from Word.

Any help will be highly appreciated!


And here is the code we used for testing an generating the attached files:

static string s_sDir = @“C:\Users\Helm\Testfiles”;
static string s_sOutputfile = s_sDir + “out.docx”;
static string s_sPCLfile = s_sDir + “pcl_from_aspose.txt”;

// The printer command:
static string s_sFieldcode = “PRINT \027”*v1T QXQY_PLZ:22222\r"
+ “QXQY_LKZ:2\r”
+ “QXQY_DOKID:2\r”
+ “QXQY_SORT-ID:2\r”
+ “QXQY_VERMNR:003600-222 “\027”*v0T”";

private static void _TestWithFields()
Document doc = new Document();

DocumentBuilder builder = new DocumentBuilder(doc);
builder.Writeln(“A first line!”);
builder.Writeln("And now a print field: ");


NodeCollection nodes = doc.GetChildNodes(NodeType.FieldStart, true);
foreach (FieldStart start in nodes)
if (start.FieldType == Aspose.Words.Fields.FieldType.FieldPrint)

// Print directly from Aspose
_Print(doc, s_sPCLfile);

// Save it for tests with Word

private static void _Print(Document doc, string sFileToPrintInto)
PrinterSettings ps = new PrinterSettings();
ps.PrinterName = “PCL-Drucker”;

if( String.Empty != sFileToPrintInto )
ps.PrintToFile = true;
ps.PrintFileName = sFileToPrintInto;


private static string GetFieldCode(Aspose.Words.Fields.FieldStart fieldStart)
StringBuilder builder = new StringBuilder();

for (Node node = fieldStart; node != null && node.NodeType != NodeType.FieldSeparator && node.NodeType != NodeType.FieldEnd; node = node.NextPreOrder(node.Document))
// Use the text only of Run nodes to avoid duplication.
if (node.NodeType == NodeType.Run)
return builder.ToString();


Thanks for your inquiry. We have logged this problem in our issue tracking system as WORDSNET-13867. Our product team will further look into the details of this problem and we will keep you updated on the status of this issue. We apologize for any inconvenience.

Best regards,
Hi Christof,

It is to update you that our product team has completed the analysis of this issue. The text of the field is not represented in the APS model of Aspose.Words. And even if it will be, we are not sure we can pass this info to the printer. .Net framework allows only to draw content on Graphics object. Then framework translates this object to printer commands. So if we write field text as string to Graphics object, it will be just printed on the paper.

On the other hand MS Word sends commands directly to printer (

It is possible to send raw data o the printer ( But in this case we have to create whole content of the document what is unacceptable (and use unmanaged code).

Unfortunately, we see nothing we can do for your scenario because of .Net framework printing area limitations.

As a workaround please save documents in PostScript format. If this will be acceptable solution, we think we may find a way to insert field content in the output PostScript file.

Best regards,

Thanks a lot for your affords to look into this!

Unfortunately, since subsequents processes rely on getting the document output as PCL, saving the documents in PS is probably not an option.
For now we will continue printing the documents using MS Word automation.

Kind regards,

Hi Christof,

Thanks for your inquiry. We will keep you informed of any further developments on this issue.

Best regards,