Bug 77847 - Wish: Add 'PDF Format' to 'Save As' and 'Export' menu of all KOffice applications
Summary: Wish: Add 'PDF Format' to 'Save As' and 'Export' menu of all KOffice applicat...
Status: RESOLVED FIXED
Alias: None
Product: koffice
Classification: Applications
Component: general (show other bugs)
Version: 1.3
Platform: Compiled Sources Linux
: NOR wishlist
Target Milestone: ---
Assignee: KOffice Bug Wranglers
URL:
Keywords:
: 106763 117221 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-03-17 16:53 UTC by Dik Takken
Modified: 2009-05-11 10:22 UTC (History)
10 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Patch for testing print to PDF (2.60 KB, text/x-diff)
2004-03-25 20:16 UTC, Nicolas Goutte
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dik Takken 2004-03-17 16:53:40 UTC
Version:           1.3 (using KDE KDE 3.2.0)
Installed from:    Compiled From Sources
OS:          Linux

None of the KOffice applications support saving or exporting to PDF format. Yes, KOffice can create PDF documents, but this functionality is hidden in a place where many users will never find it: In the Print dialog. 

For the sake of usability: Please add 'PDF' to the list of supported export formats, such that users can use PDF export in the same way as any other export format.
Comment 1 Nicolas Goutte 2004-03-18 20:20:00 UTC
I see three possible ways:
- change the filter system
- create document-filters
- add a "File/Print To PDF..."

Currently, the biggest question is how KPrinter would allow to directly select 
the PDF printer from the application.

As for the 3 ways:
- Compared to the other solutions, changing the filter system would probably 
need more manpower, unfortunately something we have only in a limited way.
- For the filter way (as a document-filter not as a file-filter as normal), 
the problem that we have then only access to a KoDocument and that we then 
have to find a view to print.
- "File/Print To PDF..." is probably the easiest to do (if possible). It would 
avoid that a user has to search somewhere else than in the File menu for how 
to create a PDF.

Any of the above solutions need some manpower and it is unfortunately not the 
"sake of usability" that will give additional manpower to us. (Of course, as 
always, volounteers welcomed!)

Have a nice day!

Comment 2 Nicolas Goutte 2004-03-20 00:58:17 UTC
The first tests are not encouraging, as the printer "Print to File (PDF)" seems not to be able to be selected from outside KPrinter. (May be somebody has more time to test more in depth.)

Have a nice day!
Comment 3 Dik Takken 2004-03-20 01:20:25 UTC
In case this wish is difficult to realise, maybe you can ask the KPrinter people to adapt their API such that KDE application developers can add PDF export without much work.

By the way, is it possible to show a PDF export settings dialog when the user selects 'export to PDF'? It would be even more weird if you can export directly from the File menu, but you have to look for settings in the printer dialog. 

Scribus has a very nice PDF export dialog, it would be great if KDE apps could get something like that. But I guess KPrinter currently implements the PDF exporter just like any other printer, so this might be difficult to achieve.
Comment 4 James Richard Tyrer 2004-03-22 00:39:23 UTC
If you execute:

kprinter --help

You get:

  -c                        Make an internal copy of the files to print
  -P, -d <printer>          Printer/destination to print on
  -J, -t <title>            Title/Name for the print job
  -#, -n <number>           Number of copies
  -o <option=value>         Printer option
  -j <mode>                 Job output mode (gui, console, none) [gui]
  --system <printsys>       Print system to use (lpd, cups)
  --stdin                   Allow printing from STDIN
  --nodialog                Do not show the print dialog (print directly).

indicating that you are supposed to be able to control it from the command line.  I can't get this to work:

kprinter -P PDF -j none test.ps

Perhaps that ("PDF") isn't the correct name for the PDF "printer".

If this actually doesn't work then it is a Kprinter bug that must be fixed before we can add the feature to KWord.

--
JRT
Comment 5 James Richard Tyrer 2004-03-22 00:40:54 UTC
This appears to be a needed feature.

