Well, I've searched a bit and did not find anything similar.
I want to know how can I use Angular to create printable content, jump to the end of the page and print more content.
How can I force the content to always fit on a specific size, like a PDF? Do I need Angular to do this? If not HTML, can I iterate over PDF printable pages?
Example:
Suppose I'm a teacher and I've asked my students to send a 10 lines essays to a specific web system. Now, in the admin page, I want to print 10 students essays on 10 pages, every one of them starting on line 0 of the respective page.
Example 2:
Suppose I want to print n blank pages. On a system, I'm asked how many pages do I want and Angular prints it.
Example 3:
Suppose I have an array with 3 names. I want to print the first name on the first page, second on the second and third on the third.
@edit
This is the final project implemented. It's a timeSheet generator. It takes an array inside app.js and print a new page for every employee.
You simply apply the appropriate CSS:
Every essay will be printed on a separate page.
I wanted to put this as a comment, but I don't have enough rep so please excuse me. :/
Maybe not a direct answer, but I suggest you also take a look at this directive I found some time ago:
This directive lets you isolate specific parts of your page for printing.
You can define what id of element this directive will work on by specifying the
print-element-id
attribute, like so:And you define the printable area by using the same id, like this:
This clones all contents of the element with id of
printThis
into an element with id ofprintSection
, which is appended at the end of the document. What's left to do is to hideprintSection
when you're not printing, and show only theprintSection
, hide everything else when you are. The only other thing to remember is to include styles for printing. Mine looked like this:I used this in an app I've been developing, where the dashboard and UI components were interfering with the printability of the contents I wanted to print.
Credit goes to this article. I've since modified the directive, but I never would've done it without reading it.
As an added comment, I think what you're trying to accomplish is something out of Angular's capabilities. You can print up to n items or articles, but there's no easy way to define them as pages inside the Angular app itself. What I suggest is to use @zeroflagL's answer in conjunction with this directive.
My two cents.