Grayscale pdf from colour pdf

is it possible to generate a grayscale pdf from a colour pdf
i have searched the forums and help and i have found a similar issue Gray Pdf's from Color Pdf's but it is 4 years old and i wanted to check whether the answer has changed since then
that thread seems to suggest it migth be possible to convert colout pdf to image and then image to grayscale pdf, that sounds a bit of hack and i wondered if there was a more robust method available

Hi Nick,

Thanks for your interest in our products.

I am afraid currently Aspose.Pdf for .NET does not support the capability to directly convert the colored PDF file into GrayScale PDF. So in order to accomplish your above requirement, you may consider using either approach

  • Convert the pages of PDF file into image format, change the color space of individual image into GrayScale and then place these images in a PDF file (Create a new PDF file using GrayScale images).
  • Convert the PDF file into TIFF image format and then create a PDF file using this TIFF image.

You may consider visiting the following links for details on

In case of any further query, please free to contact. We are sorry for this inconvenience.

Hello,

We are new users of the Aspose tools and I want to know if there is any new solution about that question.
We receive pdf files containing some photos with colors and some text written in black (in the same file) and we have to convert it into gray scale color before sending it to printer.

It is very important that the grey scale does not turn to black and white because printers will not work well.
Is it possible to convert from pdf to pdf ? (last post I see is in 2012 and it was not possible)
Is it possible to adjust the gray scale to be more light or more dark when we use RgbToDeviceGrayConversionStrategy or any new class / method?

In the actual tool (that we are trying to replace with Aspose) the program uses AMYUNI printer ressource to simulate and set the gray scale before saving the PDF file.

We actually work with Aspose PDF 16.11.0

Hope you understand me…




Hi Diane,


Thanks for contacting support.

In order to accomplish your requirement, we recommend following instructions specified over Convert a PDF from RGB colorspace to Grayscale and concerning to the above stated requirement of adjusting GrayScale factor, I am afraid currently this feature is not supported. For the sake of correction, I have logged it as PDFNET-42176 in our issue tracking system. We will further look into the details of this problem and will keep you posted on the status of correction. Please be patient and spare us little time. We are sorry for this inconvenience.

Hello Nayyer,

Thank’s for your answer.
But… I have already tried that recipe before writing to you.
That does not give the expected results.
To make sure that I did all that I was supposed to, I did it another time (this morning) with the code in my program following the example in Aspose documentation:

Aspose.Pdf.Document pdfDoc = new Aspose.Pdf.Document
(@“F:… <span style=“background-color: rgb(255, 255, 255);”>Exemple-1_pourAspose.pdf”);
Aspose.Pdf.RgbToDeviceGrayConversionStrategy strategy = new
Aspose.Pdf.RgbToDeviceGrayConversionStrategy();
for (int idxPage = 1; idxPage <= pdfDoc.Pages.Count; idxPage++)
{
// Get instance of particular page inside PDF
Page page = pdfDoc.Pages[idxPage];
// Convert the RGB colorspace image to GrayScale colorspace
strategy.Convert(page);
}

pdfDoc.Save(@“c:\temp<font color=”#0000ff">Exemple-1-PdfGrayScale.pdf",Aspose.Pdf.SaveFormat.Pdf);
MessageBox.Show(“Pdf saved”);

In attached files, you can see the original PDF file containing the image (with color)
and the PDF file converted to gray scale (the image is now black and white).

Have a nice day,
Diane



dianerheaume:
Hello Nayyer,
Thank's for your answer.
But... I have already tried that recipe before writing to you.
That does not give the expected results.
To make sure that I did all that I was supposed to, I did it another time (this morning) with the code in my program following the example in Aspose documentation:

Aspose.Pdf.Document pdfDoc = new Aspose.Pdf.Document
(@"F:\........ \Exemple-1_pourAspose.pdf");
Aspose.Pdf.RgbToDeviceGrayConversionStrategy strategy = new
Aspose.Pdf.RgbToDeviceGrayConversionStrategy();
for (int idxPage = 1; idxPage <= pdfDoc.Pages.Count; idxPage++)
{
// Get instance of particular page inside PDF
Page page = pdfDoc.Pages[idxPage];
// Convert the RGB colorspace image to GrayScale colorspace
strategy.Convert(page);
}

pdfDoc.Save(@"c:\temp\Exemple-1-PdfGrayScale.pdf",Aspose.Pdf.SaveFormat.Pdf);
MessageBox.Show("Pdf saved");

In attached files, you can see the original PDF file containing the image (with color)
and the PDF file converted to gray scale (the image is now black and white).

Have a nice day,
Diane
Hi Diane,

Thanks for using our API's.

I have tested the scenario and have managed to reproduce same problem. For the sake of correction, I have logged it as PDFNET-42188 in our issue tracking system. We will further look into the details of this problem and will keep you posted on the status of correction. Please be patient and spare us little time. We are sorry for this inconvenience.

The issues you have found earlier (filed as PDFNET-42188) have been fixed in Aspose.PDF for .NET 21.8.