PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

Multipage not coming
https://forum.pdfsharp.net/viewtopic.php?f=2&t=1303
Page 1 of 1

Author:  rajaselvaraju [ Tue Aug 24, 2010 10:42 am ]
Post subject:  Multipage not coming

hi,

I have some data it is coming based on some query. It will be one page or more than on page. Now the data printed only one page. 2nd and 3rd..etc page not printing.

Thanks,
Raja S

Author:  () => true [ Tue Aug 24, 2010 11:23 am ]
Post subject:  Re: Multipage not coming

Hi!
rajaselvaraju wrote:
2nd and 3rd..etc page not printing.

Probably an error in your code.

How are you printing?

Author:  rajaselvaraju [ Tue Aug 24, 2010 12:05 pm ]
Post subject:  Re: Multipage not coming

() => true wrote:
Hi!
rajaselvaraju wrote:
2nd and 3rd..etc page not printing.

Probably an error in your code.

How are you printing?


below is the code,
Code:
 public static void Pdf_OnDocumentRenderQuestions(Document doc)
    {
        HttpContext context = HttpContext.Current;
        //string[] stglt1 = context.Request.Params["temp"].Split(',');
        string[] questions = context.Request.Params["Questions"].Split(',');
        string groupName = context.Request.Params["GroupName"];
     
        Section sec = doc.AddSection();

        TextFrame textFrame = sec.AddTextFrame();
        textFrame.Left = ShapePosition.Left;
        textFrame.Width = 500;
        textFrame.Height = 1000;
        textFrame.RelativeHorizontal = RelativeHorizontal.Margin;

        // Put sender in text frame
        Paragraph paragraph = textFrame.AddParagraph();
        paragraph = textFrame.AddParagraph();
        paragraph.Format.Font.Name = "Times New Roman";
        paragraph.Format.Font.Size = 12;
        paragraph.Format.Font.Color = blackcolor;
        paragraph.AddFormattedText("Question Group: ", TextFormat.Bold);
        paragraph.AddText(groupName);
       
        paragraph.AddLineBreak(); paragraph.AddLineBreak();

        int count = 1;
        foreach (string question in questions)
        {
            TS_QuestionDL qid = new TS_QuestionDL();

            Guid questId = new Guid(question);
            string str = qid.GetQuestions(questId);
            paragraph.AddLineBreak();
            paragraph.AddFormattedText(count.ToString()+". ", TextFormat.Bold);
            paragraph.AddText(str.Trim());
            paragraph.AddLineBreak(); paragraph.AddLineBreak();

            List<string> options = new List<string>();

            TS_OptionDL optionIds = new TS_OptionDL();
           
            int count1 = 1;

            string questionType = qid.GetQuestionType(questId);

            if (questionType == "MCQ")
            {
                options = optionIds.GetQuestionOptions(questId);

                foreach (string option in options)
                {
                    paragraph.AddTab(); paragraph.AddTab();
                    paragraph.AddFormattedText(count1.ToString() + ". ", TextFormat.Bold);
                    paragraph.AddText(option.StripHTML());
                    paragraph.AddLineBreak();
                    count1++;
                }

            }
           
            count++;
           
        }
                paragraph = sec.AddParagraph();
           
    }

Author:  () => true [ Tue Aug 24, 2010 1:04 pm ]
Post subject:  Re: Multipage not coming

rajaselvaraju wrote:
below is the code

That is the code that creates the MigraDoc document (at least we know now that you're using MigraDoc), not the code that does the printing.

Something like
Code:
            DocumentRenderer renderer = new DocumentRenderer(document);
            renderer.PrepareDocument();
            for (int i = 1; i <= renderer.FormattedDocument.PageCount; ++i)

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/