LEADTOOLS Support
Document
Document SDK Questions
Convert PDF to tiff + Merge PDF problem with color
This topic and its replies were posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Tuesday, March 31, 2015 5:08:02 AM(UTC)
Groups: Registered
Posts: 11
I have following 2 methods:
1. Convert PDF to Tiff
string loadfile = @"D:\Data\PDF_Farbe\PDF091.pdf";
string savefile = @"D:\Data\newTEST\PDF091.tiff";
string saveMultifiles = @"D:\Data\newTEST\sectest{0}.tiff";
RasterCodecs.Startup();
RasterCodecs codecs = new RasterCodecs();
LeadTools_RasterSupport_Unlock();
RasterImage image;
CodecsImageInfo imgIngfo = codecs.GetInformation(loadfile, true);
int count = imgIngfo.TotalPages;
for (int i = 1; i <= count; i++)
{
image = codecs.Load(loadfile, 32, CodecsLoadByteOrder.Rgb, i, i);
codecs.Save(image, string.Format(saveMultifiles, i), RasterImageFormat.Tif, 1, 1, 1, 1, CodecsSavePageMode.Append);
}
2. Merge PDFs
List<string> pdfFileList = new List<string>();
pdfFileList.Add(@"D:\Data\PDF_Farbe\PDF091.pdf");
pdfFileList.Add(@"D:\Data\PDF_Farbe\PDF091_1.pdf");
pdfFileList.Add(@"D:\Data\PDF_Farbe\PDF091_2.pdf");
pdfFileList.Add(@"D:\Data\PDF_Farbe\PDF091_3.pdf");
pdfFileList.Add(@"D:\Data\PDF_Farbe\PDF091_4.pdf");
foreach (string str in pdfFileList)
{
image = codecs.Load(str);
codecs.Save(image, @"D:\Data\newTEST\testPDF.PDF", RasterImageFormat.RasPdfG4, 1, 1, image.PageCount, 1, CodecsSavePageMode.Append);
}
but the output is gray, i want it in color. How can i do this in both?
#2
Posted
:
Wednesday, April 1, 2015 5:57:43 AM(UTC)
Groups: Registered, Tech Support
Posts: 179
If you mean that the result file (After Merge) is gray, I noticed that your code is saving the result with "RasPdfG4" compression (or no compression at all) and 1-BPP. One-bit images cannot have more than 2 colors, in your case black and white. The gray shades you see are probably the effect of dithering or paint scaling. Try to save it as RasPdfLzw or RasPdfJpeg411 and set the Bits per pixel to 24.
If the problem didn't solved , isolate the problem in small working project(not your full application) and send it to me. Also, provide sample images that shows the problem.
Note: Make sure to put the files in a ZIP or RAR file to ensure our server delivers them correctly and send us the uploaded file name.
Mohamed Abedallah
Developer Support Engineer
LEAD Technologies, Inc.

#3
Posted
:
Thursday, April 2, 2015 3:22:42 AM(UTC)
Groups: Registered
Posts: 11
Ok problem solved. Thank you.
LEADTOOLS Support
Document
Document SDK Questions
Convert PDF to tiff + Merge PDF problem with color
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.