sumatrapdfreader / sumatrapdf

SumatraPDF reader
http://www.sumatrapdfreader.org
GNU General Public License v3.0
13.87k stars 1.74k forks source link

Printing raster files in W11 results in empty page. #3510

Open grappas opened 1 year ago

grappas commented 1 year ago

Checked also in "Print to PDF". Result is the same. Printing PDFs without issues. Cannot provide any more information since SumatraPDF is not providing any logs and/or verbose console output.

GitHubRulesOK commented 1 year ago

hmm sporadically windows will add mo[n]t[h]ly print issues but lets consider that's not the case so SumatraPDF printing is memory intensive as it uses Windows Print as raster Images and the resolution is set by the current/default print driver so can bloat exponentially beyond a printers abilities, but thats not the only problem

If I take a TIFF ? of 104 KB and print to PDF I get a blank 1 KB file but Print a 1 KB png I get a 6 KB pdf page with that small image.

So what is the difference is not memory, it is the format of that tiff which I know was raised as a problem monochrome image on a different forum.

So I take a small colour tiff of 1 KB and print it works I get a 7 KB pdf thus colour images are good for that ms driver but problem monochrone ones are not and the reason is mainly down to the type of image being passed into Windows Print to PDF.

Log display is present but no clues except I loaded from a jbig2 directory

LoadDocument: 19.29 ms, 1 pages for 'C:\Apps\Graphics\jbig2\Library\bin\75.tif'
DisplayModel::BuildPagesInfo started
DisplayModel::BuildPagesInfo took 0.00 ms
StartMonitoringDirForChangesAPC() C:\Apps\Graphics\jbig2\Library\bin
ReadDirectoryChangesNotification: FILE_ACTION_MODIFIED 'SumatraPDF-settings.txt'
NotifyAboutFile: ignoring 'C:\Users\Administrator\AppData\Local\SumatraPDF\SumatraPDF-settings.txt'
ReadDirectoryChangesNotification: FILE_ACTION_MODIFIED 'SumatraPDF-settings.txt'
NotifyAboutFile: ignoring 'C:\Users\Administrator\AppData\Local\SumatraPDF\SumatraPDF-settings.txt'
EngineImages::RenderPage() in 65.34 ms
TabsCtrl::WndProc: WM_MOUSEMOVE: tabUnderMouse: 3, tabHighlited: -1, isDragging: 0
TabsCtrl::WndProc: WM_MOUSELEAVE, tabUnderMouse: -1, tabHighlited: 3
TabsCtrl::WndProc: WM_MOUSEMOVE: tabUnderMouse: 0, tabHighlited: -1, isDragging: 0
TabsCtrl::WndProc: WM_MOUSELEAVE, tabUnderMouse: -1, tabHighlited: 0
PrintToDevice: printer: 'Microsoft Print to PDF', file: 'C:\Apps\Graphics\jbig2\Library\bin\75.tif'
kjk commented 1 year ago

Can't investigate without a test file.

In pre-release version there's Show log command in command palette and we've log in printing code quite a lot.

grappas commented 1 year ago

@kjk Could you reopen the issue?

