Bug 120868 - Failed to create PDF callendar
Summary: Failed to create PDF callendar
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Plugin-Generic-Calendar (show other bugs)
Version: unspecified
Platform: Mandriva RPMs Linux
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-01-27 14:25 UTC by Vladimir Stefanov
Modified: 2018-03-23 21:04 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 0.1.0


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Stefanov 2006-01-27 14:25:02 UTC
Version:           0.8.0 (using KDE KDE 3.5.0)
Installed from:    Mandriva RPMs
Compiler:          gcc-4.0.1-5 
OS:                Linux

In the Tools->Create Callendar, after selecting the pictures for each month, I choose print to file option and then print to pdf. The status bars goes well, and I got 100% done status. But when I tried to open the pdf file, it gives me "invalid file". The file itself is only 54KB in size, although I've included 12 images, 1.5MB each.
Comment 1 Tom Albers 2006-01-27 15:09:57 UTC
Probably still processing in the job queue from kprinter. Check the file after a few minutes.
Comment 2 Angelo Naselli 2006-01-27 20:04:37 UTC
Tom, I'm sorry to say reporter is right, I waited for a while after
printing and when the file stopped growing i opened it. Acroread fails
xghostview opens it but shows only some pages without pictures (or errored
pictures) kpdf crashes...
as far as i know the kipi-plugins is rc1 with a backport from svn 
for a print patch.
Anyway the 100% makes the user confused imo.
Comment 3 Stefano Negro 2006-02-12 22:39:46 UTC
I Confirm that the PDF it's created but the progress bar makes the user confused because it shows 100%. Not Pressing any button and waiting for 1-2 Minutes the file grows. When it's made it works perfectly.
I believe that could be better to have a real progress bar and writing the PDF file step by step.
Like that it's no usable.
Comment 4 Angelo Naselli 2006-02-12 22:57:39 UTC
Stefano I believe this plugin is not intended to be
a pdf creator but a calendar one. 
I believe if you print on a normal printer you didn't expect it prints
quickly and the percentage will probably be at 100% before the
printer receives data to be printed.

Is there a way to have a kprinter status? 
Comment 5 Tom Albers 2006-02-12 23:13:29 UTC
Op zondag 12 februari 2006 22:56, schreef Angelo Naselli:
> Is there a way to have a kprinter status?


I'll look for that when time permits.
Comment 6 Stefano Negro 2006-02-13 08:54:01 UTC
Angelo, I believe that to have also the kprinter status could be good.
So it'll be easier to understand what part of the job it's done by kipi and what by the kprinter.
Comment 7 Stefano Negro 2006-02-19 16:17:18 UTC
Here attached the answer of the KDE-print-devel.
http://mail.kde.org/pipermail/kde-print-devel/2006-February/000639.html
I hope this could help to solve this bug. 

Stefano

>> Hi guys,
>> I kindly ask to this ML help in order to solve this small bug 
>> in the Kipi-plugins. 
>> Doing a PDF file using the KDE function "Print to PDF" our 
>> code shows job completed ( 100% ) but the file it's writed by 
>> kprinter and it takes minutes to be written We'd like to know 
>> if it's possible to have a feedback of file writing for 
>> kprinter, so that we shows the real progress of the job.
>> Thanks in advance for any help

>The PDF generation is actually performed by ghostscript through the
>pseudo-printers mechanism. So the only "feedback" you can have currently
>is "the process is running". Normally, the job viewer supports print
>jobs
>sent to pseudo printers, in that case print jobs are actually child
>processes.
>When sending a print job to a pseudo printer, the job viewer should be
>started
>and runs until the child process finishes.
>
>Michael.
Comment 8 Angelo Naselli 2006-04-15 19:37:43 UTC
Toma i'm reconsidering my position. As Michael answered to Stefano's question
job viewer shows the printer jobs. I launched kjobviewer and selected pdf printer.
The job is longer than the status bar and it started as soon as the printer
dialog has finished showing page number increasing. 
As soon as the job has finished in kjobviewer, i opened the pdf 
correctly with all the readers i have.

I start believing this is a workforme, at least since we can't have a job viewer 
feedback. 
Thinking to windows the print dialog is closed as soon as the job is 
passed to the print queue either a printer or a print server. 
After that it depends on the printer speed.
So it seems to be the same behaviour, even if we're waiting for a file.
Comment 9 Tom Albers 2006-05-02 21:24:01 UTC
SVN commit 536703 by toma:

Start KJobViewer at the last possible moment and add a note just before generating.
BUG: 120868


 M  +31 -20    calwizard.cpp  


