2016-07-20 3 views
0

아래 코드는 이미지와 날짜 스탬프를 페이지 머리글에 추가 한 다음 페이지에 텍스트 (예 : 한 개의 머리글과 두 개의 단락)를 채우는 것을 목표로합니다. .MigraDoc 1.5b3의 페이지 머리글과 겹치지 않도록 단락 푸시

문제는 텍스트가 페이지 머리글과 겹치며 페이지 머리글의 날짜 스탬프 단락과 같은 높이에서 시작한다는 것입니다. 내가 도대체 ​​뭘 잘못하고있는 겁니까?

Section section = document.AddSection(); 
section.PageSetup.StartingNumber = 1; 

Image image = section.Headers.Primary.AddImage(GetImageFromDB("LogoPageHeader")); // creates base64 encoded image string 
image.LockAspectRatio = true; 
image.RelativeVertical = RelativeVertical.Line; 
image.RelativeHorizontal = RelativeHorizontal.Margin; 
image.Top = ShapePosition.Top; 
image.Left = ShapePosition.Left; 
image.WrapFormat.Style = WrapStyle.TopBottom; // to push date stamp to below the bottom of the image 

HeaderFooter header = section.Headers.Primary; 
Paragraph paragraph = header.AddParagraph(DateTime.Now.ToString("MM/dd/yyyy")); 
paragraph.Format.Alignment = ParagraphAlignment.Right; 

Paragraph paragraph = document.LastSection.AddParagraph("Question Summary:", "Heading3"); 

paragraph = document.LastSection.AddParagraph(); 
paragraph.Format.Alignment = ParagraphAlignment.Left; 
paragraph.AddText("Question: " + q.Text.Trim()); 

paragraph = document.LastSection.AddParagraph(); 
paragraph.Format.Alignment = ParagraphAlignment.Left; 
paragraph.AddText("Answer: " + (String.IsNullOrEmpty(q.ReplyText.Trim()) ? q.ReplyCode.ToString() : q.ReplyText.Trim())); 
paragraph.Format.SpaceAfter = "8pt"; 

이미지는 약 20x20mm입니다.

답변

1

헤더의 공간을 예약하기 위해 PageSetup의 TopMargin을 설정해야합니다.

은 참조 :
http://forum.pdfsharp.net/viewtopic.php?p=3077

+0

그냥 링크 코드를 유지하기 위해'section.PageSetup.BottomMargin = Unit.FromCentimeter를 (x)를' – ajeh

관련 문제