Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #30229

Re: OT : min. requirements for printing web page content

Path csiph.com!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail
From Aleksandro <aleksandro@gmx.com>
Newsgroups comp.lang.javascript
Subject Re: OT : min. requirements for printing web page content
Date Wed, 6 Apr 2016 10:57:51 -0300
Organization A noiseless patient Spider
Lines 31
Message-ID <ne34eq$f6i$1@dont-email.me> (permalink)
References <ne1qnb$763$2@dont-email.me> <print-20160406032602@ram.dialup.fu-berlin.de> <ne2bvd$l8d$1@dont-email.me> <ne2lf9$m7g$1@dont-email.me>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 8bit
Injection-Date Wed, 6 Apr 2016 13:54:34 -0000 (UTC)
Injection-Info mx02.eternal-september.org; posting-host="519900093824c292069f105f937e2bdc"; logging-data="15570"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/37xrfF/fQNcMI3xPjqzbuCHgfQCgvrCM="
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.1
In-Reply-To <ne2lf9$m7g$1@dont-email.me>
Cancel-Lock sha1:EVsr2U0oWyqsz6XFlgehTgWjQyQ=
Xref csiph.com comp.lang.javascript:30229

Show key headers only | View raw


On 06/04/16 06:41, Teodor V. wrote:
> On 2016-04-06 09:00, Mike S wrote:
>> On 4/5/2016 7:33 PM, Stefan Ram wrote:
>>> Mike S <mscir@yahoo.com> writes:
>>>> Iow can I ignore everything but the content I
>>>> want to print and use html tags to formate it, like maybe just
>>>> formatting the content in a new div and printing that?
>>>
>>>    Yes. Copy the content to a new window. »w = window.open ...«,
>>>    »w.write( contents )«, »w.print ...«.
>>>
>>>    If you have a popup-blocker: Use a custom css for printing,
>>>    which will hide everything but the content.
>>>
>>>    Or: Save the old document in a variable. Replace document by
>>>    content. Print. Restore old document.
>>>
>>>    In jQuery, see »printElement«.
>>>
>> printElement looks good.
>>
>> http://www.bennadel.com/blog/1591-ask-ben-print-part-of-a-web-page-with-jquery.htm
> 
> FWIW, the CSS approach is the most compatible for users who fly with
> Javascript disabled.
> I use it the pages I design, minimal CSS and formatting, just enough to
> produce a clean printout.

I would never trust Javascript for such a thing, an appropriate CSS
query is the correct way to do it.

Back to comp.lang.javascript | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

OT : min. requirements for printing web page content Mike S <mscir@yahoo.com> - 2016-04-05 19:05 -0700
  Re: OT : min. requirements for printing web page content Mike S <mscir@yahoo.com> - 2016-04-06 00:00 -0700
    Re: OT : min. requirements for printing web page content "Teodor V." <teodor-see-signature@invalid.invalid> - 2016-04-06 11:41 +0200
      Re: OT : min. requirements for printing web page content Aleksandro <aleksandro@gmx.com> - 2016-04-06 10:57 -0300
      Re: OT : min. requirements for printing web page content Mike S <mscir@yahoo.com> - 2016-04-07 23:45 -0700
  Re: OT : min. requirements for printing web page content Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-04-06 20:22 +0200

csiph-web