Embedding ICC profile using Ghostscript - ghostscript

I need to embedded the ICC profile while doing converting the PS to PDF using Ghostscript 9.07 in Ubuntu. Could you please give me the exact command to enable the Icc profile?
Icc profile details:
ISOcoated_v2_300_eci.icc for press ps conversion
ECI-RGB.V1.0.icc for web ps conversion
I am new to this Ghostscript. Kindly help me out.

With Ghostscript you can't embed a specific ICC profile in the output PDF at present, with the exception of PDF/A conversion.
This will change within the next few releases. However, you still won't embed the specific profile, you will just direct Ghostscript to use the profile(s), and then set the ColorConversionStrategy to UseDeviceIndependentColor

Related

ffmpeg crashes when extracting PNG's from video

I am attempting to extract PNG's from a video (.avi) using ffmpeg. My code is:
ffmpeg -i vidx.avi -f image2 imgx_%d.png
Normally that would work fine, but just now it has been causing ffmpeg to crash, a box appears telling me 'ffmpeg.exe has stopped working .. etc...', however changing from png's to jpeg's and the problem goes away.
The format of the video doesn't seem to matter, an mp4 and mpg also have the same issue as the avi.
This has only just happened (in the past day) on a Windows 10(x64)PC so, could it be related to a MS/Windows Update.. is that possible? Does anyone know what else could cause this?
Looking at recently installed programs, realised I'd installed ImageMagick, which has a command-line interface and the Environmental Variable, which was automatically set, is for the folder that not only includes the "magick.exe" but also an "ffmpeg.exe" (version 3.4), and as this was on the Environmental Variables list first, Windows assumed that was the version to use, and not the standalone version that I normally use (a nightly-build from http://ffmpeg.zeranoe.com/builds/).
So just moving the standalone version above the ImageMagick entry did the trick.

OCaml color console output

Is it possible to colour the console output with OCaml on Windows ?
It seems to be possible on a linux terminal : print_string "\027[31m blabla" but I cannot find any information regarding the Windows console.
Using ther Vanilla windows tooling..
Color management is not possible by default using the command ( ms dos ) console emulation.
Out of the box, the best you can get is by using the PowerShell command line interface instead and to configure the colors like explained in this page.
In an opened terminal:
write-host -foregroundcolor Red "Hello"
will result in Hello printed in Red ...
But this is not convenient at all..
A better solution provided by an external tool
The easiest way is to uses an external tool to do the job, but you'll need to install a kind of windows command line extension.
A nice project can be found HERE it's called ANSICON and will directly interpret the ANSI codes the same way the Linux modern terminal emulators does.
You may be interested in ANSITerminal
. I do not remember how good the Windows version is — I personally do not use that platform — but do not hesitate to fill issues or submit pull requests.
If you are looking for ANSI color support (and more) in cmd.exe you can use clink.

Working with UTF-8 encoded TCL files on windows

