How to preview before print using eclipse? - java

I am using eclipse with tomcat server. My program is about to print a page containing dynamic table, which means the data and number of column even header title also dynamic. The table is continue to the next page, and i need to view the table header as well as the first page. Is there any example or page i can refer to?
Thanks in advance

your explanation is not clear enough but based on your question (How to preview before print using eclipse?) I think I know what you mean. as I realized you want to have a preview before printing your page, Ok then, jQuery has a plugin with this very aim which is called Print Preview Plugin. use this plugin and:
$('#yourcontainer').prepend('<a class="preview-page">Print this page</a>');
$('a.preview-page').printPreview();
then you can call $.printPreview.loadPrintPreview(); and your problem is solved. here this is a DEMO get a view-source, you'll see the solution.

Related

Java ADF "showPrintablePageBehavior"

I currently have many rows on a table that load as a user scrolls down the page.
There is a showPrintablePageBehavior tag added to create a printable layout page upon clicking that will show the contents on the table. Currently, it only shows 25 or so rows at a time.
I am trying to figure out how to display every row on the new page once the button is clicked.
Is there anything I can add to the <af:showPrintablePageBehavior/> tag or the af:commandToolbarButton tag that could help transfer all the rows over? I know fetchSize may be an option, but I'm not sure how to implement that in.
Thank you!
To my knowledge, the showPrintablePageBehavior will not trigger a server go around. This means that you need to build another page where you fetch all data (set the fetchsize to -1) and print this. This blog https://myadfnotebook.blogspot.com/2011/01/adf-printable-pages-fetching-more-data.html shows how to do this.

How to click on file-attachment icon using selenium (with java)?

I am creating automation that automatically sends messages through LinkedIn. The code is working fine, but as per our current requirement, I want to click on the attachment button so as to pass the attachment also with the text message. There are a few points that I have already tried:
Unable to fetch the element ID as its dynamic most of the time.
Don't want to use offsets (x,y) because once anyone changes the size of the window offsets changes.
Unable to use XPath.
Then I checked for another tool "UIVision" which makes a solution to capture that particular area (save it in a .png file) from the page where we want to click and during runtime it clicks there. So I tried searching image comparison API for java, tried with ASHOT and Sikulix too but none worked for me.
Anyone can help me with this?
When you say your unable to use xpath will you please elaborate?
The button has an id - it's attachment-trigger-ember1079.
If you're concerned about the latter part being dynamic, the attachment button also has a good title.
You can try using xpath string:
//button[contains(#title,'Attach a file')]
For me, on my linked in, this returns a unique hit on the expected attachment object:
If these don't work, there's also the option of using javascript to action the upload.
For more information on handling the upload dialog (after your identify the object) have a look here

How to use Selenium and Java to interact with dynamic web element?

I want to use Selenium to interact with an element on a website. This element contains further content depending on the user's behavior, but obviously has exactly one HTML-element the whole time.
The element looks like this when the mouse is not on top of it:
When the mouse is on top of it, it looks like this:
When the user clicks on the down arrow, other content is visualized:
As you can see it contains even more logic, I didn't add screenshots for it though.
The corresponding HTML code is that, nothing more:
I do not know how this content is created. Does anybody know how I can use Selenium and java to interact with that web element? Selenium is obviously restricted to HTML content - what can I do without trying any dirty hacks like positioning the mouse at a certain position on the element myself to trigger the different visualization?
Update
I want to do automated end-to-end testing. That means I need to programmatically use the buttons of the web element as a user would:
Delete the date by clicking the x button
Alter the date by clicking up and down buttons
Alter the date by using the calender component
Changing the text in the web element (I guess I might already be able to do that with my current knowledge of Selenium)
I talked to the developer of that application and he told me he actually just adds one HTML input element of type date to the application. The rest (i.e. the renderer/editor of that input field as I presented in the question above) is totaly browser-specific. It looks like that in Chrome and entirely different in Firefox.
The above described web element seems to be the regular HTML 5 DateTime selection in Chrome. With that knowledge you can find the web element yourself and a tutorial for Selenium here: https://www.guru99.com/handling-date-time-picker-using-selenium.html and another discussion similar to my question here: How to set HTML5 type="date" input fields (e.g. in Chrome) using Selenium/Protractor?
The guru-page obviously describes how to control the full web element and it seems to work. I will check this out and accept this as the answer for now. Thanks everyone for your time!

How to add a non-printable image in xsl / apache-fop

I'm trying to generate an xsl to be printed in a pre-printed sheet which works fine.
Now i want to give the user a better previsualization (in the pdf screen version) adding a background image which emulates the "pre-printed" stuf on the sheet to give the user a "context" of what is he printing.
The question is: Is there any way I can set a background image in xsl (using apache fop) visible only in pdf but not in the printed version of it?
Thank you all for reading or givin any advice.
Although as the comments state, you can't have content in the PDF that does not come out in a physical printed copy, here is one possible work around for you. Depending on how your users are ultimately going to be using FOP for PDF rendering and how your a driving the work flow, it's possible to pass a parameter into an xslt file before the transofrmation phase is run, so potentially, you could do a dual rendering of the same PDF, one that is presented to the user where the background image is enabled, and one that gets printed, you could just set a variable similar to how they do in this Example, and call it something like $isPreview, and just use a simple if or choose statement to check for 'Y' or 'N'.
Since you are sending to a printer, you may even want to take advantage of FOP's ability to generate to Postscript rather than PDF, I've used this feature quite extensively for print documents using FOP while also producing a PDF copy for electronic delivery via email or hosted services, and I've yet to find any discrepancy between the PDF rendering and what is printed after sending a rendered postscript file, so it should work well for you as well.
As I said, this is not truly a solution to your problem as you've presented it, but as a work around, it could get you the desired results if your clever about how you implement it.
I don;t think the statement that it is not possible is true, I am just not sure how to create such a PDF with FOP. Certainly you can add an image field. One would use a button field and place the image in the button. Then you would set the properties of that button to not print (printable false).
PDF support images in fields: https://answers.acrobatusers.com/adding-image-field-form-q41825.aspx
RenderX supports PDF Form fields but I do not see where they support an image inside the button, only text: http://www.renderx.com/reference.html#PDF%20Forms. But they do support setting a field to "printable".

Disabling table structure

I have a comprehensive web application with the use of lots of nested tables.
This app works fine for desktop version / view.
I am in the process of getting it setup for mobile view. Which is nearly done, BUT:
I am using JSP and java to, for example, retrieve search results. All of these are displayed in one row at a time.
I am not able to make this row fit onto a mobile screen, so what I am looking for is a JavaScript function to disable the table structer, and just show the columns underneath each other e.g. - comparable with opera mini MOBILE VIEW, which with the click of a button makes contect fit to any screen size. My web app works fine, except of some tables, such as search results. I do not want to change the JSP, not create new pages - that would be too much work !
All I want is to include a certain JavaScript file if the connected user comes via handheld device (which works) and disable the tables, or make it fit properly to the screen !!
I hope someone is able to come up with a solution, I have tried everything with CSS, and few JavaScript bits (which I am not so familiar with)
I have two seperate CSS files, depending on the medium u conenct with, it chooses the right one.
BUT HOW TO GET RID OF THE TABLE OVERFLOW / that the data will be displayed fine, without having to scroll left and right on a small device, which as u know is very annoying ;) !?!?!?
Best regards
ALEX
Try using an alternative stylesheet:
tr{display:block;}
td{display:inline-block;}
...this should allow cells to float inside their parent row.
Example: http://jsfiddle.net/doktormolle/nu62m/

Categories

Resources