New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Temp PDF files are not removed after execution #1981

Closed
lkm opened this Issue Sep 29, 2014 · 14 comments

Comments

Projects
None yet
8 participants
@lkm

lkm commented Sep 29, 2014

Using newest binary (wkhtmltox-0.12.1.1_msvc2013-win64.exe) on Windows 2012 server with params: "--zoom 1.4 --margin-top 0 --disable-javascript --margin-right 0 --margin-bottom 0 --margin-left 0 --quiet - -"

I am sending HTML file through stdin and getting PDF directly with stdout. The temp HTML files are removed, but PDFs remain in C:\Windows\Temp

This presents a problem when using it in production as disk slowly fills up (or quite rapidly in our case).

@lkm

This comment has been minimized.

lkm commented Oct 8, 2014

Ideally the temp PDF files wouldn't be necessary as they are associated with a performance penalty when outputting to STDOUT. It seems on Windows that it isn't an option, because QPrinter in QT4.8 will only accept file names and Windows doesn't use file system paths as streams (i.e. /dev/stdout).

from pdfconverter.cc:335

    if (settings.out == "-") {
#ifndef Q_OS_WIN32
         if (QFile::exists("/dev/stdout"))
             lout = "/dev/stdout";
         else
#endif
             lout = tempOut.create(".pdf");
    }

QPdfWriter in qt5+ does, however, seem to have support for output to a QByteArray. I assume that will be used when the qt5 branch is done. Is there anything that can be done in the interim to avoid these temp files on win32?

@zachtib

This comment has been minimized.

zachtib commented Dec 5, 2014

Just want to confirm that I'm seeing this issue, too. While I've got the directory being cleaned occasionally in the meantime, an upstream fix would be appreciated.

@ashkulz ashkulz added the Verified label Dec 7, 2014

@ashkulz

This comment has been minimized.

Member

ashkulz commented Dec 7, 2014

No idea on the ETA for this fix, as this requires a design change.

@zachtib

This comment has been minimized.

zachtib commented May 18, 2015

Has there been any movement on this?

@ashkulz ashkulz added this to the 0.12.3 milestone Jun 30, 2015

@ashkulz ashkulz closed this in d1339ec Jun 30, 2015

@ashkulz ashkulz added Fixed and removed Verified labels Jun 30, 2015

DanielCeregatti added a commit to DanielCeregatti/wkhtmltopdf that referenced this issue Jul 8, 2015

fix temporary PDF files not being removed when writing to stdout
This is now simpler since 71657b9,
as removeAll() just has to be called at the right places.

fixes wkhtmltopdf#1981
@ashkulz

This comment has been minimized.

Member

ashkulz commented Jul 14, 2015

A preview for the next release 0.12.3-dev-79ff51e is available, which should contain the fix for this issue. Please report back if it is not solved with the above version.

Please note that the above downloads will be removed after the 0.12.3 release.

@zachtib

This comment has been minimized.

zachtib commented Jul 14, 2015

Sounds great. Unfortunately, I don't know if I'll have time to get around
to this before release, but I'll try to report back when I do. We have a
workaround in place clearing out the temporary files so I'll probably have
to go in and disable that in order to properly test the fix.

@ironman1964

This comment has been minimized.

ironman1964 commented Dec 8, 2015

The latest version 0.12.2.4 WKHTMLTOPDF.exe still does not remove the temp PDF files from c:/windows/temp
Is the 0.12.3-dev-79ff51e version deleting temp files ??

@ashkulz

This comment has been minimized.

Member

ashkulz commented Dec 15, 2015

@ironman1964: Yep, it should.

@ashkulz

This comment has been minimized.

Member

ashkulz commented Jan 21, 2016

0.12.3 has been released, which should contain the fix for this issue. Please report back if it is not solved with the above version.

Note that the preview downloads mentioned above have been removed.

@ironman1964

This comment has been minimized.

ironman1964 commented Jan 21, 2016

Found it and I can confirm it is working.
No more temp files !

@quidproquo

This comment has been minimized.

quidproquo commented Nov 1, 2017

Even with latest version wktemp files seem to be created on Linux when using wkhtmltoimage. I'm using the wkhtmltox-0.12.4_linux-generic-amd64.tar.xz version on 3.13.0-53-generic #89-Ubuntu.

@SynZhang

This comment has been minimized.

SynZhang commented Feb 4, 2018

I'm using wkhtmltoimage in wkhtmltox-0.12.4_linux-generic-amd64.tar.xz, and wktemp files still not deleted.

@robinbetts

This comment has been minimized.

Contributor

robinbetts commented May 25, 2018

If anyone is still seeing wktemp files left behind and are using the c bindings, rather than the command line, see pull request #3930

@2E0PGS

This comment has been minimized.

2E0PGS commented Sep 20, 2018

I made a batch script which is called via task scheduler.

It deletes any files older than 1 day in the C:\Windows\Temp folder if their filename begin with wktemp:

@echo off

FORFILES /p "C:\Windows\Temp" /m "wktemp-*" /d -1 /c "cmd /c if not @isdir==TRUE del @file"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment