It sounds like you’re encountering an issue where converting certain PDFs to JPEG or TIFF results in black images, particularly with PDFs created using ‘Simple Scan’. This can occur due to various reasons, such as the way the images are encoded in the PDF or the settings used during conversion.
Cause: The problem may stem from the encoding of images in the PDF or potential corruption in the PDF files.
Solution: Here are some steps you can take to troubleshoot and potentially resolve the issue:
Update Aspose.PDF: You’re using version 25.7, which is quite old. Consider updating to the latest version of Aspose.PDF, as many bugs and issues are fixed in newer releases.
Check PDF Content: Ensure that the PDF files you are trying to convert are not corrupted and that they contain valid image data. Sometimes scanned PDFs may have issues that lead to conversion problems.
Adjust Conversion Settings: When converting, you can specify different settings for the image quality and resolution. Here’s a sample code snippet to convert a PDF to JPEG with specified resolution:
string dataDir = @"YOUR_DATA_DIRECTORY";
string pdfFile = @"YOUR_PDF_FILE.pdf";
using (Document pdfDocument = new Document(Path.Combine(dataDir, pdfFile)))
{
Resolution resolution = new Resolution(300);
JpegDevice jpegDevice = new JpegDevice(resolution);
for (int pageCount = 1; pageCount <= pdfDocument.Pages.Count; pageCount++)
{
using (FileStream jpegStream = new FileStream($"{dataDir}image{pageCount}_out.jpeg", FileMode.Create))
{
jpegDevice.Process(pdfDocument.Pages[pageCount], jpegStream);
}
}
}
Use TiffDevice for TIFF Conversion: If you’re converting to TIFF, ensure you’re using the TiffDevice class with appropriate settings. Here’s an example:
Test with Different PDFs: Try converting other PDFs to see if the issue is specific to the ones created with ‘Simple Scan’. This can help isolate the problem.
Next Steps: If these steps do not resolve the issue, please provide more details about the specific PDFs and any error messages you might be receiving.
Now I’m confused, because Aspose.PDF version 25.7.0 is the latest version.
I’ve already tried converting the file in various ways.
The suggestions didn’t help.
@MartinMorris
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): PDFNET-60410
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.
Thank you for provided information. I checked and issue is indeed present, seems like a bug. You’ll be notified when this issue will be resolved