Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dynamically Insert Pagebreak

My team working in a project using asp.net mvc3(c#). Based on the project requirement,we need to implement page break like Microsoft Word. I need to save the pagebreak and the page size may be a4, letter, legal, etc.

Is it possible to control the page size of the content in the ckeditor and insert page breaks shown inside the editor when it crosses a certain height or size, the same way it works in MS Word>

Is there is any alternative solution?

like image 838
amexn Avatar asked Dec 06 '11 06:12

amexn


1 Answers

Like graphicdivine says, use print CSS to accomplish what you need to do. Create a css class that has a page-break-before definition, and dynamically add that class to the first element of the page after the break.

You could also do something like this:

br.pageBreak {
    page-break-after: always;
}

and then insert a <br class="pageBreak" /> at the point where you need a page break.

More info:

Page-breaks: http://www.w3.org/TR/css-print/#s.8.2

Page size: http://www.w3.org/TR/css-print/#s.8.3

An old A List Apart article: http://www.alistapart.com/articles/goingtoprint/

Unfortunately, I do not know if it is possible to alter CKEditor in this way without hassle.

like image 197
Anders Marzi Tornblad Avatar answered Oct 03 '22 23:10

Anders Marzi Tornblad