How to print to edge of paper

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF CoreSuite for .NET (v6)  /  How to print to edge of paper

DynamicPDF CoreSuite for .NET (v6) Forum

 May 24 2011 4:03 PM
Hey all,

I'm using the Generator for .NET to render a PDF document.  The PDF file must be printed to the very bottom edge of the paper.  We are using address label stock as the printer paper, and the print on the bottom row of labels is being truncated.

We have a postscript solution that will print to the bottom edge of this.   We're in the process of converting the postscript solution into using the DynamicPDF Generator instead.  When we print the generated PDF, there is about a 3-4 point margin on the bottom edge of the paper.

I am not a printing "guru", so I'm a little at a loss to fix this.  Is it possible to render a PDF and cause it to print to the very edge of the paper?

I can post a sample of the DynamicPDF generation code, or email a sample of the generated PDF file, if need be.   I'm not sure if it makes a difference, but we're also using the DynamicPDF PrintManager to stream our PDF documents to the printer.

--steve

 May 24 2011 4:55 PM
Posted by a ceTe Software moderator
Hello Steve,

When a page is created by default there the margins of the page are set to 50. If you want to place the content all the way to the end of the page you would need to set the margins to zero. Here is the code.

       Document document = new Document();

       PageDimensions dimensions = new PageDimensions( PageSize.Letter, PageOrientation.Portrait );
       dimensions.BottomMargin = 0;
       dimensions.TopMargin = 0;
       dimensions.LeftMargin = 0;
       dimensions.RightMargin = 0;

       Page page = new Page( dimensions );
       document.Pages.Add( page );

       page.Elements.Add( new Label( "test page", 0, 0, 300, 20, Font.Helvetica, 18 ) );

       document.Draw( @"C:\MyDocument.pdf" );

Thanks,
ceTe Software Support Team.
 May 24 2011 5:53 PM
We tried that, and it didn't make any difference.   Here is the code we're using to generate a sample PDF doc that reproduces the error for us.  Please note that when you generate the PDF, the PDF looks ok, it just doesn't print properly.

            // Create a PDF Document
            Document document = new Document();

            // Create a Page and add it to the document
            var dimensions = new PageDimensions(PageSize.Letter, PageOrientation.Portrait);
            dimensions.BottomMargin = 0;
            dimensions.TopMargin = 0;
            dimensions.LeftMargin = 0;
            dimensions.RightMargin = 0;

            Page page = new Page(dimensions);
            document.Pages.Add(page);

            var table = new Table2(12f, 46f, 600, 794);

            table.Border.LineStyle = LineStyle.None;
            table.CellDefault.Border.LineStyle = LineStyle.None;
            table.CellDefault.Padding.Top = 0;
            table.CellDefault.Padding.Left = 0;
           
            // Add columns to the table            
            table.Columns.Add(176f);
            table.Columns.Add(176f);
            table.Columns.Add(176f);

            for (int rowindex = 0; rowindex < 15; rowindex++)
                table.Rows.Add(54f);

            var labeltable = new Table2(0, 0, 167f, 45f, Font.Helvetica, 8);
            labeltable.Border.LineStyle = LineStyle.None;
            labeltable.CellDefault.Border.LineStyle = LineStyle.None;
            labeltable.CellDefault.Padding.Top = 0;
            labeltable.CellDefault.Padding.Left = 0;
            labeltable.Columns.Add(121f);
            var row = labeltable.Rows.Add(45f);

            TextArea text = new TextArea("one\ntwo\nthree\nfour", 0, 0, 121f, 41f);

            text.VAlign = VAlign.Center;
            text.FontSize = 8;
            text.Align = TextAlign.Left;

            Cell2 cell = labeltable.Rows[0].Cells.Add(text);
            cell.VAlign = VAlign.Center;

            for (var rowIndex = 0; rowIndex < table.Rows.Count; rowIndex++ )
                for (var col = 0; col < table.Columns.Count; col++)
                    table.Rows[rowIndex].Cells.Add(labeltable);

            // Add the table to the page
            page.Elements.Add(table);

            document.Draw(@"MyLabels.pdf");
 May 26 2011 7:23 AM
Posted by a ceTe Software moderator
Hello Steve,

