Document Orientation (document rotation)

When printing a document, is there a way to rotate the entire document by 180 degrees? Some printer drivers have this option but is there a way to rotate programmatically.

Hi
Thanks for your request. Maybe, in your case, you can just specify orientation of pages in your document. Please follow the link for more information:
https://reference.aspose.com/words/net/aspose.words/pagesetup/orientation/
Best regards,

Setting the landscape or portrait orientation will no solve the issue. I need the document to print 180 degrees of its original orientation.
So back to the original question. Once the orientation has been selected, either portrait or landscape, is there a way to programmatically rotate the entire print job 180 degrees. So if the printer normally prints the head first then the tail, I need it to print the tail first and then the head. (this is need because of some special issues with certain labels).

Hi
Thanks for your request. Unfortunately, I do not see a direct way to achieve this. However, you can try converting the document to a series of images and then rotate the images before printing. Please let me know if you need a code example how to achieve this.
Best regards,

A code sample would be GREAT! Look forward to it.

Hi
Thanks for your request. Please see the following code example:

[Test]
public void Test001()
{
    // Open source document.
    Document doc = new Document(@"Test001\in.doc");
    // Save the document as an image.
    using (MemoryStream imageStream = new MemoryStream())
    {
        doc.Save(imageStream, SaveFormat.Tiff);
        // Load the image back into another document and rotate the images.
        imageStream.Position = 0;
        Document imageDoc = LoadImage(imageStream);
        // Print the document.
        imageDoc.Print();
    }
}

///
/// Loads an image into Aspose.Words.Document object and rotates the image to 180 degrees.
///
/// Stream with an image.
public Document LoadImage(Stream inputStream)
{
    // Create Aspose.Words.Document and DocumentBuilder.
    // The builder makes it simple to add content to the document.
    Document doc = new Document();
    DocumentBuilder builder = new DocumentBuilder(doc);
    // Read the image from file, ensure it is disposed.
    using (Image image = Image.FromStream(inputStream))
    {
        // Get the number of frames in the image.
        int framesCount = image.GetFrameCount(FrameDimension.Page);
        // Loop through all frames.
        for (int frameIdx = 0; frameIdx < framesCount; frameIdx++)
        {
            // Insert a section break before each new page, in case of a multi-frame TIFF.
            if (frameIdx != 0)
                builder.InsertBreak(BreakType.SectionBreakNewPage);
            // Select active frame.
            image.SelectActiveFrame(FrameDimension.Page, frameIdx);
            // We want the size of the page to be the same as the size of the image.
            // Convert pixels to points to size the page to the actual image size.
            PageSetup ps = builder.PageSetup;
            ps.PageWidth = ConvertUtil.PixelToPoint(image.Width, image.HorizontalResolution);
            ps.PageHeight = ConvertUtil.PixelToPoint(image.Height, image.VerticalResolution);
            // Insert the image into the document and position it at the top left corner of the page.
            Shape shape = builder.InsertImage(image,
                RelativeHorizontalPosition.Page,
                0,
                RelativeVerticalPosition.Page,
                0,
                ps.PageWidth,
                ps.PageHeight,
                WrapType.None);
            // Rotate the image.
            shape.Rotation = 180;
        }
    }
    return doc;
}

Hope this helps.
Best regards,