OO has a toolbar icon to make a PDF.

--
JRT
Comment 6 Nicolas Goutte 2004-03-24 19:35:48 UTC
On Wednesday 24 March 2004 07:31, James Richard Tyrer wrote:
> This appears to answer the question about direct export to PDF.

I suppose that you are discussing about bug #77847. 

I am sorry but I do not understand why using the command line tool kprinter 
would be relevant. But perhaps it is a misunderstanding that the main 
kdeprint class has the same name (KPrinter.)

The problem is that code cannot set a special printer for the class KPrinter. 
That is also what you seem to have found by the way of the command line tool 
kprinter.

So probably it remains to check how to use the "external program" feature of 
KPrinter. However instead of using ps2pdf, I would prefer using GhostScript 
directly (what kdeprint does too.)

Have a nice day!

>
> A slight addition needs to be made to 'kprinter' first.
> ---------------------------------------------------------------------------
>-
>
> > Thank you for your assistance.
> >
> > OK, so I tried this in HEAD:
> >
> > 	kprinter --nodialg -P "Print to File (PDF)" test.ps
> >
> > This results in a dialog popping up to ask me for the name of
> > the output
> > file.  This isn't going to work.  I need to be able to
> > specify the output
> > file name on the command line or to tell it to use the input
> > file base name
> > and change the extension to 'pdf'.
>
> This case is not forseen. Note that if you just want to convert
> a PS file to PDF, then the easiest is to use ps2pdf directly
> (which is kprinter does anyway).
>
> Michael.
> _______________________________________________
> kde-print mailing list
> kde-print@kde.org
> https://mail.kde.org/mailman/listinfo/kde-print
>
> _______________________________________________
> koffice-devel mailing list
> koffice-devel@mail.kde.org
> https://mail.kde.org/mailman/listinfo/koffice-devel

Comment 7 Michael Goffioul 2004-03-25 09:02:09 UTC
Some interesting links:
- kdelibs/kdeprint/kprintaction.h
- KPrinter::autoConfigure(...)
- http://printing.kde.org/developer/tutorial/

Basically, exporting to PDF means something like (for example):

KPrinter prt(false);
if (prt.autoConfigure(i18n("Print to File (PDF)"), parentW))
{
   // do printing
}

Put this into a slot, and attach it to a "Export to PDF..." menu
entry, and you're done.

Michael.
Comment 8 Nicolas Goutte 2004-03-25 20:16:47 UTC
Created attachment 5392 [details]
Patch for testing print to PDF

I have tried to test as explained. However as for my previous test, it does not
work. (Again the special printer seems not to be settable, at least in KDE
3.2.x.) The resulting file is not a PDF file but a normal PostScript file.

Note: the test patch transforms the normal print into a PDF print.

Have a nice day!
Comment 9 David Faure 2004-03-25 20:21:05 UTC
On Thursday 25 March 2004 20:16, Nicolas Goutte wrote:
> I have tried to test as explained. However as for my previous test, it does not
> work. (Again the special printer seems not to be settable, at least in KDE
> 3.2.x.) The resulting file is not a PDF file but a normal PostScript file.
Yes, Michael suggested using a KProcess to call ps2pdf on it, to convert it to PDF.

Comment 10 Dik Takken 2004-03-25 21:47:13 UTC
This all sounds like it's way more complicated than it should be. Adding PDF Export to KDE applications should be easy. If it's not, developers are less likely to add it to their own applications. Maybe KPrinter should be adapted to make adding PDF Export easy?
Comment 11 Nicolas Goutte 2004-03-25 22:10:31 UTC
(..)
> On Thursday 25 March 2004 20:16, Nicolas Goutte wrote:
> > I have tried to test as explained. However as for my previous test, it
> > does not work. (Again the special printer seems not to be settable, at
> > least in KDE 3.2.x.) The resulting file is not a PDF file but a normal
> > PostScript file.
>
> Yes, Michael suggested using a KProcess to call ps2pdf on it, to convert it
> to PDF.

As far as I have understood, that is not what Michael has suggested for this 
bug. He has suggest to use a special configure function to select the PDf 
printer. So if you select the PDF printer, you should not have to convert it 
in PDf afterwards. (My goal is to avoid code duplication with kdeprint. 
especially as we have until KDE4 to do it anyway.)
(...)

Have a nice day!

Comment 12 Michael Goffioul 2004-03-26 10:11:26 UTC
There was a bug in kdeprint, which is fixed now (HEAD and 3.2.x branch). Your patch now works as expected.

Note however that I see a potential problem: the translation of 'Print to File (PDF)'. For this thing to work, the translation provided for that string in the koffice.po files *must* be the same as the one used in kdelibs/kdeprint/specials.desktop (otherwise, the special printer won't be found).
That's why using a KPrintAction might be better because it communicates directly with the print manager, and the printer name is not hard-coded in koffice.

Michael.
Comment 13 Nicolas Goutte 2004-03-26 18:00:50 UTC
(...)
>There was a bug in kdeprint, which is fixed now (HEAD and 3.2.x
> branch). Your patch now works as expected.

Thank you for fixing the bug.

>
> Note however that I see a potential problem: the translation of 'Print to
> File (PDF)'. For this thing to work, the translation provided for that
> string in the koffice.po files *must* be the same as the one used in

Yes, I do not like this either.

For example a few people have reported that their KOffice was not translated 
but their KDE was. So I suppose that such problems will appear again in 
future.

> kdelibs/kdeprint/specials.desktop (otherwise, the special printer won't be
> found). That's why using a KPrintAction might be better because it
> communicates directly with the print manager, and the printer name is not
> hard-coded in koffice.

Good, I will look at it.

>
> Michael.

Have a nice day!

> ____________________________________
> koffice mailing list
> koffice@mail.kde.org
> To unsubscribe please visit:
> https://mail.kde.org/mailman/listinfo/koffice

Comment 14 James Richard Tyrer 2004-04-16 01:50:08 UTC
Dik Takken wrote:
> ------- You are receiving this mail because: -------
> You are the assignee for the bug, or are watching the assignee.
>       
> http://bugs.kde.org/show_bug.cgi?id=77847      
>            Summary: Wish: Add 'PDF Format' to 'Save As' and 'Export' menu of
>                     all KOffice applications
>            Product: koffice
>            Version: 1.3
>           Platform: Compiled Sources
>         OS/Version: Linux
>             Status: UNCONFIRMED
>           Severity: wishlist
>           Priority: NOR
>          Component: general
>         AssignedTo: koffice kde org
>         ReportedBy: d.h.j.takken phys uu nl
> 
> 
> Version:           1.3 (using KDE KDE 3.2.0)
> Installed from:    Compiled From Sources
> OS:          Linux
> 
> None of the KOffice applications support saving or exporting to PDF format. Yes, KOffice can create PDF documents, but this functionality is hidden in a place where many users will never find it: In the Print dialog. 
> 
> For the sake of usability: Please add 'PDF' to the list of supported export formats, such that users can use PDF export in the same way as any other export format.

This is the way Linux works.  To send a fax or make a PDF, you use the 
printer queue system.

I'm not certain that applications should be designed based on the stupidity 
of potential users.  But in the case of PDF I suppose that it does make 
some sense since it is possible to produce a PDF without going through the 
print system.  You do need to make a PostScript file first though, just 
like printing.

--
JRT

Comment 15 Dik Takken 2004-04-17 13:40:42 UTC
> This is the way Linux works. To send a fax or make a PDF, you use the
> printer queue system.

Sorry, this sort of response really pisses me off. If you expect users to take UNIX/Linux the way it is, you should throw away 90% of the KDE. 

You see, the goal of the KDE is to provide an interface into UNIX that is intuitive to humans in stead of computer scientists. Most humans have no idea what PDF and Postscript have to do with printing. That's why we cannot assume users to know that creating a PDF and printing a document are related in any way.

Note that I don't say that most computer scientists aren't human but that most humans aren't computer scientists.  :) That's why KDE exists.
Comment 16 Mohd Asif Ali Rizwaan 2005-05-04 04:39:46 UTC
"SAVE AS PDF" -- Not Just for KOFFICE but for ALL KDE APPLICATIONS, please!!!

KWRITE, Kolourpaint, KSnapshot, all those Application which can SAVE anything must support "Save as PDF" because PDF is cross platform and consistent! 

"Print to PDF" is really weird! why not use "Print to Text", "Print to kwd", "Print to odt" ;)

