[softwarelist] Re: Potential TransPDF improvements

  • From: David Pilling <david@xxxxxxxxxxxxxxxx>
  • To: davidpilling@xxxxxxxxxxxxx
  • Date: Tue, 29 Jan 2019 21:58:34 +0000

Hi,

I see what follows is missing from the list archive - it could be useful - so I'm reposting it.

Peter's notes tell anyone how to add their own filter to OP on Windows.

If you want to use ImageMagick to import transparent PNG files or something similar.



On 29/01/2019 00:15, Peter Newble wrote:

On 28 Jan 2019, at 12:54, David Pilling <david@xxxxxxxxxxxxxxxx <mailto:david@xxxxxxxxxxxxxxxx>> wrote:

"Syntax: TransGIF <input file> <output file>”

Is that a quote from somewhere?

I'd be expecting file names for both input and output.

That was my first assumption, in the absence of any documentation. However, having written a batch file which worked, on its own, on that basis, when I tried invoking it from within Ovation Pro by dragging a PDF into a frame, it failed with the error

    File C:\Users\PCN\AppData\Local\Temp\Ovation0\F01  not found.


(Note the strange double space after the filename — not sure whether that is significant.)

That’s when I investigated the output filename being passed to the filter, found it appeared to be a directory name (having no file extension), and I therefore assumed that at least one level of directory would have to be created (because, regardless of whether F01 is supposed to be a file or a directory,  'C:\Users\PCN\AppData\Local\Temp’ has no subdirectory ‘Ovation0’ at the point when the filter is called).

Anyway now I know it is supposed to be a file. And fortunately it turns out that epstool is happy to create directories as necessary when saving a file — which ImageMagick, for instance, wouldn’t.

On 28 Jan 2019, at 14:25, Jeremy Nicoll - freelists <jn.fr.lsts.74@xxxxxxxxxxxxxxxxxxxx <mailto:jn.fr.lsts.74@xxxxxxxxxxxxxxxxxxxx>> wrote:

I also wondered if when called from Ovation Pro, whether either of the arguments already has its value enclosed in quotes?

That was it — thank you. They are, and I hadn’t noticed that when getting it to display the arguments received.

Thus removing the quotes from %1% and %2% in the three external commands called solves the problem, and this works as TransPDF.cmd:

    if exist C:\Temp.tif del C:\Temp.tif
    if exist C:\Temp.eps del C:\Temp.eps
    "C:\Program Files\gs\gs9.26\bin\gswin32c.exe" -dSAFER -dBATCH
    -dNOPAUSE -sDEVICE=eps2write -sOutputFile=C:\Temp.eps -r600 -q
    -dFirstPage=1 -dLastPage=1 %1
    "C:\Program Files\ImageMagick-7.0.1-Q8\convert.exe" %1[0] -density
    300 -depth 8 -type TrueColorMatte C:\Temp.tif
    "C:\Program Files\epstool-3.09\bin\epstool.exe" --add-user-preview
    C:\Temp.tif C:\Temp.eps %2
    if exist C:\Temp.tif del C:\Temp.tif
    if exist C:\Temp.eps del C:\Temp.eps


(For it to work in a multi-user environment one might need to create those temporary files somewhere else, as Jeremy has said).

The ImageMagick line also includes ‘[0]’ to use only the first page of the PDF, as does the Ghostscript command in the line above, which I had forgotten to add in the previous version.

Thanks again.


Peter.

--
David Pilling
www.davidpilling.com
To unsubscribe or subscribe goto: //www.freelists.org/list/davidpilling

Other related posts: