PDF Export: adding the print options

Caolán McNamara caolanm at redhat.com
Thu Sep 5 03:23:53 PDT 2013


On Thu, 2013-09-05 at 00:24 -0700, Brian Fraser wrote:
> 1. Is this a reasonable feature idea?

I think so. Note that under Linux the default print transport format is
now pdf, so e.g. file->print and toggle "print to file" under options
and setting the various options should result in the kind of output you
want

> 2. Would this be reasonably straight-forward to implement (i.e., are
> printing and PDF export as compatible as I might hope)?

I *think* so. It might end up being a bit involved, but in theory at
least we have all the pieces to do that.

> 3. Where is the code for the print dialog's tabs, and the export to
> PDF dialog's tabs?

The PDF export dialog is filter/uiconfig/ui/pdfoptionsdialog.ui (all
these .uis are editable with glade) and each page in that dialog are
the .uis of filter/uiconfig/ui/pdf*page*.ui

The Print dialog is vcl/uiconfig/ui/printdialog.ui and there is a
"custom" tab which is where each applications print options get put,
e.g. the impress one is in "sd/uiconfig/simpress/ui/printeroptions.ui"
and there is some baroque code in PrintDialog::setupOptionalUI in
vcl/source/window/printdlg.cxx where each app sets a property on the
dialog to state which options .ui to put in there followed by the names
of each widget in there and its type so that the dialog can return back
which options got set. For e.g.. impress the other side of the process
to tell the dialog the .ui to load and the description of the properties
is in sd/source/ui/view/DocumentRenderer.cxx (search for
ExtraPrintUIOptions and maProperties)

> 4. Where is the code for setting the output layout (ex: 4 pages per
> sheet)?

When you load the .ui in glade you can see the names of the widgets,
searching for those names will then help find the code, so in this case
"paperspersheetlb" links up eventually to PrintDialog::updateNup where
the n-up stuff gets set onto a printercontroller that figures out how to
control the printing

Hopefully this is enough info for you to put a few breakpoints around on
those places and get a feel for what different code-paths the printing
and pdf export take and see if its possible to marry the pieces together
to do what you want.

C.




More information about the LibreOffice mailing list