An interesting question. As far as I know, this cannot be done in a direct fashion, but it should be able to fake it out with a little finesse. By making use of the ATTR_EJECT_AFTER print attribute, we can simulate a form feed by using multiple calls to PrintTextBuffer. All that remains is to read the file and search out the form feed characters and remove them and then print the intervening text with ATTR_EJECT_AFTER turned on. I haven't tested this but it seems like it should work. Here is the code I hammered out for this:
void PrintTextFileWithFFChar (const char filename[], char outputFile[], char ffChar)
{
int oldEject, done = 0, size;
char buffer[1025] = { 0 }, *ptr, *ffLoc;
FILE *file;
if ((file = fopen (filename, "rb")) == NULL)
return;
GetPrintAttribute (ATTR_EJECT_AFTER, &oldEject);
SetPrintAttribute (ATTR_EJECT_AFTER, 0);
while (!done && (size = fread (buffer, 1, sizeof(buffer) - 1, file)) > 0)
{
ptr = buffer;
buffer[size] = '\0';
SetPrintAttribute (ATTR_EJECT_AFTER, 1);
while ((ffLoc = strchr (ptr, ffChar)) != NULL)
{
*ffLoc = '\0';
PrintTextBuffer (ptr, outputFile);
ptr = ffLoc + 1;
}
if (feof (file))
{
SetPrintAttribute (ATTR_EJECT_AFTER, oldEject);
done = 1;
}
else
SetPrintAttribute (ATTR_EJECT_AFTER, 0);
PrintTextBuffer (ptr, outputFile);
}
fclose(file);
}
You invoke it as usual, but specifying the character that is used to indicate a form feed (12 in ASCII, I belive).
Like so:
PrintTextFileWithFFChar ("file.txt", "", 12);
Hope this helps...
Regards,
-alex