PDF Java fails to convert PICT to PDF

sample_640×426.zip (666.2 KB)

Aspose Team,
We tried to use the Aspose PDF java package to convert PICT file to PDF, and found out that the result PDF file is blank.

Following is the sample code and attached is the the sample file
The operating system is Ubuntu 20.04. Java version is 11. Aspose PDF java packages is 23.2.

import com.aspose.pdf.Document;
import com.aspose.pdf.Image;
import com.aspose.pdf.Page;

public class ConvertPictToPdf_23 {
public static void main(String[] args) {
Document pdfDocument = null;
try {
new com.aspose.pdf.License().setLicense(“path-to-license-file”);
String inputFilePath = “path-to-pict-file”;
String outputFilePath = inputFilePath + “.pdf”;
pdfDocument = new Document();
Page page = pdfDocument.getPages().add();
Image pdfImage = new Image();
pdfImage.setFile(inputFilePath);
pdfImage.setInNewPage(true);
page.getParagraphs().add(pdfImage);
pdfDocument.save(outputFilePath);
} catch (Exception ex) {
ex.printStackTrace();
} finally {
if (pdfDocument != null) {
pdfDocument.close();
}
}
}
}

@xyang,

At the moment, there is no support for the Pict format.

When I try to open it, I get the following error:
“Cannot open an image. The image file format may be not supported at the moment.”

@carlos.molina,
Thank you for the information. Wonder if you support PIC file.

@xyang,

You can try them with this code:

using (Document doc = new Document())
{
    var page = doc.Pages.Add();
    Aspose.Pdf.Image image = new Aspose.Pdf.Image();

    // Load sample Tiff image file
    image.File = $@"{PartialPath}_input.YourPicFormat";
    page.Paragraphs.Add(image);

    // Save output PDF document
    doc.Save($"{PartialPath}_output.pdf");
}