ActiveFax characters not recognized by fax printer in Aspose Document


#1

Hi,

I’m trying to use Aspose.Words for automation of a mail merge fax job.

The problem is as follows: For the fax programm to understand what to do with the document, I insert a control string at the very beginning of the document, which contains the fax number and name of the sender and the fax number of the receiver. This String needs to be formatted with a Font name ActiveFax for the Fax Printer to understand that these are control characters. After having inserted the string and done mail merging I print to the fax printer.

Unfortunately for some unknown reason the Font formatting doesn't work. The characters get printed as if they were normal characters.

Now the funny bit:

If I programmatically save the produced document from within my program and then manually open and print it from MS Word, everything is okay.

Here the two methods I use:

public void PrepareForActiveFax(DateTime ScheduledDate, int FaxResolution) {

DocumentBuilder builder = new DocumentBuilder(wordDoc);

builder.MoveToDocumentStart();

builder.PushFont();

builder.Font.Name = "ActiveFax";

builder.Font.Size = 2.0;

builder.Font.Color = System.Drawing.Color.Black;

builder.Write(this.NewFax);

builder.Write(" ");

builder.Write(this.InitStringWord);

//FaxNumber

builder.Write(" @F211 ");

if(cnf.Services.FaxMakerService.IsDemo)

builder.Write(cnf.Services.FaxMakerService.DemoFaxNumber);

else

builder.InsertField("MERGEFIELD FaxNr \\* MERGEFORMAT", "");

builder.Write("@ ");

//FaxReference

builder.Write("@F307 ");

builder.InsertField("MERGEFIELD REF \\* MERGEFORMAT", "");

builder.Write("@ ");

//FaxBundleItemID (Kostenstelle)

builder.Write("@F315 ");

builder.InsertField("MERGEFIELD BundleId \\* MERGEFORMAT", "");

builder.Write("/");

builder.InsertField("MERGEFIELD ItemId \\* MERGEFORMAT", "");

builder.Write("@ ");

builder.PopFont();

}

public void Fax() {

Document curDoc;

DocumentRenderer rdr = new DocumentRenderer();

int firstRecord = 1;

int lastRecord = 0;

string curDocPath =

cnf.Services.FaxMakerService.DocFolder + "\\Current.doc";

wordDoc.Save(curDocPath);

int maxItems = cnf.Services.FaxMakerService.MaxFaxItemsPerPrintFile;

if(maxItems == 0)

maxItems = this.FaxItemsCount;

if(this.FaxItemsCount > maxItems)

lastRecord = maxItems;

else

lastRecord = this.FaxItemsCount;

while(firstRecord <= this.FaxItemsCount) {

this.GetFaxItems(firstRecord, lastRecord);

curDoc = new Document(curDocPath);

curDoc.MailMerge.RemoveEmptyParagraphs = true;

curDoc.MailMerge.Execute(tblFaxReceivers);

curDoc.Save(cnf.Services.FaxMakerService.DocFolder + "\\Merged.doc");

rdr = new DocumentRenderer();

rdr.PrinterSettings.PrinterName = "ActiveFax";

rdr.Document = new Document(cnf.Services.FaxMakerService.DocFolder + "\\Merged.doc");

rdr.Print();

firstRecord += maxItems;

lastRecord += maxItems;

if(lastRecord > this.FaxItemsCount)

lastRecord = this.FaxItemsCount;

}

}


#2

Please attach some document samples as well. It will help me to understand the problem better.


#3

Hope it (attaching the docs) worked.


#4

Here is an easier example:

If I open the attached document with MS Word and print it to the ActiveFax printer the text formatted with the ActiveFax font that is placed between your two watermarks gets treated correctly as a control string and the fax parameters included in this text get passed correctly to the fax app.

If I use the following four lines of code to print the document to the FaxPrinter

DocumentRenderer rdr = new DocumentRenderer();
rdr.PrinterSettings.PrinterName = "ActiveFax";
rdr.Document = new Document(@"D:\ConvFax\FaxDocs\Merged.doc");
rdr.Print();

the text gets treated as if it were fomatted with Times New Roman and so the control characters are ignored and instead get printed as normal text.

I'm using the demo version of Aspose.Words. Can it be, that during print out something else gets inserted in the doc, that messes with it. I could try for myself, but spending 900 bucks to find out that it doesn't work, would be a bit risky, don't you aggree.


#5

Thanks for the additional info. The problem is that Aspose.Words.Viewer that you are trying to use for printing is in beta and not supported right now. We are preparing the release of new Aspose.Words layout engine which will provide much better printing capabilities. It will be published in a few months, the exact release date is not set yet.

So right now Aspose.Words does not provide any reliable printing capabilities. It can only be used for document creation, manipulation and data merging.

Best regards,


#6

Thx. for the answer.

If I saved the document as PDF, would Aspose.PDf or Aspose.PDFKit offer a reliable printing method?


#7

I have moved your question to Aspose.Pdf forum. They will privide you a qualified answer soon.


#8

Thanks for considering Aspose.

In current release, Aspose.Pdf.Kit provide a printing method, please refer to online wiki:

http://www.aspose.com/wiki/default.aspx/Aspose.Pdf.Kit/PdfViewer.html

But like Aspose.Words, the printing effection are still under improvement and a new version PdfViewer will be published a few month later.