path: root/documentation/printing.mdwn
diff options
Diffstat (limited to 'documentation/printing.mdwn')
1 files changed, 65 insertions, 0 deletions
diff --git a/documentation/printing.mdwn b/documentation/printing.mdwn
new file mode 100644
index 0000000..a7f9ee2
--- /dev/null
+++ b/documentation/printing.mdwn
@@ -0,0 +1,65 @@
+[[!meta title="Documentation/Printing"]]
+[[!meta author="James Bursa"]]
+[[!meta date="2010-03-01T02:56:52Z"]]
+[[!toc]] This document is supposed
+to be a short guide of adding paged output to NetSurf. Currently the two
+pieces of code using the print implementation are PDF export and GTK
+The first thing the new paged output has to do is implementing the
+printer interface located in printer.h. It consists of four elements:
+- plotter. This are the plotters which will be used while redrawing
+ the content.
+- print\_begin. This function is called right after the set up and
+ should manage all the remaining user-specific initialisation stuff.
+- print\_next\_page. This function is called before the actual
+ printing of each page allowing to prepare the content to be printed.
+- print\_end. This function is called right before the printing
+ routines clean after themselves and should be used for saving the
+ output to a file, freeing previously allocated memory, relesing
+ document handles etc.
+The provided print interface consists of a set of functions which can be
+used seperately and one integrating them all making the print a matter
+of one call. If it is enough you can just call print\_basic\_run and
+wait for it to return. However, for the case you can't accompish the
+printing task this way the print interface gives you the possiblity of
+calling the print steps individually.
+Only if you are using print\_basic\_run you can omit specifying the
+print settings. If this is the case the default ones will be used.
+As you will notice the functions correspond to those you had to
+implement in the printer. The reason for this is adding some flexibility
+to the system which occured necessary i.e in the GTK print
+- print\_set\_up. This sets the printing system up and calls
+ print\_begin
+- print\_draw\_next\_page. Here after calling print\_next\_page one
+ full page of the dimensions given in the print settings is plotted
+- print\_cleanup. This function is responsible for freeing all used
+ resources right after calling print\_end
+This is where the besic information about the print job is held. You can
+use one of the predifined sets(DEFAULT and OPTIONS) or add your own. In
+order to do that you have to follow this steps:
+- add your entry to the print\_configuration enum
+- add handling of it to the switch in print\_make\_settings
+- add the entry name to this document
+[[!inline raw=yes pages="Documentation"]]