Bug 174447 - tif files - print output is not scaled correctly
Summary: tif files - print output is not scaled correctly
Status: RESOLVED FIXED
Alias: None
Product: okular
Classification: Applications
Component: TIFF backend (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-11-06 16:59 UTC by Ferdinand Gassauer
Modified: 2008-11-30 10:55 UTC (History)
1 user (show)

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


Attachments
tiffinfo output (3.57 KB, text/plain)
2008-11-07 10:30 UTC, Ferdinand Gassauer
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ferdinand Gassauer 2008-11-06 16:59:27 UTC
Version:           0.7.80 (using 4.1.72 (KDE 4.1.72 (KDE 4.2 >= 20081104)) "release 4.2", KDE:KDE4:UNSTABLE:Desktop / openSUSE_11.0)
Compiler:          gcc
OS:                Linux (x86_64) release 2.6.25.16-0.1-default

the print output is not scaled to fit on the output page (A4)

it looks like it is scaled to 200% about - so half of the information is missing
Comment 1 Brad Hards 2008-11-07 08:34:54 UTC
I don't see this with my samples.

Do you see this with all TIFF files?

Can you attach an example that shows the problem?

If not, can you tell us what application produced the files?

What does libtiff's "tiffinfo" utility show for the file.
Comment 2 Ferdinand Gassauer 2008-11-07 10:30:16 UTC
Created attachment 28382 [details]
tiffinfo output

I can send you the file privately
Comment 3 Brad Hards 2008-11-07 23:04:06 UTC
Ah, missed that this is _print_, not view.

I do see that with my samples (even with just print preview).

Looks like we need to scale the image to the QPrinter printable area.
Comment 4 Brad Hards 2008-11-08 11:38:41 UTC
Hmm, tried to fix this (with several varieties of
--- /home/bradh/devel/kde-src/kdegraphics/okular/generators/tiff/generator_tiff.cpp     (revision 881437)
+++ /home/bradh/devel/kde-src/kdegraphics/okular/generators/tiff/generator_tiff.cpp     (working copy)
@@ -433,7 +433,9 @@
         if ( i != 0 )
             printer.newPage();

-        p.drawImage( 0, 0, image );
+        QSize targetSize = printer.pageRect().size();
+
+        p.drawImage( 0, 0, image.scaled( targetSize, Qt::IgnoreAspectRatio,  Qt::SmoothTransformation ) );
     }

     return true;

It now fits on the page, and the example that Ferdinand provided looks fine. However I'm not sure it is always going to be right - perhaps will usually look OK if it really came from a printed page, but maybe need to deal with the variable X and Y resolution in some smarter way.

Also, I'm not sure if the image should be drawn at pageRect().topLeft() or at (0,0).

Pino: any thoughts?
Comment 5 Pino Toscano 2008-11-12 01:22:15 UTC
> Pino: any thoughts?

Yep: I would also do a check to not scale over the 100% size, ie print the image at its original size reducing it if it does not fit into the page size.
That would be enough for a base case, I'd say. What do you think?

Also, maybe we would need something to specify the zoom level (ie fit width/page/level)... and maybe also something to specify horizontal and/or vertical alignment within a page...
(in short, we'd need kdeprint... :-(.)
Comment 6 Brad Hards 2008-11-30 08:41:56 UTC
SVN commit 890775 by bhards:

Implement scale-down for images that would not otherwise fit
on the selected printed page format.

BUG:174447


 M  +10 -1     generator_tiff.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=890775
Comment 7 Pino Toscano 2008-11-30 10:55:07 UTC
SVN commit 890789 by pino:

Backport of SVN commit 890775 by bhards:

Implement scale-down for images that would not otherwise fit
on the selected printed page format.

CCBUG:174447


 M  +10 -1     generator_tiff.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=890789