Hi,

I have written a XPI command line module that it lets you to print a page to
a postscript file and convert it to PDF using ps2pdf. What I found is that
the printing engine creates very different result than the on-screen
rendering engine and of course many of the print CSS style like
page-break-after:always is not being used in the on-screen version.

Eli, I am curious how page breaks would work with "dump screen output is to
use
<canvas> with drawWindow and toDataURL to get a raster image of a
webpage", does the on-screen version (not paginated version) has the notion
of the page?

If not, can you give me some hint on how to cut the raster image web page
into pages?

Also, I am trying to implement *page-break-after:avoid*, if anyone can give
me a hint how to do this that would be great.
What I am thinking is that using the *nsSimplePageSequence::**Reflow* to
detect when Reflow thinks it needs a page break, it would call *
CreateContinuingPageFrame* to create a new page, then go into that page and
found whether the last child of the last frame has the
page-break-after:avoid style set, if so, move that frame into a new page and
put that last child into the page.

Any help is appreciated!

Many Thanks
Patrick


For the

On 1/2/07, [EMAIL PROTECTED] <
[EMAIL PROTECTED]> wrote:

Send dev-tech-layout mailing list submissions to
       [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
       https://lists.mozilla.org/listinfo/dev-tech-layout
or, via email, send a message with subject or body 'help' to
       [EMAIL PROTECTED]

You can reach the person managing the list at
       [EMAIL PROTECTED]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of dev-tech-layout digest..."


Today's Topics:

  1. Re: Rendering HTML+CSS to PDF/SVG/JPEG (Eli Friedman)
  2. Re: Rendering HTML+CSS to PDF/SVG/JPEG (Ilya Schurov)


----------------------------------------------------------------------

Message: 1
Date: Mon, 01 Jan 2007 15:23:11 -0800
From: Eli Friedman <[EMAIL PROTECTED]>
Subject: Re: Rendering HTML+CSS to PDF/SVG/JPEG
To: [email protected]
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=KOI8-R; format=flowed

Hi,

You can use the embedding APIs to integrate Gecko layout/printing
functionality into your own application.  See
http://developer.mozilla.org/en/docs/Embedding_Mozilla .  Alternatively,
you could make an XULRunner application which uses the printing APIs.

Dumping a webpage to a PDF is not implemented.  It actually wouldn't be
very hard to implement on the trunk, but nobody has done it. It could be
an interesting project to implement PDF dumping for webpages.

An alternative if you're looking to dump screen output is to use
<canvas> with drawWindow and toDataURL to get a raster image of a
webpage using Gecko >= 1.8.1.  Not especially pretty or fast, but doable.

-Eli

Ilya Schurov wrote:
> Hi list,
>
> I would like to use Gecko layout engine in order to convert my HTML/CSS
> documents (with images, background, etc.) into some printable media like
> PDF or SVG or high-resolution JPEG image. Is it possible to do so --
> i.e. to "grab" rendering output to some kind of file? I can't simply use
> Firefox printing functionality, because I would like to incorporate it
> into the standalone application.
>
> I didn't find anything on this topic in the docs -- just unanswered
> question in the wiki [1] concerning invoking Gecko engine from the
shell.
>
>  1. http://wiki.mozilla.org/Gecko:Frequently_Asked_Questions
>


------------------------------

Message: 2
Date: Tue, 02 Jan 2007 15:00:10 +0300
From: Ilya Schurov <[EMAIL PROTECTED]>
Subject: Re: Rendering HTML+CSS to PDF/SVG/JPEG
To: Eli Friedman <[EMAIL PROTECTED]>
Cc: [email protected]
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=KOI8-R; format=flowed

Hi, Eli,

Thank you for your response!

> You can use the embedding APIs to integrate Gecko layout/printing
> functionality into your own application.  See
> http://developer.mozilla.org/en/docs/Embedding_Mozilla .  Alternatively,
> you could make an XULRunner application which uses the printing APIs.
Is it possible to make Gecko to print the document layout exactly as
it's displayed on the screen? As far as I understand, normally Firefox
re-render layout to make it more printer-friendly (e.g. removes
backgrounds, rearranges objects, etc.), but I doesn't need this stuff.

> Dumping a webpage to a PDF is not implemented.  It actually wouldn't be
> very hard to implement on the trunk, but nobody has done it. It could be
> an interesting project to implement PDF dumping for webpages.
Hmm, I see. Actually, this feature can turn Gecko into typesetting
engine and it sounds cool. Not sure I'm ready now to start such a
project, so I'll try to find another ways to solve the problem. But I'll
write it to my long-term TODO list :)

> An alternative if you're looking to dump screen output is to use
> <canvas> with drawWindow and toDataURL to get a raster image of a
> webpage using Gecko >= 1.8.1.  Not especially pretty or fast, but
doable.
It seems there's a problem with resolution. As far as I understand, by
default the engine assumes the output resolution is rather low (72 dpi),
but I need to prepare layout image to be printable in 300 dpi. E.g. if I
have a picture 2000x3000, the engine need to downscale it to show on the
screen (and this downscale information is normally written to <img> tag,
like <img width=600...>), but on print I doesn't need this downscaling.
Is it possible to specify the resolution of the canvas or something like
this?

And does I need to have some really visible canvas to dump the image, or
it can be done on invisible canvas?

--
With best regards,
Ilya V. Schurov.




------------------------------

_______________________________________________
dev-tech-layout mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-layout


End of dev-tech-layout Digest, Vol 12, Issue 2
**********************************************

_______________________________________________
dev-tech-layout mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-layout

Reply via email to