You can achieve your requirements by scaling to PageEdges. You can do this using the ScaleTo enumerator of our DynamicPDF PrintManager for .NET API. Below is the sample code for it.

           // Create a PDF Document
            Document document = new Document();
            // Create a Page and add it to the document
            PageDimensions dimensions = new PageDimensions(PageSize.A4, ceTe.DynamicPDF.PageOrientation.Portrait);
            dimensions.BottomMargin = 0;
            dimensions.TopMargin = 0;
            dimensions.LeftMargin = 0;
            dimensions.RightMargin = 0;

            Page page = new Page(dimensions);
            document.Pages.Add(page);
            Table2 table = new Table2(12f, 46f, 600, 794);
            table.Border.LineStyle = LineStyle.None;
            table.CellDefault.Border.LineStyle = LineStyle.None;
            table.CellDefault.Padding.Top = 0;
            table.CellDefault.Padding.Left = 0;
            // Add columns to the table            
            table.Columns.Add(176f);
            table.Columns.Add(176f);
            table.Columns.Add(176f);

            for (int rowindex = 0; rowindex < 15; rowindex++)
                table.Rows.Add(54f);

            Table2 labeltable = new Table2(0, 0, 167f, 45f, Font.Helvetica, 8);
            labeltable.Border.LineStyle = LineStyle.None;
            labeltable.CellDefault.Border.LineStyle = LineStyle.None;
            labeltable.CellDefault.Padding.Top = 0;
            labeltable.CellDefault.Padding.Left = 0;
            labeltable.Columns.Add(121f);
            Row2 row = labeltable.Rows.Add(45f);

            TextArea text = new TextArea("one\ntwo\nthree\nfour", 0, 0, 121f, 41f);
            text.VAlign = VAlign.Center;
            text.FontSize = 8;
            text.Align = TextAlign.Left;

            Cell2 cell = labeltable.Rows[0].Cells.Add(text);
            cell.VAlign = VAlign.Center;

            for (int rowIndex = 0; rowIndex < table.Rows.Count; rowIndex++)
                for (int col = 0; col < table.Columns.Count; col++)
                    table.Rows[rowIndex].Cells.Add(labeltable);

            // Add the table to the page
            page.Elements.Add(table);
        //Below is the code to send the generated PDF to printer by scaling it to PageEdges
            ceTe.DynamicPDF.Printing.InputPdf pdf = new ceTe.DynamicPDF.Printing.InputPdf(document.Draw());
            PrintJob printJob = new PrintJob(Printer.Default, pdf);
            AutoPageScaling autoPageScaling = new AutoPageScaling(ScaleTo.PageEdges, false, false);
            printJob.PrintOptions.Scaling = autoPageScaling;
            printJob.Print();
            printJob.Dispose();

Thanks,
ceTe Software Support Team.
 May 26 2011 12:44 PM
Thanks for the info on the AutoPageScaling object.  However, it did not make a difference.   Whether or not I assign the AutoPageScaling object with ScaleTo.PageEdges, the printed output looks exactly the same with no difference whatsoever.  The bottom edge of the printout is truncated at the middle of the word 'three' of the last row generated by the sample code I gave you.

--steve
 May 27 2011 2:56 PM
Posted by a ceTe Software moderator
Hello Steve,

We do see the issue you are talking about, we are doing some further testing. We will provide feedback on this issue once we are done with our testing.

Thanks,
ceTe Software Support Team.
 May 31 2011 11:22 AM
Posted by a ceTe Software moderator
Hello Steve,

We did some further testing and were unable to resolve this using the PrintManager API. The Generator API is generating the document as expected. We have reported this issue to our development team so they can investigate this further. Once we receive feedback from our developers we will post the response here. If you need further updates please send an email to support@cete.com referring to the url of this forum post.

Thanks,
ceTe Software Support Team. 
 Jun 07 2011 4:52 PM
Posted by a ceTe Software moderator
Hello Steve,

Our developers investigated this issue further and suggested that along with using the AutoPageScaling with ScaleTo.PageEdges property set, the printer being used to print this document should support edge-to-edge printing. If you are still seeing the same behavior after using the ScaleTo.PageEdges then the printer might not have support for edge-to-edge printing.

Thanks,
ceTe Software Support Team.

All times are US Eastern Standard time. The time now is 2:09 AM.