I am using the latest aspose dlls for converting pdf to tiff, but for one of the PDF the created tiff width increased . PDF is of 8.27*11.69 in size but the created tiff looks like in Landscape, its height= 595.2,width =841.92. I tested with another PDF with same page size and for that it is created correctly with height=841.8898 and width =595.2756 . Below is the code and also attaching the PDF, since this is a production file, please use it for internal testing only
using (Document document = new Document(filePath))
{
// Get page collection
PageCollection pageCollection = document.Pages;
for (int i = 0; i < document.Pages.Count; ++i)
{
int pageNumber = i + 1;
// Get particular page
Page pdfPage = pageCollection[pageNumber];
double height = (pdfPage.MediaBox.Height / 72) * conversionSetting.Resolution;
double width = (pdfPage.MediaBox.Width / 72) * conversionSetting.Resolution;
TiffDevice tiffDevice = new TiffDevice((int)width,(int)height,resolution, tiffSettings);
//TiffDevice tiffDevice = new TiffDevice(resolution, tiffSettings);
string destinationPath = GetDestinationPath(filePath, destinationDirectory, i);
try
{
using (FileStream fileStream = new FileStream(destinationPath, FileMode.Create))
{
((DocumentDevice)tiffDevice).Process(document, i + 1, i + 1, (Stream)fileStream);
stringList.Add(destinationPath);
}
}
catch (Exception ex)
{
document.FreeMemory();
foreach (string path in stringList)
{
if (File.Exists(path))
File.Delete(path);
}
throw ex;
}
}
document.FreeMemory();
}
TiffIssue.pdf (161.8 KB)