Hello,
I need to know how can I disable paging in PDF document. I want to have only one page , as long as my content. I’m using Aspose.Pdf for .NET API to build Table in pdf document. In fact I need to optimize content for needle printers so paging have to be disabled.
Pdf documentPDF = new Pdf();
documentPDF.PageSetup.PageHeight = Aspose.Pdf.PageSize.A4Height;
documentPDF.PageSetup.PageWidth = Aspose.Pdf.PageSize.A4Width;
documentPDF.PageSetup.Margin.Left = 20;
documentPDF.PageSetup.Margin.Right = 20;
documentPDF.PageSetup.Margin.Top = 0;
documentPDF.PageSetup.Margin.Bottom = 0;
I was also wondering if those methods will work with multiple tables in document.
Hello Stefan,
Thanks for considering Aspose.
I am afraid the requested feature is currently not supported. However, for the sake of correction, I have logged this requirement as PDFNET-22463 in our issue tracking system. We will further look into the details of this problem and will keep you updated on the status of correction. We apologize for your inconvenience.
Hello Stefan,
Thanks for your patience.
We have gone through your requirement and in order to break/restrict the table to stay on one page, please set the value of IsBroken property of Aspose.Pdf.Table class to true. Please try using the following code snippet.
[C#]
Document doc = new
Document();<o:p></o:p>
Page page = doc.Pages.Add();
//Instantiate a table object
Aspose.Pdf.Table
tab1 = new Aspose.Pdf.Table();
//Add the table in paragraphs
collection of the desired section
page.Paragraphs.Add(tab1);
//Set with column widths of the table
tab1.ColumnWidths = "50
";
//Set default cell border using
BorderInfo object
tab1.DefaultCellBorder = new
Aspose.Pdf.BorderInfo(Aspose.Pdf.BorderSide.All, 0.1F);
//Set table border using another
customized BorderInfo object
tab1.Border = new
Aspose.Pdf.BorderInfo(Aspose.Pdf.BorderSide.All, 1F);
//Set the default cell padding to the
MarginInfo object
tab1.IsBroken = true;
for (int i = 0; i <= 200;
i++)
{ //Create rows in the
table and then cells in the rows
Aspose.Pdf.Row row1 =
tab1.Rows.Add();
row1.Cells.Add("Row
" + (i + 1).ToString());
}
//doc.Pages.Count == 1;
doc.Save(“c:/pdftest/PagingTest.pdf”);
The issues you have found earlier (filed as PDFNEWNET-22463) have been fixed in Aspose.Pdf for .NET 8.0.0.
This message was posted using Notification2Forum from Downloads module by Aspose Notifier.