Bug 322267 - Okular resizes on printing
Summary: Okular resizes on printing
Status: RESOLVED INTENTIONAL
Alias: None
Product: okular
Classification: Applications
Component: printing (show other bugs)
Version: 0.16.5
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-07-12 06:28 UTC by bugs5.kde.org
Modified: 2014-10-23 20:42 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
original PDF (37.65 KB, application/pdf)
2013-07-15 13:35 UTC, bugs5.kde.org
Details
printed with Okular (2.87 KB, application/pdf)
2013-07-15 13:35 UTC, bugs5.kde.org
Details
printed with Acrobat Reader (2.98 KB, application/pdf)
2013-07-15 13:36 UTC, bugs5.kde.org
Details
Add customTab to the printdialog to set fit-to-page options (2.73 KB, patch)
2014-06-24 03:53 UTC, Nicholas
Details

Note You need to log in before you can comment on or make changes to this bug.
Description bugs5.kde.org 2013-07-12 06:28:45 UTC
In order to print documents out on preprinted form I need to make sure everything is printed where it should be.

When using acroread all is fine but when I print in Okular, the page borders aren't respected anymore, overall size seeems to be changed... etc.

Reproducible: Always
Comment 1 Albert Astals Cid 2013-07-15 13:24:07 UTC
Can you attach one such document?
Comment 2 bugs5.kde.org 2013-07-15 13:35:09 UTC
Created attachment 81124 [details]
original PDF
Comment 3 bugs5.kde.org 2013-07-15 13:35:43 UTC
Created attachment 81125 [details]
printed with Okular

The whole document is moved up to the top and to the right
Comment 4 bugs5.kde.org 2013-07-15 13:36:35 UTC
Created attachment 81126 [details]
printed with Acrobat Reader

Selecting "Page scaling: None" it is printed as it is being displayed on the screen
Comment 5 Albert Astals Cid 2013-07-15 13:47:35 UTC
Setting back to unconfirmed now that documents are attached, if someone wants to give it a try and confirm, that'd be cool
Comment 6 Albert Astals Cid 2014-05-10 14:28:30 UTC
Hi, i just tried to print these two files in Okular 0.19 (KDE Applications
4.13) and it has printed correctly. Please if you can reproduce this problem in
Okular >= 0.19 (KDE Applications >= 4.13) reopen this bug.
Comment 7 bugs5.kde.org 2014-05-20 05:43:11 UTC
Bug still exists.

Stuff gets resized and then the printed info doesn't match the fields on the form anymore. If I print with Adobe Acrobat Reader, no resizing occurs.
Comment 8 Albert Astals Cid 2014-05-20 21:34:10 UTC
Which okular version are you using? Which cups?
Comment 9 bugs5.kde.org 2014-05-20 21:36:57 UTC
Okular
Version 0.19.1
Using KDE Development Platform 4.13.1