"Save as PDF" is more human, "Print to PDF" is inhuman!
Comment 17 Thiago Macieira 2005-05-04 06:12:59 UTC
According to the KDE HIG, that would be an Export rather than Save As.
Comment 18 David Faure 2005-05-04 09:13:40 UTC
On Wednesday 04 May 2005 04:39, Mohd Asif Ali Rizwaan wrote:
> "SAVE AS PDF" -- Not Just for KOFFICE but for ALL KDE APPLICATIONS, please!!!


Your comments will only be ignored if you keep using all-caps and exclamation marks.
Comment 19 Dik Takken 2005-05-04 09:36:36 UTC
But mister Mohd Asif Ali Rizwaan is right about this. PDF is an exceptionally useful document format. It should be very easy to create these from any KDE application.

I don't know if every KDE application should add PDF export on its own, or if the KDE libraries could provide PDF export capability that applications can inherit. 

Should I file a bugreport for every KDE application, for KDELibs, or KPrinter perhaps?
Comment 20 Michael Goffioul 2005-05-04 11:46:22 UTC
Please do not report a bug for kprinter: it *can* produce PDF files, based on its pseudo-printer mechanism, and some additional features to use it in a user-friendly way. See for example http://printing.kde.org/developer/tutorial/action.php and http://printing.kde.org/developer/tutorial/export2.png

It's up to the application to make use of it.

Michael.
Comment 21 David Faure 2005-05-04 13:55:37 UTC
On Wednesday 04 May 2005 09:36, Dik Takken wrote:
> Should I file a bugreport for every KDE application, for KDELibs, or KPrinter perhaps?


Not much point, since nothing will happen until Qt4's PDF painter backend anyway.
Comment 22 Nicolas Goutte 2005-06-04 22:12:34 UTC
*** Bug 106763 has been marked as a duplicate of this bug. ***
Comment 23 David Faure 2005-11-28 20:02:26 UTC
*** Bug 117221 has been marked as a duplicate of this bug. ***
Comment 24 David Faure 2005-11-28 20:04:22 UTC
I withdraw my comment #21, not sure why I said that. We'll get a better PDF output with Qt4, but that's unrelated.
Comment 25 Dik Takken 2005-11-29 10:30:26 UTC
So, should I:

* Rename this report and re-assign to kdelibs?
* Leave this open as a KOffice feature request and open a seperate report that requests PDF export support for all KDE apps?

Comment 26 David Faure 2005-11-29 10:41:48 UTC
On Tuesday 29 November 2005 10:30, Dik Takken wrote:
> * Rename this report and re-assign to kdelibs?

No, Michael said kdeprint had all that was needed for it.

> * Leave this open as a KOffice feature request 

Yes - this could be done with a KOffice filter. I might start on that soon...

> and open a seperate report that requests PDF export support for all KDE apps? 

That's what will not happen until kde4 imho. We don't have the framework for it,
so nobody is going to go through all kde apps one by one, it would be stupid.
Comment 27 Dik Takken 2005-11-29 10:47:56 UTC
> That's what will not happen until kde4 imho.

