Open vikasacharya16 opened 6 years ago
if i print only current page it will show preview to print. what about other data. u said depending on the content it will split into pages for print...... but its not happening
<Page xmlns="http://schemas.nativescript.org/tns.xsd" navigatingTo="onNavigatingTo" class="page"> <Page.actionBar> <ActionBar title="My App" icon="" class="action-bar"> <Button text="Print HtmlView" tap="{{ printHtmlView }}" class="button button-b" /> </ActionBar> </Page.actionBar> <ScrollView> <HtmlView id="htmlView" html="{{htmlView + htmlView + htmlView}}" /> </ScrollView> </Page>
var Observable = require("data/observable"); var data = require('./data.json'); var nativescript_printer = require("nativescript-printer");// Printer plugin // instantiate the plugin var printer = new nativescript_printer.Printer(); function createViewModel() { var viewModel = new Observable.fromObject({ htmlView: data.htmlView, printHtmlView: function (args) { var id = args.object.page.getViewById("htmlView"); console.log(id); printer.printScreen({ view: args.object.page.getViewById("htmlView"), }).then((success) => { HelloWorldModel.feedback(success); }, (error) => { alert("Error: " + error); }); }, }); return viewModel; } exports.createViewModel = createViewModel;
if i print only current page it will show preview to print. what about other data. u said depending on the content it will split into pages for print...... but its not happening