CUPS 172-0ubuntu1
Comment 10 Albert Astals Cid 2014-05-20 21:45:38 UTC
can you enable all okular debuging in kdebugdialog, run okular from the shell, print and attach the debug line that has lpr as part of its contents?
Comment 11 bugs5.kde.org 2014-05-21 03:41:50 UTC
howto enable all the okular debugging?
Comment 12 Albert Astals Cid 2014-05-24 11:17:56 UTC
Have you tried using kdebugdialog as i mentioned? What problems you had?
Comment 13 bugs5.kde.org 2014-05-24 12:38:37 UTC
and how to use kdebugdialog?
Comment 14 Albert Astals Cid 2014-05-24 13:36:29 UTC
You open a terminal and write kdebugdialog
Comment 15 bugs5.kde.org 2014-05-24 13:38:59 UTC
and then is all is greyed out... no idea what to do or how it works.
Comment 16 Yuri Chornoivan 2014-05-24 13:40:54 UTC
(In reply to comment #15)
> and then is all is greyed out... no idea what to do or how it works.

Please try

kdebugdialog --fullmode
Comment 17 Nicholas 2014-06-18 04:39:06 UTC
If I can chime in on this one. I've long had the same issue. My printer margins are different, so the test file here still fits in the margins of the printer - but only just. Every file I print is scaled to fit - but not to the actual printer margins.

I tend these days to print PDF files directly using the lpr command

lpr -o BRDuplex=DuplexTumble -o BRTonerSaveMode=ON -o Collate=True filename.pdf

debugging okular shows that it uses the following lpr options:

okular(Okular::FilePrinter::doPrintFiles: Executing "lpr.cups" with arguments ("-P", "BrotherMFC", "-#1", "-J", "filename.pdf", "-o", "media=A4", "-o", "portrait", "-o", "sides=one-sided", "-o", "outputorder=normal", "-o", "Collate=False", "-o", "page-left=10", "-o", "page-top=10", "-o", "page-right=10", "-o", "page-bottom=10", "-o", "fit-to-page", "-o", "BRTonerSaveMode=ON", "-r", "/tmp/kde-nicholas/okulary15700.ps")

Of note there is the -o "fit-to-page". I notice that evince has the ability to select this or not (and deselecting it in evince causes my prints to print out perfectly). being able to do so in okular would also be wonderful!

Of secondary note is that, for my printer (Brother) at least, the "sides=one-sided" option is useless - it is overridden by the printer settings BRDuplex.
Comment 18 Nicholas 2014-06-18 04:50:22 UTC
If it helps, most of my documents I have issues with are LibreOffice draw documents (saved to PDF) set to have no margins, but making sure that I stay within the actual margins my printer can print. (That is, I make sure that there is no actual content within 5mm of the page border). When resizing, okular then scales my document down to the actual printer margins, which means that there is effectively twice as much margin as is required. (The printer margin plus my empty-margin-area)

If necessary, I can also upload a test document...
Comment 19 bugs5.kde.org 2014-06-18 05:30:16 UTC
I still don't get what I should doe with kdebugdialog.
Comment 20 Nicholas 2014-06-18 05:35:08 UTC
1. Open the Konsole programme
2. Type in " kdebugdialog " and press Enter
3.  Untick the checkbox that reads "Disable all debug output"
4. Click the OK button
5. You'll be back in konsole. Now type "okular" and press enter
6. Open the PDF in okular and print it.
7. Close okular.
8. You'll be back in konsole. One of the lines should mention "lpr.cups". Copy that line here.

I'll bet you'll have an output similar to the one I posted above...


For the devs, I am running:
Qt: 4.8.6
KDE Development Platform: 4.13.1
Okular: 0.19.1
Comment 21 Nicholas 2014-06-18 05:35:57 UTC
Oh - almost forgot! When you're done, repeat steps 1-4, but this time tick the box!
Comment 22 bugs5.kde.org 2014-06-18 09:42:53 UTC
hyper@subi:~$ kdebugdialog
QDBusConnection: session D-Bus connection created before QCoreApplication. Application may misbehave.
QDBusConnection: session D-Bus connection created before QCoreApplication. Application may misbehave.
Bus::open: Can not get ibus-daemon's address. 
IBusInputContext::createInputContext: no connection to ibus-daemon 
hyper@subi:~$ okular
okular(17867)/kdecore (KSycoca) KSycocaPrivate::openDatabase: Trying to open ksycoca from "/var/tmp/kdecache-hyper/ksycoca4"
okular(17867)/kdecore (KConfigSkeleton) KCoreConfigSkeleton::writeConfig:
okular(17867)/kdecore (KConfigSkeleton) KCoreConfigSkeleton::writeConfig:
okular(17867)/kdecore (KConfigSkeleton) KCoreConfigSkeleton::writeConfig:
okular(17867)/kdecore (KConfigSkeleton) KCoreConfigSkeleton::writeConfig:
okular(17867)/kdecore (KConfigSkeleton) KCoreConfigSkeleton::writeConfig:
Bus::open: Can not get ibus-daemon's address. 
IBusInputContext::createInputContext: no connection to ibus-daemon 
okular(17867)/kparts KParts::ReadWritePart::setModified: setModified( false )
okular(17867)/kparts KParts::ReadWritePart::setModified: setModified( false )
okular(17867)/kdecore (trader) KMimeTypeTrader::query: query for mimeType  "application/pdf" ,  "okular/Generator"  : returning  1  offers
This backend is only for XRandR 1.1, your version is:  1 . 4 
okular(17867)/kparts KParts::ReadWritePart::setModified: setModified( false )
okular(17867)/kparts KParts::Part::~Part: deleting widget Sidebar(0xa2c9d0) ""                                                              
hyper@subi:~$
Comment 23 Albert Astals Cid 2014-06-18 23:12:13 UTC
You don't seem to be printing at all...
Comment 24 bugs5.kde.org 2014-06-19 04:01:30 UTC
yet a page was printed out following the instructions by Nicholas
Comment 25 Albert Astals Cid 2014-06-19 20:08:06 UTC
Ok, Nicholas is going to help you then from now on i guess.
Comment 26 Nicholas 2014-06-19 23:33:33 UTC
I can try. Let's do this a little differently:

1. Open the Konsole programme
2. Type in:
        kdebugdialog &
    and press Enter (note the ampersand at the end of that command!
3. Make sure that the checkbox that reads "Disable all debug output" is not ticked
4. In the search field at the top of the window, type "okular". This should filter the list below to 7 or 8 entries. Make sure that all of them *are* ticked.
4. Click the "Apply button".
5. Now go back to the Konsole that you opened earlier. It will be waiting for a new command. 
    Type in:
       okular 2&> ~/okulardebug.txt
    and press enter.
6. Okular will open. Within okular, file->open your pdf, and then file->print it.
7. Quit okular.
8. In the kdebugdialog window that should still be open, make sure that the checkbox that reads "Disable all debug output" *is* ticked and click the "OK" Button.
9. Open the file "okulardebug.txt" in your home directory in your favourite text editor. (Kate, kwrite, ....)
10. Copy and paste the contents here.
Comment 27 bugs5.kde.org 2014-06-20 05:24:06 UTC
Bus::open: Can not get ibus-daemon's address. 
IBusInputContext::createInputContext: no connection to ibus-daemon 
This backend is only for XRandR 1.1, your version is:  1 . 4 
okular(3946) KDirWatch::removeFile: doesn't know "/home/hyper/2" 
okular(3946) KDirWatch::removeDir: doesn't know "/home/hyper"
Comment 28 Nicholas 2014-06-24 03:53:55 UTC
Created attachment 87355 [details]
Add customTab to the printdialog to set fit-to-page options

Hmmmm - I'm afraid I have no idea why you aren't getting the debug information out.

Still - I suspect that my debug information tells the story.

For any developers out there: The attached patch adds a custom tab for setting the fit-to-page option. My question is this (I'm stuck here): how do I reference the optiontab in FilePrinter.cpp so that I can set the corresponding lpr options?
Comment 29 Albert Astals Cid 2014-07-10 22:15:53 UTC
You don't reference it, you pass the options down, not ask them up. Anyway please use reviewboard.kde.org for patches, it's much easier to discuss them there.
Comment 30 Christoph Feck 2014-08-15 14:24:12 UTC
Nicholas, any success uploading your patch to https://git.reviewboard.kde.org/ ?
Comment 31 Christoph Feck 2014-09-13 20:35:59 UTC
Nicholas, if you can provide the information requested in comment #30, please add it.
Comment 32 Christoph Feck 2014-10-23 20:42:43 UTC
No response, marking as WONTFIX. If you can provide the information requested in comment #30, please add it.