Re: PRINT TO PS



On Wed, 2003-11-26 at 17:16, Carlos Alberto wrote:
mmm, well that's true, in fact I only want to change
Gnumeric, and as you say, changing libgnomeprint will
affect all my apps.

Ok, just one more question, gnumeric/src/print.c has a
function called:

void sheet_print (

and it uses a GnomePrintJob pointer called gpm.

What would happen if I replace for example:         
near gnumeric/src/print.c 1309, 0-1

case PRINT_SHEET_RANGE:
   workbook_print_all (pj, sheet->workbook);
   break;

for something like this:

case PRINT_SHEET_RANGE:
   //workbook_print_all (pj, sheet->workbook);
   gnome_print_job_print_to_file (gpm,
"/tmp/output.ps")
   break;

...Can someone help me with this???


Nothing good will happen. Specifically you wouldn't get any output.

Now, if you want to work at that level so that the users still think
they can select a printer but you afterwards sidetrack the output (and
ensure that the users don't file bugs or make derogatory comments about
gnumeric),  then the right place to insert a few commands would be:

in src/print.c at about lines 1292 or so:

---------------------------------------------------------
        if (default_range == PRINT_SHEET_RANGE) {
                pj->start_page = first-1;
                pj->end_page = end-1;
        }

additional code goes here!

        gpm = gnome_print_job_new (print_config);
        pj->print_context = gnome_print_job_get_context (gpm);
        pj->range = default_range;
        if (default_range == PRINT_SHEET_RANGE) {
                pj->start_page = first-1;
                pj->end_page = end-1;
        }

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

Essentially you want to change the print_config to select print to file:

to change the file name (one should suffice but this way at least the
file name also changes in the print dialog):

        gpa_node_set_path_value (print_config, 
                                 "Settings.Output.Job.FileName", 
                                 "/tmp/output.ps");
        gpa_node_set_path_value (print_config, 
                                 "Settings.Transport.Backend.FileName", 
                                 "/tmp/output.ps");

you still need to set the printer and the transport to `FILE'. Check out
the code in libgnomeprintui/gpaui/*.c on pointers how to do that. I am
too busy in the moment to figure out those details. Sorry.

Andreas

-- 
Andreas J. Guelzow
Taliesin Software, Shelties, Pyrsheps
and Shetland Sheep

Attachment: signature.asc
Description: This is a digitally signed message part



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]