Book Fold printing doesn't seem to be working

I’m using version 17.1.0, and I’m trying to get the MultiplePagesType.BookFoldPrinting feature working for me.

What I’m finding is the result seems to be a document with corrupt unfixable margins.

Using the code below, I get a document (aspose.docx), which you can see is not in book fold format, and also has invalid margins.

I’ve also attached a manually created document (manual.docx) to show what I’m trying to get the code to do. To compliment this, I’ve also attached a screen shot (page setup.png) to show you the page setup options of the manual document which I’m trying to emulate using Aspose.

Do you know what I’m missing here? Can you please provide sample code that emulates my manual document?

I’m looking to upgrade from a prior version to the newest version, as my current version does not support book fold printing.

I’m also using Word 2013.

var document = new Document();
var builder = new DocumentBuilder(document);

var license = new License();
license.SetLicense("Aspose.Words.lic");
builder.PageSetup.Orientation = Orientation.Landscape;
builder.PageSetup.Gutter = 36;
builder.PageSetup.MultiplePages = MultiplePagesType.BookFoldPrinting;
builder.PageSetup.LeftMargin = 72;

for (int i = 0; i < 100; i++)
{
     builder.Writeln("XXXXXXXXXXXXXXXXXXX");
}
document.Save(@"c:\temp\aspose.docx");

Hi Vaughn,

Thanks for your inquiry. We tested the scenario and have managed to reproduce the same problem on our end. For the sake of any correction, we have logged this problem in our issue tracking system as WORDSNET-14848. 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 your inconvenience.

Best regards,

Hi,

Thanks for being patient.

Regarding WORDSNET-14848, our product team has completed the work on your issue and has come to a conclusion that this issue is not a bug in Aspose.Words. The problem occurs because when you set Orientation, width and height are also changed. Please set Page size manually.

The following code produces the expected result.

var document = new Document();
var builder = new DocumentBuilder(document);
builder.PageSetup.MultiplePages = MultiplePagesType.BookFoldPrinting;
builder.PageSetup.Orientation = Orientation.Landscape;
// Set Page size manually.
builder.PageSetup.PageHeight = 612;
builder.PageSetup.PageWidth = 396;
builder.PageSetup.Gutter = 36;
builder.PageSetup.LeftMargin = 72;
builder.PageSetup.RightMargin = 36;
builder.PageSetup.TopMargin = 36;
builder.PageSetup.BottomMargin = 36;
for (int i = 0; i < 100; i++)
{
    builder.Writeln("XXXXXXXXXXXXXXXXXXX");
}
document.Save(MyDir + @"17.3.0.docx");

Hope, this helps.

Best regards,