[scribus-dev] PDF output

Elvis Stansvik elvstone at gmail.com
Mon Aug 22 11:20:57 UTC 2011


Hey folks,

So, for the first time I took a closer look at what's involved in
getting PDF output of an item.

Somehow I had imagined that there would actually be some form of
painter API available for it. But it seems that you actually have to
manually append PS/PDF commands to a string in
PDFLibCore::PDF_ProcessItem(...) :(

Is this correct?

This seems extremely fragile to me, and I've never worked with the PS
language directly before. I see that the PDFLibCore has at least some
convenience functions that might help me with the generation.

If I haven't missed anything and this really is the way to do it, then
I guess the best/easiest way forward is to:

1) Make the existing CollapsedTablePainter (which handles painting of
a table to canvas, e.g. painting to an ScPainter) a friend of
PDFLibCore, to be able to access its convenience functions.

2) Add something like a

CollapsedTablePainter::paintTablePDF(PageItem_Table* table, PDFLibCore
*pdf, QString& output)

function that will append the PDF commands to the output parameter,
and which will use convenience functions of PDFLibCore where
appropriate.

3) Have PDFLibCore keep an instance of CollapsedTablePainter and have
it call paintTablePDF(...) in PDF_ProcessItem(...) when encountering a
table item. This is analog to how the PageItem_Table itself currently
has an instance of CollapsedTablePainter and calls the paintTable(...)
function in DrawObj_Item(...) to paint the table on canvas. A lot of
code in CollapsedTablePainter can then hopefully be reused.

Because I guess that out of the non-canvas outputs, output to PDF
should have the highest priority?

Regards,
Elvis



More information about the scribus-dev mailing list