ReadRegStrTemp(HKEY_LOCAL_MACHINE, Software\Microsoft\Windows\CurrentVersion\Uninstall\SumatraPDF, InstallLocation) => '(null)'
ReadRegStrTemp(HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Uninstall\SumatraPDF, InstallLocation) => 'C:\Users\A0H93955\AppData\Local\SumatraPDF'
InstallCrashHandler crashDumpPath: 'C:\Users\A0H93955\AppData\Local\SumatraPDF\crashinfo\sumatrapdfcrash.dmp'
crashFilePath: 'C:\Users\A0H93955\AppData\Local\SumatraPDF\crashinfo\sumatrapdfcrash.txt'
symDir: 'C:\Users\A0H93955\AppData\Local\SumatraPDF\crashinfo'
Starting SumatraPDF 3.5.2, GetCommandLineW():
"C:\Users\A0H93955\AppData\Local\SumatraPDF\SumatraPDF.exe" "C:\Users\A0H93955\Downloads\Nie zwalidowane\adada.tif"
OpenEmbeddedFilesArchive: opened archive
LoadSettings() took 0.65 ms
ParseTranslationsTxt: 17632 lines, nStrings: 372
CreateEngineImageFromFile(C:\Users\A0H93955\Downloads\Nie zwalidowane\adada.tif)
EngineImage::CreateFromFile(C:\Users\A0H93955\Downloads\Nie zwalidowane\adada.tif)
CreateControllerForEngineOrFile: 'C:\Users\A0H93955\Downloads\Nie zwalidowane\adada.tif', 1 pages
LoadDocument: 1.27 ms, 1 pages for 'C:\Users\A0H93955\Downloads\Nie zwalidowane\adada.tif'
DisplayModel::BuildPagesInfo started
DisplayModel::BuildPagesInfo took 0.00 ms
CanViewWithKnownExternalViewer cmd: 294, !ev || ev->exeFullPath == nullptr
CanViewWithKnownExternalViewer cmd: 295, !ev || ev->exeFullPath == nullptr
CanViewWithKnownExternalViewer cmd: 296, !ev || ev->exeFullPath == nullptr
CanViewWithKnownExternalViewer cmd: 297, !pos
CanViewWithKnownExternalViewer cmd: 298, !ev || ev->exeFullPath == nullptr
CanViewWithKnownExternalViewer cmd: 299, !ev || ev->exeFullPath == nullptr
CanViewWithKnownExternalViewer cmd: 300, !ev || ev->exeFullPath == nullptr
CanViewWithKnownExternalViewer cmd: 301, !ev || ev->exeFullPath == nullptr
CanViewWithKnownExternalViewer cmd: 302, !pos
CanViewWithKnownExternalViewer cmd: 303, !ev || ev->exeFullPath == nullptr
EngineImages::RenderPage() in 690.14 ms
Slow rendering: 690.19 ms, page: 1 in 'C:\Users\A0H93955\Downloads\Nie zwalidowane\adada.tif'
StartMonitoringDirForChangesAPC() C:\Users\A0H93955\Downloads\Nie zwalidowane
StartMonitoringDirForChangesAPC() C:\Users\A0H93955\AppData\Local\SumatraPDF
EngineImages::RenderPage() in 542.12 ms
Slow rendering: 542.17 ms, page: 1 in 'C:\Users\A0H93955\Downloads\Nie zwalidowane\adada.tif'
PrintToDevice: printer: '\\[IP_REDACTED]\[PRINTER_NAME_REDACTED]', file: 'C:\Users\A0H93955\Downloads\Nie zwalidowane\adada.tif'
EngineImages::RenderPage() in 0.15 ms
EngineImages::RenderPage() in 0.07 ms
EngineImages::RenderPage() in 0.11 ms
EngineImages::RenderPage() in 0.04 ms
EngineImages::RenderPage() in 0.05 ms
PrintToDevice: finished ok
CanViewWithKnownExternalViewer cmd: 294, !ev || ev->exeFullPath == nullptr
CanViewWithKnownExternalViewer cmd: 295, !ev || ev->exeFullPath == nullptr
CanViewWithKnownExternalViewer cmd: 296, !ev || ev->exeFullPath == nullptr
CanViewWithKnownExternalViewer cmd: 297, !pos
CanViewWithKnownExternalViewer cmd: 298, !ev || ev->exeFullPath == nullptr
CanViewWithKnownExternalViewer cmd: 299, !ev || ev->exeFullPath == nullptr
CanViewWithKnownExternalViewer cmd: 300, !ev || ev->exeFullPath == nullptr
CanViewWithKnownExternalViewer cmd: 301, !ev || ev->exeFullPath == nullptr
CanViewWithKnownExternalViewer cmd: 302, !pos
CanViewWithKnownExternalViewer cmd: 303, !ev || ev->exeFullPath == nullptr

There you go.

GitHubRulesOK commented 1 year ago

That's not a "test file" Slow rendering: 690.19 ms, sound like a big or highly compressed variant of tiff so nearest equivalent of that time for me was 1 page as A4 filesize 2 MB Macintosh PackBits @300x300 dpi but it prints as 5 MB then compresses down into a standard 3 MB for transmission, which would be 4 MB s across network if mime decompressed..

grappas commented 1 year ago

@GitHubRulesOK I don't know if I understand you correctly by you saying "test file"

Here's log from printing this file: https://drive.google.com/file/d/1238J5g-qc3mD42t0bjCU-F4w_q9r_LR1/view?usp=sharing

