Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force page break #47

Open
v-bubar opened this issue Aug 2, 2017 · 0 comments
Open

Force page break #47

v-bubar opened this issue Aug 2, 2017 · 0 comments

Comments

@v-bubar
Copy link

v-bubar commented Aug 2, 2017

Is it possible to force a page break on a specific spot?
Right now i'm doing something like that:

<style>
	.card_layout {
		width: 86mm;
		height: 54mm;
	}
	.card_name {
		font-weight: 900;
		font-size: 25px;
	}
	.card_text {
		margin-left: 5mm;
		margin-top: 25mm;
	}
	@media print {
		.breaker {
			page-break-after: always;
		}
	}
</style>
	<div class="card_layout breaker">
		<div class="card_text">
			<div class="card_name" id="card_name">Name</div>
			<div class="card_company" id="card_company">Company</div>
		</div>
	</div>
	<div class="card_layout">
		<div class="card_text">
			<div class="card_name" id="card_name">Name</div>
			<div class="card_company" id="card_company">Company</div>
		</div>
	</div>
<script>
 jsPrintSetup.setPrinter('Evolis Primacy');
            jsPrintSetup.setPaperSizeUnit(jsPrintSetup.kPaperSizeMillimeters);
            jsPrintSetup.setOption('paperWidth', 86);
            jsPrintSetup.setOption('paperHeight',54);

            jsPrintSetup.setOption('marginTop', 0);
            jsPrintSetup.setOption('marginBottom', 0);
            jsPrintSetup.setOption('marginLeft', 0);
            jsPrintSetup.setOption('marginRight', 0);

            jsPrintSetup.setOption('headerStrLeft', '');
            jsPrintSetup.setOption('headerStrCenter', '');
            jsPrintSetup.setOption('headerStrRight', '');

            jsPrintSetup.setOption('footerStrLeft', '');
            jsPrintSetup.setOption('footerStrCenter', '');
            jsPrintSetup.setOption('footerStrRight', '');

            jsPrintSetup.saveOptions('kSaveAll');

            jsPrintSetup.clearSilentPrint();

            jsPrintSetup.setOption('printSilent', 1);

            jsPrintSetup.print();
</script>

The idea is to break a page after the first div.card_layout. However both divs are printed on the same page. Am I doing something wrong?

I'm testing the code on 54.0.1, OS X 10.11.

Thank you in advance for your answer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant