We have code that converts TIF to PDF and works in most cases. We have a certain set of files that when converted, appear as a single page blank PDF. I have also tried to convert the file using the online Aspose converter here (Convert TIFF to PDF Online) with the same blank result. Here is the code we are using:
const string sourcePath = @"C:\TEMP\TIF\bad.tif";
const string targetPath = sourcePath + ".pdf";
using (var image = Image.Load(sourcePath))
{
image.Save(targetPath);
}
@msternig
It seems that you are encountering an issue where certain TIF files are being converted to a blank PDF without any errors. This can happen for a variety of reasons, including the resolution settings of the TIF file or the way the image is being processed during conversion.
To address this issue, you can try setting the resolution of the TIF image before saving it as a PDF. Here’s an example of how you can modify your code to include resolution settings:
using Aspose.Imaging;
using Aspose.Imaging.ImageOptions;
using Aspose.Imaging.FileFormats.Tiff;
const string sourcePath = @"C:\TEMP\TIF\bad.tif";
const string targetPath = sourcePath + ".pdf";
using (TiffImage image = (TiffImage)Image.Load(sourcePath))
{
PdfOptions pdfOptions = new PdfOptions();
pdfOptions.ResolutionSettings = new ResolutionSetting(image.HorizontalResolution, image.VerticalResolution);
image.Save(targetPath, pdfOptions);
}
In this code, we load the TIF image and set the resolution options for the PDF output based on the original TIF image’s resolution. This can help ensure that the content is properly rendered in the resulting PDF.
If the issue persists after trying this approach, it may be worth checking the specific TIF files that are causing the problem to see if they have any unique characteristics that could be affecting the conversion process.
Feel free to reach out if you need further assistance!
Sources:
[1]: Set DPI In Exported Pdf
Tried the code above with the same blank PDF as a result. Attached is the tif file I am using to test with and the resulting blank pdf.
bad.tif.zip (78.9 KB)
@msternig , we will review the attached sample and give a feedback shortly!
@msternig
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): IMAGINGNET-7477
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
Is there a place to see the status, priority, and ETA of the above ticket?
@msternig , you will get a notification on ticket completion, but there is no option to track status directly. As concerns ETA, the task is queued, so it is going to enter 25.02 or 03 release (25.02 is the first release of the new year) in case there are no priority issues or other release complexities.
Hope this helps!
@Denis.Sitko given that this is impacting a production/client project, is there any potential workaround (in code) or sooner update that could be an option?
@msternig , we will try to release the fix in the closest release since there is no a code workaround to force correct processing.
Our apologies for the inconveniences you are facing!