ReadRegStrTemp(HKEY_LOCAL_MACHINE, Software\Microsoft\Windows\CurrentVersion\Uninstall\SumatraPDF, InstallLocation) => '(null)'
ReadRegStrTemp(HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Uninstall\SumatraPDF, InstallLocation) => 'C:\Users\A0H93955\AppData\Local\SumatraPDF'
InstallCrashHandler crashDumpPath: 'C:\Users\A0H93955\AppData\Local\SumatraPDF\crashinfo\sumatrapdfcrash.dmp'
crashFilePath: 'C:\Users\A0H93955\AppData\Local\SumatraPDF\crashinfo\sumatrapdfcrash.txt'
symDir: 'C:\Users\A0H93955\AppData\Local\SumatraPDF\crashinfo'
Starting SumatraPDF 3.5.2, GetCommandLineW():
"C:\Users\A0H93955\AppData\Local\SumatraPDF\SumatraPDF.exe" "C:\test.tif"
OpenEmbeddedFilesArchive: opened archive
LoadSettings() took 0.47 ms
ParseTranslationsTxt: 17632 lines, nStrings: 372
RestoreTabOnStartup: state->filePath: 'C:\test.tif'
CreateEngineImageFromFile(C:\test.tif)
EngineImage::CreateFromFile(C:\test.tif)
CreateControllerForEngineOrFile: 'C:\test.tif', 1 pages
LoadDocument: 0.50 ms, 1 pages for 'C:\test.tif'
DisplayModel::BuildPagesInfo started
DisplayModel::BuildPagesInfo took 0.00 ms
CanViewWithKnownExternalViewer cmd: 294, !ev || ev->exeFullPath == nullptr
CanViewWithKnownExternalViewer cmd: 295, !ev || ev->exeFullPath == nullptr
CanViewWithKnownExternalViewer cmd: 296, !ev || ev->exeFullPath == nullptr
CanViewWithKnownExternalViewer cmd: 297, !pos
CanViewWithKnownExternalViewer cmd: 298, !ev || ev->exeFullPath == nullptr
CanViewWithKnownExternalViewer cmd: 299, !ev || ev->exeFullPath == nullptr
CanViewWithKnownExternalViewer cmd: 300, !ev || ev->exeFullPath == nullptr
CanViewWithKnownExternalViewer cmd: 301, !ev || ev->exeFullPath == nullptr
CanViewWithKnownExternalViewer cmd: 302, !pos
CanViewWithKnownExternalViewer cmd: 303, !ev || ev->exeFullPath == nullptr
StartMonitoringDirForChangesAPC() C:\
TabsSelect: tabIndex: 0, nTabs: 2
EngineImages::RenderPage() in 585.90 ms
Slow rendering: 585.97 ms, page: 1 in 'C:\test.tif'
TabsSelect: tabIndex: 1, nTabs: 2
CanViewWithKnownExternalViewer cmd: 294, !ev || ev->exeFullPath == nullptr
CanViewWithKnownExternalViewer cmd: 295, !ev || ev->exeFullPath == nullptr
CanViewWithKnownExternalViewer cmd: 296, !ev || ev->exeFullPath == nullptr
CanViewWithKnownExternalViewer cmd: 297, !pos
CanViewWithKnownExternalViewer cmd: 298, !ev || ev->exeFullPath == nullptr
CanViewWithKnownExternalViewer cmd: 299, !ev || ev->exeFullPath == nullptr
CanViewWithKnownExternalViewer cmd: 300, !ev || ev->exeFullPath == nullptr
CanViewWithKnownExternalViewer cmd: 301, !ev || ev->exeFullPath == nullptr
CanViewWithKnownExternalViewer cmd: 302, !pos
CanViewWithKnownExternalViewer cmd: 303, !ev || ev->exeFullPath == nullptr
StartMonitoringDirForChangesAPC() C:\Users\[REDACTED]\AppData\Local\SumatraPDF
CanViewWithKnownExternalViewer cmd: 294, !ev || ev->exeFullPath == nullptr
CanViewWithKnownExternalViewer cmd: 295, !ev || ev->exeFullPath == nullptr
CanViewWithKnownExternalViewer cmd: 296, !ev || ev->exeFullPath == nullptr
CanViewWithKnownExternalViewer cmd: 297, !pos
CanViewWithKnownExternalViewer cmd: 298, !ev || ev->exeFullPath == nullptr
CanViewWithKnownExternalViewer cmd: 299, !ev || ev->exeFullPath == nullptr
CanViewWithKnownExternalViewer cmd: 300, !ev || ev->exeFullPath == nullptr
CanViewWithKnownExternalViewer cmd: 301, !ev || ev->exeFullPath == nullptr
CanViewWithKnownExternalViewer cmd: 302, !pos
CanViewWithKnownExternalViewer cmd: 303, !ev || ev->exeFullPath == nullptr
ReadDirectoryChangesNotification: FILE_ACTION_MODIFIED 'SumatraPDF-settings.txt'
NotifyAboutFile: ignoring 'C:\Users\[REDACTED]\AppData\Local\SumatraPDF\SumatraPDF-settings.txt'
ReadDirectoryChangesNotification: FILE_ACTION_MODIFIED 'SumatraPDF-settings.txt'
NotifyAboutFile: ignoring 'C:\Users\A0H93955\AppData\Local\SumatraPDF\SumatraPDF-settings.txt'
PrintToDevice: printer: '\\[REDACTED]\[REDACTED]', file: 'C:\test.tif'
EngineImages::RenderPage() in 0.16 ms
EngineImages::RenderPage() in 0.09 ms
EngineImages::RenderPage() in 0.13 ms
EngineImages::RenderPage() in 0.05 ms
EngineImages::RenderPage() in 0.05 ms
PrintToDevice: finished ok
GitHubRulesOK commented 1 year ago

@grappas Thanks for sample I have re-opened for analysis however in windows 10, I see no real issue It works in current pre-release and print to Microsoft PDF printer, however look at the disproportionate increase in file size even when reduced as A3 from 16.2 KB to 1.46 MB

Sample file provided is small compact CCITT Group 4 Fax Encoding (Monochrome tiff) in theory should not be a problem, except most image printers will convert to bloated colour.

test.zip Microsoft virtual printer can only print as A3 but the output is blank when uncontrolled but works when correct setting are used image image image

Anti-alias has increased one colour to 256 shades of grey, this will be the same in other editor rather than reader prints however editors like IrfanView or Adobe Reader may align the pixels slightly more efficiently as they are designed to adjust graphics to suite printer. result on the right is IrfanView with a much smaller output file size of about 100 KB the result is finer lines and note the quality when zoomed in is potentially better even with same driver. image