<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>16493</bug_id>
          
          <creation_ts>2007-12-17 15:58:46 -0800</creation_ts>
          <short_desc>[GTK] Provide a public printing API</short_desc>
          <delta_ts>2009-03-23 09:37:39 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebKitGTK</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>22898</dup_id>
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>Cairo, Gtk</keywords>
          <priority>P2</priority>
          <bug_severity>Enhancement</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Alp Toker">alp</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>chpe</cc>
    
    <cc>christian</cc>
    
    <cc>Don</cc>
    
    <cc>mbarnes</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>64591</commentid>
    <comment_count>0</comment_count>
    <who name="Alp Toker">alp</who>
    <bug_when>2007-12-17 15:58:46 -0800</bug_when>
    <thetext>Printing can only be triggered by JS through ChromeClient right now. The API remains internal until we can provide a well-designed, extensible printing interface that accommodates browsers, document viewers, email clients etc. including support for custom headers and footers.

Investigations here should centre around existing GTK+ widgets, the GtkPrint API,  printing solutions in browsers like Epiphany and widgets like GtkHtml and its use in Evolution.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>67702</commentid>
    <comment_count>1</comment_count>
    <who name="Alp Toker">alp</who>
    <bug_when>2008-01-19 07:05:21 -0800</bug_when>
    <thetext>GtkSourceView 2 (the new version) apparently has a nice API for this. We should also look at other browsers and widgets.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>70310</commentid>
    <comment_count>2</comment_count>
    <who name="Matthew Barnes">mbarnes</who>
    <bug_when>2008-02-11 13:40:20 -0800</bug_when>
    <thetext>I helped port GtkHTML from GnomePrint to GtkPrint.  Here&apos;s what I&apos;d recommend as an incremental improvement to webkit_web_frame_print(), similar to what we did for GtkHTML (ignoring header and footer support):

   WEBKIT_API GtkPrintOperationResult
   webkit_web_frame_print (WebKitWebFrame *frame,
                           GtkPrintOperation *operation,
                           GtkPrintOperationAction action,
                           GError **error);

The most important thing here is to allow applications to create their own GtkPrintOperation, configure it with their own print settings from GConf or wherever, and then pass it on to WebKit.  All WebKit needs to do is connect to GtkPrintOperation signals, call gtk_print_operation_run() and return the result.

Also, don&apos;t run an error dialog yourself.  Just return the print result and let the application deal with GTK_PRINT_OPERATION_RESULT_ERROR.

GtkHTML&apos;s new printing API (ignoring the deprecated stuff) consists of a single function similar to above and I think it&apos;s worked out quite nicely.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>70955</commentid>
    <comment_count>3</comment_count>
    <who name="Alp Toker">alp</who>
    <bug_when>2008-02-17 09:11:57 -0800</bug_when>
    <thetext>(In reply to comment #2)
&gt; I helped port GtkHTML from GnomePrint to GtkPrint.  Here&apos;s what I&apos;d recommend
&gt; as an incremental improvement to webkit_web_frame_print(), similar to what we
&gt; did for GtkHTML (ignoring header and footer support):
&gt; 
&gt;    WEBKIT_API GtkPrintOperationResult
&gt;    webkit_web_frame_print (WebKitWebFrame *frame,
&gt;                            GtkPrintOperation *operation,
&gt;                            GtkPrintOperationAction action,
&gt;                            GError **error);
&gt; 

Thanks for this proposal. There&apos;s one thing I haven&apos;t been able to decide that stopped me from implementing it..

We were originally hoping to make WebFrame independent of GTK+ (only using GLib) so it could be used in non GTK+/console GLib applications. If we add the print API to WebFrame, that plan needs to be re-thought.

If we put the print API on WebView, we end up restricting the API only allowing the main frame to be printed.

I have a feeling there&apos;s another simple way of doing this we&apos;ve missed so far. Will think about it some more.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>73857</commentid>
    <comment_count>4</comment_count>
    <who name="Matthew Barnes">mbarnes</who>
    <bug_when>2008-03-15 21:03:54 -0700</bug_when>
    <thetext>Pitched an idea for supporting page headers and footers directly in GtkPrint.  Thought you might be interested.

http://bugzilla.gnome.org/show_bug.cgi?id=522708</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>82361</commentid>
    <comment_count>5</comment_count>
    <who name="Alp Toker">alp</who>
    <bug_when>2008-06-05 13:34:42 -0700</bug_when>
    <thetext>Some applications (Devhelp, Epiphany) are using this as a pretty workable solution for now:

webkit_web_view_execute_script (web_view, &quot;print();&quot;);

This will pop up a GtkPrint window with the user&apos;s default print settings, including a print preview button.
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>114787</commentid>
    <comment_count>6</comment_count>
    <who name="Gustavo Noronha (kov)">gustavo</who>
    <bug_when>2009-03-23 09:37:39 -0700</bug_when>
    <thetext>Another bug has been opened to deal with this; since the patch is in the other bug I&apos;ll close this one as a duplicate.

*** This bug has been marked as a duplicate of 22898 ***</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>