I know. I wanted to request this as a kdelibs-4 feature.
Comment 28 David Faure 2005-11-30 21:28:14 UTC
OK I tried to create a koffice filter for exporting to PDF. Almost works except that kdeprint doesn't notice that I'm asking for a pseudo-printer, it asks cups for the printer "Print to File (PDF)" (!).

We know already the output filename, in the filter, so I can't use autoConfigure(). Instead the code looks like:

    KPrinter printer( false );
    printer.setDocName( title.isEmpty() ? in : title );
    printer.setDocFileName( out );
    printer.setDocDirectory( document->url().directory() );
    printer.setPrinterName( i18n( "Print to File (PDF)" ) );
    view->setupPrinter( printer );
    view->print( printer );

where out is the path to the output file.
I get:

cupsdoprint -P 'Print to File (PDF)' -J '' -H 'localhost:631' -U 'dfaure' -o ' orientation-requested=3' '/tmp/kde-dfaure/kdeprint_hCJGuREw' : execution failed with message: client-error-not-found 

Michael/Cristian, can kdeprint be fixed to recognize pseudo printers in setPrinterName? Or do you see a better solution?
Comment 29 FiNeX 2008-06-01 19:10:04 UTC
Three year later...

Currently "PDF" virtual printer are commonly used, is this request still valid (and useful) ???
Comment 30 Alon Bar-Lev 2008-06-01 19:14:55 UTC
Yes, I believe it is needed.

Virtual printers cannot create tagged PDF (with cross-ref), cannot embed external cross refs (URLS, mail) and document bookmarks. For example, implement hot spot in table of contents that jumps to the relevant page.

Also giving up on this will not enable creating PDF forms (in future).

Please try to support PDF as it is the truly portable viewer / print source.

Thank you.
Comment 31 fake name 2008-06-01 19:50:50 UTC
*** This bug has been confirmed by popular vote. ***
Comment 32 James Richard Tyrer 2008-06-01 23:30:39 UTC
Re: Comment #30

This is a valid point for KOffice. However, for many applications, an additional entry point and GUI for KPrint is all that is needed and something that should probably be done first.

For KOffice, we would need a way to create such content.  Do we add features to KWord, or do we need an additional KOffice application?

Then there is the question of how to produce the PDFs with these additional features.  Will GhostScript do this, or do we need to use another library to create the PDFs?
Comment 33 Dik Takken 2008-06-02 16:37:12 UTC
Adding support for PDF features like cross references and forms is something that every application will have to implement on its own. I guess it's quite a lot of work to implement this.

My original wish was to simply add the existing PDF creation facility to a place where users can find it. That would be a huge usability improvement that is relatively simple to implement.
Comment 34 markus 2008-06-02 17:10:15 UTC
I strongly agree!
Comment 35 John Layt 2008-06-02 18:06:55 UTC
I actually have an action point in the 4.1 feature plan to do this, but it is now deferred to 4.2.  It's not a huge amount of work anymore, I just haven't had the time.  I also need to post an RFC to the core mailing list first to get approval.

The plan is to define a KStandardAction which applications can choose to add alongside the Print and Print Preview standard actions.  The code would be borrowed from KPrintPreview, which currently prints a flat PDF via QPrinter to a temp file and calls the default pdf viewer to display it.  The "Export to PDF" action would just call up a KFileDialog instead for the user to decide where to save it to.  This would be completely cross-platform and would support all the PDF options from Qt.  The print dialog would not be displayed, if the user wants to mess with the options they can use the standard print action.  More advanced apps could choose to implement their own pdf export if they need features unsupported by QPrinter such as links and fields.

Feel free to reassign to me :-)
Comment 36 Sven Langkamp 2009-05-10 17:02:58 UTC
In KOffice 2 it's under File->Export as PDF. That should be easy enough to find to consider this bug fixed, I think.
Comment 37 Thomas Zander 2009-05-11 10:22:09 UTC
Certainly is :)
Fixed version KOffice2.0