PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Tue Aug 14, 2018 1:45 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: Fri Nov 14, 2014 1:38 am 
Offline

Joined: Fri Nov 14, 2014 1:14 am
Posts: 4
Hi All,

I am making a report with only migradoc

My question is how do I make the last page rotate 90 degree and put 2 pages as 1 like the image below.
Also if there is too much data, I also want to create a new page and rotate 90 degree and start from the top left again.
Any Idea?

I am also confuse on how pdfsharp and migradoc working together.

Image
http://postimg.org/image/mr37lxi9b/

Tony

Update I got it show in the report, but my 2nd page is on top of the 1st page.
Here is my code.

Code:
            Document doc =  CreateDocSectionIII(ImagePath, "");
            DocumentRenderer SectiondocRenderer = new DocumentRenderer(doc);

            SectiondocRenderer.PrepareDocument();
           
            XRect A4Rect = new XRect();
           
            int pageCount = SectiondocRenderer.FormattedDocument.PageCount;

            for (int idx = 0; idx < pageCount; idx+=2)
            {
                PdfPage page = renderer.PdfDocument.AddPage();

                page.Width += page.Width;

                double width = page.Width;
                double height = page.Height;

                //page.Rotate = 90;
                //int rotate = page.Elements.GetInteger("/Rotate");

                XGraphics gfx = XGraphics.FromPdfPage(page);
               
                // HACKĀ²
                gfx.MUH = PdfFontEncoding.Unicode;
                gfx.MFEH = PdfFontEmbedding.Default;

                A4Rect = new XRect(0, 0, width/2, height);
                 
                // Use BeginContainer / EndContainer for simplicity only. You can naturaly use you own transformations.
                XGraphicsContainer container = gfx.BeginContainer(A4Rect, A4Rect, XGraphicsUnit.Point);
                 
                // Draw page border for better visual representation
                gfx.DrawRectangle(XPens.LightGray, A4Rect);
                 
                // Render the page. Note that page numbers start with 1.
                SectiondocRenderer.RenderPage(gfx, idx + 1);
               
                // Pop the previous graphical state
                gfx.EndContainer(container);

                if (idx + 1 < pageCount)
                {
                    A4Rect = new XRect(width / 2, 0, width / 2, height);

                    container = gfx.BeginContainer(A4Rect, A4Rect, XGraphicsUnit.Point);

                    // Draw page border for better visual representation
                    gfx.DrawRectangle(XPens.LightGray, A4Rect);


                    //DocumentObject[] docObjects = SectiondocRenderer.GetDocumentObjectsFromPage(idx + 1);
                    //for (int lol = 0; lol < docObjects.Count(); lol++)
                    //{
                    //    SectiondocRenderer.RenderObject(gfx, width / 2,0, width/2, docObjects[lol]);
                    //}

                    SectiondocRenderer.RenderPage(gfx, idx + 2);

                    // Pop the previous graphical state
                    gfx.EndContainer(container);
                }
            }


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group