Reputation: 1
I am trying to convert a sample PDF file to image which contains a special PDF objects, so-called Optional Content Groups (OCGs), where I am getting an invalid conversion in gradient colors like pink color to a black or tint color in the result
I have tried the following command
public void ConvertPdfToImage(string pdfPath, int dpi, string fileName, bool isParticularPage = false, int PageNumber = 0)
{
string command = "";
if (isParticularPage)
{
command = $@"mutool.exe convert -O resolution={dpi} -o ""{fileName}"" ""{pdfPath}"" ""{PageNumber}""";
}
else
command = $@"mutool.exe convert -O resolution={dpi} -o ""{fileName}"" ""{pdfPath}""";
ProcessStartInfo procStartInfo = new ProcessStartInfo("cmd", "/c " + command);
procStartInfo.RedirectStandardOutput = true;
procStartInfo.UseShellExecute = false;
procStartInfo.CreateNoWindow = true;
procStartInfo.RedirectStandardError = true;
// wrap IDisposable into using (in order to release hProcess)
using (Process process = new Process())
{
process.StartInfo = procStartInfo;
process.Start();
// Add this: wait until process does its work
process.WaitForExit();
}
}
I have got an invalid output image:
Expected image:
Upvotes: 0
Views: 22