Quantcast
Channel: Aspose.Pdf Product Family
Viewing all articles
Browse latest Browse all 3131

Multiple FloatingBox

$
0
0
Hi,

I'm trying to create a message like flow in my PDF, so a customer has a conversation in a box on the left side of the page and our replies on the right of the page.

The PDF is created at 0bytes and stays locked in another program (w3wp.exe). Why can't I create a nice PDF with lots of FloatingBoxes?


foreach (TopicMessage issueMessage in getIssue.Issue.IssueMessages)
                {
                  
                    //start on the left of the page and build up messages
                    if (issueMessage.Origin == Customer)
                    {
                        //this message is from them...
                        //draw a box on the left with the message
                        pageSection.Paragraphs.Add(CreateFloatingBox(issueMessage.PersonNickName, "", issueMessage.MessageText, BoxHorizontalAlignmentType.Left));
                    }
                    else
                    {
                        //this is a message from us to them
                        //draw a box on the right
                       pageSection.Paragraphs.Add(CreateFloatingBox(issueMessage.PersonNickName, "", issueMessage.MessageText, BoxHorizontalAlignmentType.Right));
                    }
                }

//debugging
                pdf1.Save(@"c:\temp\" + Guid.NewGuid().ToString() + ".pdf");               
            }
            return null;
        }

        private static FloatingBox CreateFloatingBox(string socialNick, string imageUrl, string message,BoxHorizontalAlignmentType position)
        {
            Aspose.Pdf.Generator.FloatingBox box1 = new Aspose.Pdf.Generator.FloatingBox(150, 25);

            box1.BoxHorizontalPositioning = Aspose.Pdf.Generator.BoxHorizontalPositioningType.Margin;
            box1.BoxVerticalPositioning = BoxVerticalPositioningType.Paragraph;
            box1.BoxVerticalAlignment = BoxVerticalAlignmentType.None;
            box1.BoxHorizontalAlignment = position;

            box1.Paragraphs.Add(new Text(socialNick));
            box1.Paragraphs.Add(new Text(message));

            return box1;
        }

Viewing all articles
Browse latest Browse all 3131

Trending Articles