We try to convert the source files of a TCL/TK application to UTF-8, because this is the default charset of the plattforms we use for development (Linux and OSX).
Our problem is now that windows uses "cp1252" as system encoding, and because of this displays labels and buttons with (for example) german umlauts wrong.
The only solution we found yet would be to add "-encoding UTF-8" to all "wish" calls and "source" commands.
(There is also "encoding system UTF-8", but the documentation says that you shouldn't use it because of problems with system calls)
Is there a way to tell TCL that it should use UTF-8 as default encoding for all source files, or maybe another solution for this problem?
The solution suggested in the TCL chat:
Create and use your own versions of "open" und "source" (like "my_open" and "my_source") which then call the original commands with "-encoding utf-8"

Problems converting spool files generated by Canon iR-ADV C5235/5240 PCL6 printer driver

In our software we need to be able to convert SPL files which printer drivers write to the C:\Windows\System32\spool\PRINTERS folder to PDF files. For SPL files in PCL format we perform this conversion using pcltool.exe from VeryPDF, which mostly works fine. However we are having trouble with SPL files generated by the printer driver "Canon iR-ADV C5235/5240 PCL6". As an example, the following SPL file results from printing out a single page in notepad with the word "something" on it:
http://files.etvdzs.info/00025.spl
Converting 00025.spl using pcltool.exe results in a 70-page PDF with a row of garbage characters at the top of each page. Attempting to open 00025.spl using other PCL viewers gives similar results. We asked VeryPDF and they told us it is not a valid PCL file.
Can anybody tell me what exactly is invalid about this file? Is there any possibility of converting it to valid PCL or otherwise extracting usable data from it?
Incidentally, we had a similar problem with Postscript files generated by the "Canon iR-ADV C5235/5240 PS3" printer driver. There were binary sequences beginning with $CDCA10 and ending with $FFFF000000000000000001 at various positions in the files. After removing these sequences, we were then able to convert the files as normal. I tried a similar solution for the files generated by "Canon iR-ADV C5235/5240 PCL6", but unfortunately was not successful.
EDIT (13 Sep 2013): It seems that the binary sequences are CPCA codes. I was able to obtain documentation about CPCA by signing up for the Canon Developer Support Program at the following URL:
https://www.developersupport.canon.com/user/register
After reading this documentation, I wrote a program to remove CPCA codes from spool files. This is the result of running the program on the file 00025.spl from above:
http://files.etvdzs.info/00025.cleaned.spl
Unfortunately this still doesn't seem to be a valid PCL file :-( Can anybody tell me what exactly is wrong with this file? Is there any possibility of converting it to valid PCL or otherwise extracting usable data from it?
P.S. The program I wrote does successfully convert spool files generated by the printer drivers "Canon iR-ADV C5235/5240 PCL5c" and "Canon iR-ADV C5235/5240 PS3" to valid PCL and Postscript respectively, so I don't think it is a simple matter of the program not working.
Odds are you have something like an EMF or similar file here. Ensure that the server queue (if you are printing to a network printer) is set to 'Render on client computer'. I would also look to set the Print Processor to Winprint RAW. It could also be that the Canon PCL printer isn't as generic as you'd like. You can always try a different PCL driver and see if your converter and the Canon device support the format. To confirm that the issue isn't the Windows Spooler you can set the port to FILE and/or use a capture utility to write out what the printer would actually receive post all processing. If that works but the SPL doesn't then you have a Windows Spooler and/or processor issue.
vclpdcap Capture utility

PowerBuilder 12.5 Classic PDF SaveAs creating files of 0 size on Win7 x64

Platform:
Windows 7 x64
PB 12.5 Classic
Ghostscript 9.07 (both x32 and x64 are installed)
HP Laserjet PS printer installed as "Sybase DataWindow PS"
Datawindow's Data Export tab has Format to configure: PDF and Method: Distill. Both the checkboxes "Distill custom postscript" and "Print using XSLFOP" are unchecked.
I click File | Run/Preview and File | Save Rows As and select PDF as save as type and enter a pdf file name and click on Save. It says in a message box that Save Rows As failed. I find the file has been created on disk but with size 0 bytes.
I have noticed that the manual states this can happen if Ghostscript is not installed. However, I have installed first x64 and then also x32 versions of Ghostscript. I installed x64 cause somewhere in the PB manual it mentioned that I need to install Ghostscript for the platform of the OS and since I am on x64 Win7 I installed x64 Ghostscript. However, it is not working on both.
What could be wrong? Anyone any ideas? I have searched the net and stackoverflow for solutions and everyone seems to be pointing to x32 platform (it seemed to me) as also on XP. My XP installation earlier was working fine. I am now on Win7 x64 and need this to work on it.
TIA
I think I had the same problem. The problem is in the version of the Ghostscript software:
http://ghostscript.com/pipermail/gs-bugs/2012-July/026615.html
You should uninstall the Ghostscript and reinstall this version: Ghostscript 8.71. You can download it from here:
http://sourceforge.net/projects/ghostscript/files/GPL%20Ghostscript/8.71/
http://sourceforge.net/projects/ghostscript/files/GPL%20Ghostscript/8.71/gs871w64.exe/download
After this it should work :)
Good luck!
Br. Gábor
Its about 18 Months ago that we had this problem. IIRC the basic problem is that the driver for the printer must be 64-Bit and you must then use the appropriate 64-Bit Ghostcript exe gswin64c.exe. As far as I see it, Powerbuilder being a 32-Bit application is hard wired to gswin32c.exe.
I ended up having to practically manually do what Powerbuilder does. First I had to find the path of gswin32c.exe or gswin64c.exe by searching the relevant parts of the Registry. This means searching both the 64-Bit part and the 32 Bit-part, since our application does not just run on 64-Bit machines. I think I ended up using ProcessMonitor and ProcessExplorer to watch Powerbuilder in action and mimic what it was doing.
Once you have determined the path of the Ghostscript-EXE you can manually set the Printer to "Sybase DataWindow PS" and do pDw.Object.DataWindow.Print.FileName = sz_pathps where sz_pathps is a path to a temporary file where your PostScript file will be produced via the distiller. You then do pDw.print(false,false) and you have a PostScript file.
Then you can manually call GhostScript using the path to the exe that you found in the registry. The command line parameters I use are
-q -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pdfwrite -sOutputFile=xxxxx.pdf -c .setpdfwrite -f yyyyy.ps
xxxxx.pdf is the path of the PDF-File you wish to produce and yyyyy.ps is the path of the PS-File that you produced using the distiller.
Manually calling the GhostScript-Exe means calling CreateProcess and then subsequently WaitForSingleObject.
This of course means you are not able to use dw.saveas any more and will have to offer some that of Menu or Icon that does the job.
This is indeed truly messy but I had no alternative. It was "must have" functionality, so I had to do it.
There you are, this is my first contribution to stackoverflow and I hope it helps.
Greetings,
Richard Sharp

Resources