--- trunk/extragear/libs/kipi-plugins/calendar/calwizard.cpp #536702:536703
@@ -1,10 +1,12 @@
 /* ============================================================
  * File  : calwizard.cpp
  * Author: Renchi Raju <renchi@pooh.tam.uiuc.edu>
+ *         Tom Albers <tomalbers@kde.nl>
  * Date  : 2003-11-03
  * Description :
  *
  * Copyright 2003 by Renchi Raju
+ * Copyright 2006 by Tom Albers  
  *
  * This program is free software; you can redistribute it
  * and/or modify it under the terms of the GNU General
@@ -67,11 +69,11 @@
            interface_( interface )
 {
     cSettings_ = new CalSettings();
-    
+
     QString directory;
     KGlobal::dirs()->addResourceType("kipi_banner_left", KGlobal::dirs()->kde_default("data") + "kipi/data");
     directory = KGlobal::dirs()->findResourceDir("kipi_banner_left", "banner_left.png");
-    
+
     // ---------------------------------------------------------------
 
     wTemplate_ = new CalTemplate(this, "wTemplate");
@@ -87,7 +89,7 @@
     // ---------------------------------------------------------------
 
     wPrint_ = new QVBox(this, "wPrint");
-    
+
     QFrame *headerFrame = new QFrame( wPrint_ );
     headerFrame->setFrameStyle(QFrame::Panel|QFrame::Sunken);
     QHBoxLayout* layout = new QHBoxLayout( headerFrame );
@@ -102,13 +104,13 @@
     pixmapLabelLeft->setPaletteBackgroundColor( QColor(201, 208, 255) );
     pixmapLabelLeft->setPixmap( QPixmap( directory + "banner_left.png" ) );
     labelTitle->setPaletteBackgroundColor( QColor(201, 208, 255) );
-    
+
     wPrintLabel_ = new QLabel(wPrint_, "wPrint");
     wPrintLabel_->setIndent(20);
 
     wPrint_->setStretchFactor(headerFrame, 0);
     wPrint_->setStretchFactor(wPrintLabel_, 2);
-    
+
     addPage(wPrint_, i18n("Print"));
     setHelpEnabled(wPrint_, true);
 
@@ -134,7 +136,7 @@
     pixmapLabelLeft2->setPaletteBackgroundColor( QColor(201, 208, 255) );
     pixmapLabelLeft2->setPixmap( QPixmap( directory + "banner_left.png" ) );
     labelTitle2->setPaletteBackgroundColor( QColor(201, 208, 255) );
-        
+
     wFinishLabel_ = new QLabel(wFinish_);
     wFinishLayout->addWidget(wFinishLabel_);
 
@@ -158,17 +160,20 @@
     // ---------------------------------------------------------------
 
     // About data and help button.
-    
+
     KAboutData* about = new KAboutData("kipiplugins",
-                                       I18N_NOOP("Calendar"), 
+                                       I18N_NOOP("Calendar"),
                                        kipi_version,
                                        I18N_NOOP("A Kipi plugin to create a calendar"),
                                        KAboutData::License_GPL,
-                                       "(c) 2003-2004, Renchi Raju", 
+                                       "(c) 2003-2004, Renchi Raju, (c) 2006 Tom Albers",
                                        0,
                                        "http://extragear.kde.org/apps/kipi");
-    
-    about->addAuthor("Renchi Raju", I18N_NOOP("Author and maintainer"),
+
+    about->addAuthor("Tom Albers", I18N_NOOP("Author and maintainer"),
+                     "tomalbers@kde.nl");
+
+    about->addAuthor("Renchi Raju", I18N_NOOP("Former Author and maintainer"),
                      "renchi@pooh.tam.uiuc.edu");
 
     m_helpButton = helpButton();
@@ -178,13 +183,13 @@
     m_helpButton->setPopup( helpMenu->menu() );
 
     // ------------------------------------------
-    
+
     printer_  = 0;
     painter_  = 0;
 
     connect(this, SIGNAL(selected(const QString&)),
             SLOT(slotPageSelected(const QString&)));
-            
+
     setCaption(i18n("Create Calendar"));
 }
 
@@ -224,24 +229,30 @@
                 printList.append(month);
             }
         }
-        
+
         if (!monthNumbers_.empty()) {
             QString year = QString::number(cSettings_->getYear());
-            
+
             QString extra;
-            if ((QDate::currentDate().month() >= 6 && 
+            if ((QDate::currentDate().month() >= 6 &&
                  QDate::currentDate().year() == cSettings_->getYear()) ||
                 QDate::currentDate().year() > cSettings_->getYear())
                 extra = "<br><br><b>"+i18n("Please note that you are making a "
                         "calendar for<br>the current year or a year in the "
                         "past.")+"</b>";
-            
+
+            KApplication::startServiceByName("KJobViewer");
+            QString extra2 = i18n("<br><br>You can see KJobViewer is already started. "
+                    "After the plugin has prepared the calendar, it is passed to "
+                    "the PDF printer. In the KJobViewer you can see the progress "
+                    "of that part of the generation of the calendar.");
+
             wPrintLabel_->setText(i18n("Click Next to start Printing<br><br>"
                                        "Following months will be printed for year %1:").arg(year)
                                   + QString("<br>")
-                             + printList.join("<br>") + extra);
+                             + printList.join(" - ") + extra + extra2);
             wPrintLabel_->setTextFormat(Qt::RichText);
-                
+
             setNextEnabled(wPrint_, true);
         }
         else {
@@ -266,7 +277,7 @@
             printer_ = new KPrinter(false);
 #if KDE_IS_VERSION(3,2,0)
         printer_->setUsePrinterResolution(true);
-#endif    
+#endif
 
         // TODO: Let user choose resolutions
         //, QPrinter::HighResolution);