Multipage TIF to PDF

Hi. I am trying to convert a Multipage TIF file to PDF using Javascript. I have used the following code, but the output is blank:

function convertTIFFMutliToPDF() {
   
   var bytes = qie.readFile('C:\\tif.tif');
   var encodedBytes = qie.base64EncodeBytes(bytes);

   try{
      var license = new com.aspose.words.License();
      license.setLicense("Aspose.Words.Product.Family.lic");
      
      var doc = new com.aspose.pdf.Document();

      var page = doc.getPages().add();
      page.getPageInfo().getMargin().setBottom(0);
      page.getPageInfo().getMargin().setTop(0);
      page.getPageInfo().getMargin().setLeft(0);
      page.getPageInfo().getMargin().setRight(0);

      var image = new com.aspose.pdf.Image();
      image.setInNewPage(true);
      image.setImageStream(new java.io.ByteArrayInputStream(qie.base64DecodeToBytes(encodedBytes)));
      page.getParagraphs().add(image);
      doc.save("C:\\Output\\test.pdf");
      
   }catch(Exception)
   {
      qie.info("Error: " + Exception);
   }
}

@swy

We are checking it and will get back to you shortly.

@swy

The code snippet that you shared seems correct except you are setting license for Aspose.Words API and using Aspose.PDF. Please try to set the license for Aspose.PDF and try again. In case issue still persists, please share your sample TIFF file for our reference so that we can test the scenario in our environment and address it accordingly.

Hi. I have an Aspose.Total evaluation licence, which hasn’t worked either. Unfortunately, I can’t share this particular tif file as it contains patient data. Are you able to test my code against a sample tif file with multiple pages you might have please?

@swy

We tested below sample code snippet in our environment using one of our sample files and we could not notice any issues:

// Initialize document object
Document document = new Document();

Page page = document.getPages().add();
Image image = new Image();

// Load sample BMP image file
image.setFile(dataDir + "output.tif");
page.getParagraphs().add(image);

// Save output PDF document
document.save(dataDir + "output.pdf");

Hi. I still get a blank document. Can you please share the file you are using. I have attached the output I am seeing.

test.pdf (84.5 KB)

@swy

It looks like you are not setting license for Aspose.PDF before conversion. We have noticed the evaluation message in the output PDF that you shared. Please try to use the license and convert again. For your kind reference, attached are the sample TIFF and output PDF files that we used in our environment.
Files.zip (280.0 KB)

Hi. Thanks for the sample file. It seems to work OK for me too. The problem file that I have contains personal data; I am trying to get permission to share these privately with the Aspose support team.

In the meantime, I have attached a screenshot of the properties of the file.

Capture.PNG (7.1 KB)

@swy

Thanks for sharing the screenshot. However, we do need sample file to carry out the investigation properly. Please share it as soon as you have enough permissions and we will continue accordingly.

Hi. Thanks for the feedback. I have asked our client and am waiting for them to get back to me.

@swy

Sure. Please take your time to gather the sample file and share it with us once you have it. We will proceed accordingly.