Print Stylesheet - Converting inputs to text
Nope, I don't think this can be done without some scripting. But the scripting would be really easy to achieve with a Framework like Jquery:
For each input element, you would create a
<span>
next to it and give it a class that is hidden in themedia="screen"
stylesheet, and visible inmedia="print"
.The input element itself would get a class that works the other way round, visible in
screen
and hidden inprint
.Each input element would get a
change
event that updates the neighboringspan
.
I don't have the JQuery routine yet to pull this out of my sleeve, and not the time to put it together right now, but it is definitely solvable and still quite unobtrusive - no need to execute any scripting when the user starts printing.
I bet if you re-tag the question or ask a new one, one of our resident JQuery gurus will take a look at it :)
Couple Print Stylesheet Questions
Yes, there is. It's called @media and has been supported in major browsers for a while.
So, let's say that you had something like:
<img class="no-print" src="image" /><span class="print">Image Label</span>
Your style sheet could be something like:
<stye>
.print {display: none;} // only to be displayed when this is being printed so the default is to not display
@media print {
.print {display: inline}
.no-print {display: none}
}
</style>
converting input type text to plain text
This should do it I think.
function disable_all() {
var fs = $("#fileserver"), span = $( "<span>" + fs.val() + "</span>");
span.insertAfter(fs);
fs.remove(); // or fs.hide(); in case you want it later.
}
Conversion of a webpage to text
Use the BeautifulSoup
library together with the requests
library will get you at least to a good start. Once you study the first library some more, you might be able to customize your program to extract only the text you want. See below.
Also, please see here for a similar question: Text Extracting: Used All Methods, Yet Stuck.
import requests
from bs4 import BeautifulSoup
url = 'http://www.uniprot.org/'
content = requests.get(url)
soup = BeautifulSoup(content.text)
print(soup.text)
(Partial) output, hand-picked:
...
The mission of UniProt is to provide
the scientific community with a comprehensive, high-quality and
freely accessible resource of protein sequence and functional
information.
UniProtKBUniProt KnowledgebaseSwiss-Prot (564,277)Manually annotated and reviewed.Records with
...
Related Topics
Css/Webkit: Background Images for Table Row
Can Grid-Row-Gap/Grip-Column-Gap Be Overridden for a Single Gutter
CSS Modules - Referencing Classes from Other Modules
CSS Animation, Absolute Position Go Off Screen to Right and Come Back from Left
Edit Microsoft Chatbot UI Design
Keep Image Ratio Using Max-Width and Max-Height in Ie 11
Aligning <Li> Next to Each Other, Not Working
Add a State Property to an Inline Style in React
Can the :Before and :After Pseudo-Elements Inherit Height from the Parent Element
:Empty Pseudo Class Issue with Added/Removed Content and Sibling Combinators
How to Add Stylesheets to Jsdom
Jquery Mobile Android - Fixed Full-Screen Background Image