2011-03-29 5 views
1

Abc PDF를 사용하여 HTML 페이지에서 pdf를 만들었습니다. 다음 페이지에서 테이블 헤더를 인쇄하려고하지만 내 테이블 데이터가 다른 페이지에 표시되는 경우에만 다른 페이지에 헤더를 표시하지 않으므로, 어느 누구도 Abc pdf를 사용하여이 작업을 수행 할 수있는 방법에 대해 알고 있습니다.Abc PDF를 사용하여 설정 페이지에 헤더 인쇄

답변

2

상단에 약간의 공백이있는 페이지를 만든 다음 페이지가 abc PDF 루프로 작성되고 헤더를 추가하면됩니다.

아래의 코드는 내가 헤더를 추가 할 것입니다,이 경우 헤더의 텍스트와 함께 상단에 3 개의 비트 이미지 및 두 개의 상자가 있습니다.

바닥에서있는 ABC의 PDF 파일의 코드를 기억을 오른쪽 상단은 아니야. PDF 파일이 생성되면 그럼 그냥

private static Doc AddHeader(Doc theDoc, Core.Property propertyDetails) 
{ 
    int theCount = theDoc.PageCount; 
    int i = 0; 

    //Image header 
    for (i = 1; i <= theCount; i++) 
    { 
     theDoc.Rect.Width = 590; 
     theDoc.Rect.Height = 140; 

     theDoc.Rect.Position(0, 712); 

     theDoc.PageNumber = i; 

     //Check Which office to use. 
     string imagefilePath = HttpContext.Current.Server.MapPath("/images/pdf/pdf-header.png"); 


     Bitmap myBmp = (Bitmap)Bitmap.FromFile(imagefilePath); 

     theDoc.AddImage(myBmp); 
    } 

    //page header boxes. 
    //Grey header box 
    theDoc.Rect.String = "20 15 590 50"; 
    theDoc.Rect.Position(13, 672); 
    System.Drawing.Color colour = System.Drawing.ColorTranslator.FromHtml("#CCCCCC"); 
    theDoc.Color.Color = colour; 
    theDoc.PageNumber = 1; 
    theDoc.FillRect(); 

    theDoc.Rect.String = "20 15 586 50"; 
    theDoc.Rect.Position(30, 660); 
    System.Drawing.Color pageoneText = System.Drawing.ColorTranslator.FromHtml("#50474A"); 
    theDoc.Color.Color = pageoneText; 
    string thePageFont = "Century Gothic"; 
    theDoc.Font = theDoc.AddFont(thePageFont); 
    theDoc.FontSize = 16; 
    theDoc.PageNumber = 1; 
    theDoc.AddText("My Text!!!!!"); 


    theDoc.Rect.String = "20 15 590 50"; 
    theDoc.Rect.Position(13, 630); 
    System.Drawing.Color greyBox = System.Drawing.ColorTranslator.FromHtml("#468DCB"); 
    theDoc.Color.Color = greyBox; 
    theDoc.PageNumber = 1; 
    theDoc.FillRect(); 

    theDoc.Rect.String = "20 15 586 50"; 
    theDoc.Rect.Position(30, 620); 
    System.Drawing.Color greyText = System.Drawing.ColorTranslator.FromHtml("#ffffff"); 
    theDoc.Color.Color = greyText; 
    string thePageFontTwo = "Century Gothic"; 
    theDoc.Font = theDoc.AddFont(thePageFontTwo); 
    theDoc.FontSize = 14; 
    theDoc.PageNumber = 1; 
    theDoc.AddText("This is more text"); 

    return theDoc; 
} 

전화

var theDoc = new Doc(); 

/// Your document creation stuff!!! 
theDoc = AddHeader(theDoc, propertyDetails); 
관련 문제