public class FieldPrint extends Field
To learn more, visit the Working with Fields documentation article.
Remarks:
An instruction to send the printer-specific control code characters to the selected printer when the document is printed.
Examples:
Shows to insert a PRINT field.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.write("My paragraph");
// The PRINT field can send instructions to the printer.
FieldPrint field = (FieldPrint) builder.insertField(FieldType.FIELD_PRINT, true);
// Set the area for the printer to perform instructions over.
// In this case, it will be the paragraph that contains our PRINT field.
field.setPostScriptGroup("para");
// When we use a printer that supports PostScript to print our document,
// this command will turn the entire area that we specified in "field.PostScriptGroup" white.
field.setPrinterInstructions("erasepage");
Assert.assertEquals(" PRINT erasepage \\p para", field.getFieldCode());
doc.updateFields();
doc.save(getArtifactsDir() + "Field.PRINT.docx");
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getPostScriptGroup()
Gets the drawing rectangle that the PostScript instructions operate on.
|
java.lang.String |
getPrinterInstructions()
Gets the printer-specific control code characters or PostScript instructions.
|
int |
getSwitchType(java.lang.String switchName) |
void |
setPostScriptGroup(java.lang.String value)
Sets the drawing rectangle that the PostScript instructions operate on.
|
void |
setPrinterInstructions(java.lang.String value)
Sets the printer-specific control code characters or PostScript instructions.
|
getDisplayResult, getEnd, getFieldCode, getFieldCode, getFormat, getLocaleId, getResult, getSeparator, getStart, getType, isDirty, isDirty, isLocked, isLocked, needStoreOldResultNodes, remove, setLocaleId, setResult, unlink, update, updatepublic java.lang.String getPrinterInstructions()
Examples:
Shows to insert a PRINT field.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.write("My paragraph");
// The PRINT field can send instructions to the printer.
FieldPrint field = (FieldPrint) builder.insertField(FieldType.FIELD_PRINT, true);
// Set the area for the printer to perform instructions over.
// In this case, it will be the paragraph that contains our PRINT field.
field.setPostScriptGroup("para");
// When we use a printer that supports PostScript to print our document,
// this command will turn the entire area that we specified in "field.PostScriptGroup" white.
field.setPrinterInstructions("erasepage");
Assert.assertEquals(" PRINT erasepage \\p para", field.getFieldCode());
doc.updateFields();
doc.save(getArtifactsDir() + "Field.PRINT.docx");
public void setPrinterInstructions(java.lang.String value)
throws java.lang.Exception
Examples:
Shows to insert a PRINT field.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.write("My paragraph");
// The PRINT field can send instructions to the printer.
FieldPrint field = (FieldPrint) builder.insertField(FieldType.FIELD_PRINT, true);
// Set the area for the printer to perform instructions over.
// In this case, it will be the paragraph that contains our PRINT field.
field.setPostScriptGroup("para");
// When we use a printer that supports PostScript to print our document,
// this command will turn the entire area that we specified in "field.PostScriptGroup" white.
field.setPrinterInstructions("erasepage");
Assert.assertEquals(" PRINT erasepage \\p para", field.getFieldCode());
doc.updateFields();
doc.save(getArtifactsDir() + "Field.PRINT.docx");
value - The printer-specific control code characters or PostScript instructions.java.lang.Exceptionpublic java.lang.String getPostScriptGroup()
Examples:
Shows to insert a PRINT field.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.write("My paragraph");
// The PRINT field can send instructions to the printer.
FieldPrint field = (FieldPrint) builder.insertField(FieldType.FIELD_PRINT, true);
// Set the area for the printer to perform instructions over.
// In this case, it will be the paragraph that contains our PRINT field.
field.setPostScriptGroup("para");
// When we use a printer that supports PostScript to print our document,
// this command will turn the entire area that we specified in "field.PostScriptGroup" white.
field.setPrinterInstructions("erasepage");
Assert.assertEquals(" PRINT erasepage \\p para", field.getFieldCode());
doc.updateFields();
doc.save(getArtifactsDir() + "Field.PRINT.docx");
public void setPostScriptGroup(java.lang.String value)
throws java.lang.Exception
Examples:
Shows to insert a PRINT field.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.write("My paragraph");
// The PRINT field can send instructions to the printer.
FieldPrint field = (FieldPrint) builder.insertField(FieldType.FIELD_PRINT, true);
// Set the area for the printer to perform instructions over.
// In this case, it will be the paragraph that contains our PRINT field.
field.setPostScriptGroup("para");
// When we use a printer that supports PostScript to print our document,
// this command will turn the entire area that we specified in "field.PostScriptGroup" white.
field.setPrinterInstructions("erasepage");
Assert.assertEquals(" PRINT erasepage \\p para", field.getFieldCode());
doc.updateFields();
doc.save(getArtifactsDir() + "Field.PRINT.docx");
value - The drawing rectangle that the PostScript instructions operate on.java.lang.Exceptionpublic int getSwitchType(java.lang.String switchName)