Closed carsonip closed 7 years ago
The conversion is still pretty slow though. Is it possible to move the grayscale conversion step to the last (after merging and writeSheets)? If not, maybe we'll have to add some optimization in the input step (e.g. caching grayscale input instead of generating every time a tmp pdf is generated). Please advise.
Good solution!
Translation files
No problem. I'll update the translation files before the release.
"Converted input file does not take care of endPos of InputFile"
This problem can be solved so: gs is able to read from STDIN, followed command works fine
cat color.pdf | gs -sDEVICE=pdfwrite -sProcessColorModel=DeviceGray -sColorConversionStrategy=Gray -o gray.pdf -f -
So boomags can read part of file from startPos to endPos and send data to the gs via STDIN.
A few more comments.
I created "grayscale" branch. I wrote a multithreaded converter, but it's slow an ugly. I'll work on it.
Sorry I was too busy in the last few weeks and forgot to reply. For comment 2, I am a FinePrint user, I feel like the placement of "Grayscale" checkbox is reasonable in their UI. Look at this screenshot.
I can continue to work on the branch after a week. Many thanks!
This solution is too slow. The following command is run more than three minutes for the PDF specification file (1310 pages).
time gs -sDEVICE=pdfwrite -sProcessColorModel=DeviceGray -sColorConversionStrategy=Gray -o PDF_gray.pdf -f PDF_Spec-1.7.pdf
Maybe we should use fake grayscale? The temporary file is color, but we convert image to grayscale on preview. Et and we run gs when the user presses the print button.
These solution have pros and cons:
What you think?
Sounds good to me. Fake it during preview is the way to go, considering the UX. The time required for conversion is reasonable given that it is a 1300-page document.
I found another solution, for my "HP Color LaserJet Pro MFP M476" following line print as grayscale:
lpr -P ASU -o HPColorAsGray=True color.pdf
We can add options when sending job to real printer.
What printer you are use? Is it has "Prian as grayscale" or something like in the GUI configuration? If yes try following:
This is also a neat way. I use Brother MFC-J615W at home. It has the grayscale option in the printing GUI. The diff is as follows:
197c197
< *DefaultBRMonoColor: Color
---
> *DefaultBRMonoColor: Mono
The original ppd file is here.
Please try
lpr -P ASU -o BRMonoColor=Mono color.pdf
Please note, you must use the parameter without the Default prefix.
P.S. I have New Year vacation, so I can continue to work after 8 january.
Yes it works well.
In PWG PPD mapping API implementation for CUPS, I find this code. Hopefully this makes it easier for us to develop our version of mono color printing.
/*
* Try adding some common color options to create grayscale presets. These
* are listed in order of popularity...
*/
const char *color_option = NULL, /* Color control option */
*gray_choice = NULL; /* Choice to select grayscale */
if ((color_model = ppdFindOption(ppd, "ColorModel")) != NULL &&
ppdFindChoice(color_model, "Gray"))
{
color_option = "ColorModel";
gray_choice = "Gray";
}
else if ((color_model = ppdFindOption(ppd, "HPColorMode")) != NULL &&
ppdFindChoice(color_model, "grayscale"))
{
color_option = "HPColorMode";
gray_choice = "grayscale";
}
else if ((color_model = ppdFindOption(ppd, "BRMonoColor")) != NULL &&
ppdFindChoice(color_model, "Mono"))
{
color_option = "BRMonoColor";
gray_choice = "Mono";
}
else if ((color_model = ppdFindOption(ppd, "CNIJSGrayScale")) != NULL &&
ppdFindChoice(color_model, "1"))
{
color_option = "CNIJSGrayScale";
gray_choice = "1";
}
else if ((color_model = ppdFindOption(ppd, "HPColorAsGray")) != NULL &&
ppdFindChoice(color_model, "True"))
{
color_option = "HPColorAsGray";
gray_choice = "True";
}
I did support printing in grayscale. Please test it from grayscale branch.
It bothers me that the function ppdFindOption is deprecated. Apple suggest using cupsCopyDestInfo, but I didn't understand how to use it.
Sorry for the late reply. From what I see, the ppdFindOption
is deprecated while the cupsCopyDestInfo
is new in CUPS 1.6. Do we have to bump up the required version of CUPS or what?
I don't understand how to use cupsCopyDestInfo. What is http_t *http? Where can I get it? So now I use ppdFindOption.
Because I want to have the maximum space for jobs/booklets lists, and there was a issue to add forced color printing, I removed the checkbox "print in grayscale", and added the "color mode" option to printer profile. You'll can create two profiles and quickly switch between them.
Commit - https://github.com/Boomaga/boomaga/commit/ce9dc7aa808ee5e1bcd5e75e9c8fd5a1d1ed8913
Add grayscale option by converting input file to grayscale using ghostscript right before feeding into boomagamerger. It seem to work well for most cases.
Possible problems:
Side note: I tried to put the conversion at the constructor of TmpPdfFile but it does not work. Diffing the outputs shows the wrong references in XObject e.g. Im0. This is due to TmpPdfFile::writeSheets() called by TmpPdfFile::updateSheets() inside Project::update().
This commit may cause problems. Codes for the new feature may not be added at the best places. Please advise.
Resolves: #36