Welcome Guest Search | Active Topics | Sign In | Register

Rotate page/document Options
K. Zimny
Posted: Monday, June 15, 2015 5:32:22 AM
Rank: Member
Groups: Member

Joined: 8/4/2014
Posts: 11
how to rotate the pdf document (or a page, because my document contains only one page) 180 degrees?

Code: C#
PdfDocument doc = new PdfDocument();
            HtmlToPdfResult result = HtmlToPdf.ConvertHtml(sCoursePlan, doc);
            EO.Pdf.Drawing.PdfMatrix matrix = new EO.Pdf.Drawing.PdfMatrix();
            //matrix.FlipY(); // doesn't work
            matrix.Rotate(180); // doesn't work
            doc.Pages[0].Transform(matrix);

            MemoryStream memory;
            using (memory = new MemoryStream())
            {
                doc.Save(memory);
            }


after rotation the page is empty. No idea why...
eo_support
Posted: Monday, June 15, 2015 11:22:56 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,229
Hi,

You need to do a rotate and a translate for this case. When you rotate, you are rotating the page around the bottom left corner. So once you rotate the page 180 degrees, you actually have rotated the whole page out of view because your original page rectangle of (0, 0, width, height) now becomes (-width, -height, 0, 0). In order to move that rectangle into visible area (both x and y must be positive in visible area). You must do a translate (width, height) so that the visible rectangle becomes (0, 0, width, height) again.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.