Can someone help me out with this one.
I have an MVC page where I have a print button. When clicking on print I need to open a print popup dialog (the same one that we get when we hit Ctrl+P). But when clicking on print, I have a logic to get some content as string from code behind and pass it to the print window.
I tried to open a popup when clicking on print button and doing Print functionality by using window.print but this works only if we have the content to print along with the button.
Edit:
If you see the above picture, I have a button with some label "Hi click below button to print content". When I click on print button, I need to have some other content not in this page to be sent to the printer.
You have to have it in the browser for it to print. Your best shot is to AJAX the content into a content div. Then, set the rest of the DOM to visibility: hidden. In CSS, you can do media queries like #media print { } to apply certain styles only when you print.
If you can imagine, the printer doesn't know HTML / CSS. Only the browser does and you can tell it the media you wish to target.
Related
I have a problem with one test case. Well, I would like to download a text or an element from the site and check if it is displayed on the website?.
I've purchased and installed the highcharts editor
http://www.highcharts.com/products/highcharts-editor
by including the relevant JS and CSS files in my HTML templates.
However, whenever a browser page is printed, a box with the text 'This is a snackbar' and an 'action' button appears.
It doesn't appear on screen in the browser, only when the print dialog is opened, from the second page as per the attached screenshot.
What is it and how can it be removed?
The browser is Google Chrome.
My scenario is this: I am using WL.NativePage.show(nativePageClassName, backFromNativePage, params) to navigate to an activity. Once returning back to the WebView, I need to navigate directly to other page(Div) in html, rather from the page I originally navigated from to the activity, which is developed using jQuery-Mobile.
See the below example code.
WL.NativePage.show("com.example.SignatureActivity", function(data) {
if(data.goToPage == "example2"){
$.mobile.changePage('#example2-page',{transition: 'none'});
}else{
$.mobile.changePage('#example1-page',{transition: 'none'});
}
});
Here I am using WL.NativePage.show() In example1-page, I have two buttons in activity, one is save and one is back, while saving I need to navigate to example2 and while back, its example1.
I am able to navigate to example2, but example1-page is executing and displaying first and then displaying example2-page.
Please give me suggestions on how to navigate directly to example2-page without displaying example1-page.
You can't navigate directly from the activity to a different place in the DOM which is in the WebView from which you navigated to the activity.
What you could do, is open displaying the activity, also hide the current content in the WebView. I assume it is a DIV essentially - so you could do something with display:none or any other standard method.
That way when the user returns back to the WebView from the activity and the code to change page is executed, you could then play again with the visibility of the DIV to display it when needed.
This way what you don't want to be seen will not be shown.
I have built a database using MS Access 2010, everything is done except for one button that is not working.
I have a main navigation form, that has different tabs, one tab opens another navigation form (secondary nav. form - SNF) inside the main navigation form (MNF). in the SNF there are tabs which open reports that get their data from queries.
the reports, when opened separately, have a print button which works fine when the report are opened directly and not using the forms.
when the reports are opened through the SNF and the print button pressed the printed page has the SNF and the MNF headers and footers which isn't needed and the supposedly 1 page report would be divided to 4 pages. each containing a quarter of the view.
what I am trying to do is have the printing function using the button print only the report inside the SNF without anything outside that reports borders just as it does when the report is opened directly without using the forms.
NOTE:
* The printing button uses the defaut access print function which is implemented using the button wizard.
** Attached is a screenshot of what I get in both cases.
I was having the same issues, where the entire form was being printed instead of the reports that were navigation subforms. I worked around it this way:
VBA:
DoCmd.OpenReport "MY REPORT", acViewPreview
DoCmd.RunCommand acCmdPrint
DoCmd.Close acReport, "MY REPORT"
It's clumsy, but it allows the user to use the print dialogue instead of just using
DoCmd.OpenReport, "MY REPORT", acPrint
and not being given the option choosing a printer, double sided etc.
I have a page doing some functionality and at the end it produces a report displayed in a popup and I want to print this report only not the whole page.
How can I print the the content of the popup?
Popup embeded into the page and there is no way to print only part of the page.
So you have to create separate page (which you can generate from the popup content) or use an iframe.