2012-01-20 2 views
1

i напечатайте pdf на моем принтере ZEBRA. размер бумаги ZEBRA составляет 10 см x 7 см. у меня всегда был промежуток в 1 см.! enter image description hereПолучите всегда край 1 см сверху и слева на ZEBRA Печать

Как я могу избавиться от этого пробела?

protected void Page_Load(object sender, EventArgs e) 
{ 
    // step 1 
    // need to write to memory first due to IE wanting 
    // to know the length of the pdf beforehand 
    MemoryStream m = new MemoryStream(); 

    Rectangle pageSize = new Rectangle(100f, 70f) ; 

    pageSize.BorderColor = BaseColor.BLACK; 
    pageSize.BorderWidth = 4f; 
    pageSize.BorderWidthBottom = 2f; 

    Document document = new Document(pageSize, 0f, 0f, 0f, 0f); 
    try 
    { 
     // step 2: we set the ContentType and create an instance of the Writer 
     Response.ContentType = "application/pdf"; 
     PdfWriter writer = PdfWriter.GetInstance(document, m); 
     writer.CloseStream = false; 

     // step 3 
     document.Open(); 

     // step 4 
     document.Add(new Paragraph("This is a custom size")); 
    } 
    catch (DocumentException ex) 
    { 
     Console.Error.WriteLine(ex.StackTrace); 
     Console.Error.WriteLine(ex.Message); 
    } 
    // step 5: Close document 
    document.Close(); 

    // step 6: Write pdf bytes to outputstream 
    Response.OutputStream.Write(m.GetBuffer(), 0, m.GetBuffer().Length); 
    Response.OutputStream.Flush(); 
    Response.OutputStream.Close(); 
    m.Close(); 
} 

override protected void OnInit(EventArgs e) 
{  
    InitializeComponent(); 
    base.OnInit(e); 
} 

private void InitializeComponent() 
{ 
    this.Load += new System.EventHandler(this.Page_Load); 
} 

Спасибо заранее, STEV

PS: я уже установленная Маржа = 0 Document document = new Document(pageSize, 0f, 0f, 0f, 0f);

+1

вы установите размер этикетки и поле в драйверах принтера? – Reniuz

+0

В течение примерно 1 часа я занимаюсь этим .... спасибо вам. – user609511

+0

так помогли настройки драйверов принтера? – Reniuz

ответ