We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Splitting a pdf to individual tiff files results in blank pages

I’m using the below code to convert a multi page pdf document into separate indivudual tiff and jpeg images.

TiffSettings setting = new TiffSettings(CompressionType.None, ColorDepth.Format8bpp, new Margins { Bottom = 0, Left = 0, Right = 0, Top = 0}, false);

pdfDocument = new Document(inputFileName);
pdfDocument.Flatten();
pdfDocument.Form.Flatten();
int count = 1;
tiffDevice = new TiffDevice(resolution, tiffSettings);

foreach (Page page in pdfDocument.Pages)
{
doc = new Document();
doc.Pages.Add(page);
string outputFilePath = outputPath.AppenCountToFile(count);

PdfConverter objConverter = new PdfConverter(doc);
objConverter.BindPdf(doc);
objConverter.DoConvert();
objConverter.SaveAsTIFF(outputFilePath, setting);

jpegDevice.Process(page, ThumbnailPath.AppenCountToFile(count));
OutputFilesInfo.Add(outputFilePath);
count++;
}

But the resultant images are blank.

Hi Vignesh,


Thanks for using our API’s.

I have tested the scenario using latest release of Aspose.Pdf for .NET 11.4.0 where I have used one of my sample PDF files and I am unable to notice any issue and as per my observations, the resultant TIFF and JPEG files do contain input file contents. Can you please share your resource file causing blank output issue, so that we can test the scenario in our environment. We are sorry for this inconvenience.

[C#]

TiffSettings setting = new TiffSettings(CompressionType.None, Aspose.Pdf.Devices.ColorDepth.Format8bpp, new
Aspose.Pdf.Devices.Margins { Bottom = 0,
Left = 0, Right = 0, Top = 0 }, false);<o:p></o:p>

Document pdfDocument = new Document("c:/pdftest/test.pages.txt.pdf");

pdfDocument.Flatten();

pdfDocument.Form.Flatten();

int count = 1;

TiffDevice tiffDevice = new TiffDevice(new Resolution(300));

JpegDevice jpegDevice = new JpegDevice();

foreach (Page page in pdfDocument.Pages)

{

var doc = new Document();

doc.Pages.Add(page);

string outputFilePath = "c:/pdftest/ResultantTIFF"+(count)+".tiff";

PdfConverter objConverter = new PdfConverter(doc);

objConverter.BindPdf(doc);

objConverter.DoConvert();

objConverter.SaveAsTIFF(outputFilePath, setting);

jpegDevice.Process(page, "c:/pdftest/Resultant_JPEG_"+(count)+".jpeg");

count++;

}