Duplex Printing - New Thought

If I put blank pages in a document to handle duplexing - meaning that if I DON’T want duplexing when a duplex printer is printing, I would make every odd page a blank page. But I actually combine all these docs into a pdf later and want the blank pages removed. What would be a clever way to build a Word doc by hand, putting the blank pages in by hand, but later removing all blank pages in a combined Word doc? In my Word doc I would make every blank page its own section, and then when removing the pages, I am hoping the header/footer stuff would line up properly because EVERY page does have its own section. Do you have code that might do this, remove blank pages?
Derek

Hi
I think that you can find solution here.
best regards.

OK, I am using the following code:

Dim doc As Document = New Document("c:\test.doc")
Dim list As System.Collections.ArrayList = New System.Collections.ArrayList()
Dim firstSection As Section = doc.FirstSection
Dim section As Section = Nothing
For Each section In doc.Sections
If (section.PageSetup.SectionStart = SectionStart.NewPage) And (Not section.Equals(firstSection)) Then
list.Add(section)
firstSection.AppendContent(section)
Else
firstSection = section
End If
Next
section = Nothing
For Each section In list
doc.RemoveChild(section)
Next
doc.Save("c:\testout.doc")

I am not sure of the best way to create my document so blank pages are removed. I will have a separate section for each page. Should I have a section break and a manual page break. What is the method to use so the above code will remove blank pages?

Also, I could possibly put some kind of bookmark and/or merge field on the blank page to know to delete it. What do you think?

Hi
Yes, I think you can use bookmarks. See the following code.

Document doc = new Document(@"252_99030_derekmhart@yahoo.com\in.doc");
DocumentBuilder builder = new DocumentBuilder(doc);
foreach (Bookmark bookmark in doc.Range.Bookmarks)
{
    if (bookmark.Name.Contains("remove"))
    {
        builder.MoveToBookmark(bookmark.Name);
        builder.CurrentSection.Remove();
    }
}
doc.Save(@"252_99030_derekmhart@yahoo.com\out.doc");

I used names of bookmarks like the following “remobe_1”, “remove_2”…
Best regards.

OK, I am contatenating documents together, and would need to get clever to create different bookmark names. And if I use a merge field that will be problematic also because I print out the docs, and then convert to pdf, and cannot have the empty merge fields in the document. Any other type of placeholder that could be placed onto the blank page that is always the same?
Derek

Not sure if I can use a field for this somehow and use the code in <A href=" to find some kind of field to remove the blank pages. Am I on the right track?

Hi
I think you can try to use this. Also find text and remove section is a good way to achieve this. See the following link
Best regards.