?
Solved

Inserting page break in PDF using itextsharp

Posted on 2014-11-04
5
Medium Priority
?
2,930 Views
1 Endorsement
Last Modified: 2014-12-03
Hi,
I need to insert page break in PDF using itextsharp. Let me know if this is possible
1
Comment
Question by:kalyangkm
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 32

Expert Comment

by:Robberbaron (robr)
ID: 40423657
i haven't used itextsharp for a while, but i believe you need to add a new page and then add data to it.

thats the way PDFSharp works.  this code adds a number of index pages and adds text to them.

                            if ((idxCount) > indexpagenum * indexlinesperpage)
                            {
                                indexpagenum++;  //increment current index pages in use  
                                //add new page for rest of index
                                pageIdx = outPDF.InsertPage(indexpagenum - 1);  // add after prev index. starts at 0

                                gfx = XGraphics.FromPdfPage(pageIdx);


                                font = new XFont("Verdana", 10);
                                gfx.DrawString(string.Format("Index page {0}", indexpagenum), font, XBrushes.Black, marginX + 20, 70, XStringFormats.Default);
                                font = new XFont("Verdana", 12);

                            }

Open in new window

0
 
LVL 19

Accepted Solution

by:
Albert Van Halen earned 2000 total points
ID: 40423667
Use the NewPage method
0
 
LVL 32

Expert Comment

by:Robberbaron (robr)
ID: 40423670
http://www.codeproject.com/Articles/686994/Create-Read-Advance-PDF-Report-using-iTextSharp-in

for (int i = 1; i <= 5; i++)
{
    doc.NewPage();
    doc.Add(new Paragraph(string.Format("This is a page {0}", i)));
}

Open in new window

0
 

Author Comment

by:kalyangkm
ID: 40477933
I've requested that this question be deleted for the following reason:

Not required
0
 
LVL 19

Expert Comment

by:Albert Van Halen
ID: 40477934
Required or not, the answers are correct.
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question