Free Support Forum - aspose.com

Confirmation about what Aspose can do and choose the right product

Hi,

I am writing here because I am designing a new Java software solution for one of our clients and I am thinking of using some of your products.

In particular the functionalities we need are:

  • convert doc, docx, xls, xlsx, ppt, pptx, jpeg, tiff, png, etc… files to pdf files.
  • write 2D Barcode
  • read Barcode and 2D Barcode
  • create pdf portfolio

Is Aspose the right product to perform all the above operations?
In addition, could you address which Aspose product we should focus on?

@francescot88,

Thanks for your interest in Aspose Java APIs and yes, you can meet all these requirements by using Aspose APIs for Java.

Please refer to the following sections of documentation

The code converts a Word document into a TIFF image and then converts that TIFF into a PDF. But you can do the same for other Image formats such as PNG, JPEG etc.

Document doc = new Document("E:\\temp\\in.docx");

Document dstDoc = (Document)doc.deepClone(false);
dstDoc.removeAllChildren();
dstDoc.ensureMinimum();

ImageSaveOptions opts = new ImageSaveOptions(SaveFormat.TIFF);
opts.setUpdateFields(false);
opts.setResolution(160);

ByteArrayOutputStream baos = new ByteArrayOutputStream();
doc.save(baos, opts);

InputStream inputStream = new ByteArrayInputStream(baos.toByteArray());

DocumentBuilder builder = new DocumentBuilder(dstDoc);

// Load images from the disk using the approriate reader.
// The file formats that can be loaded depends on the image readers available on the machine.
ImageInputStream iis = ImageIO.createImageInputStream(inputStream);
ImageReader reader = ImageIO.getImageReaders(iis).next();
reader.setInput(iis, false);

try
{
    // Get the number of frames in the image.
    int framesCount = reader.getNumImages(true);

    // Loop through all frames.
    for (int frameIdx = 0; frameIdx < framesCount; frameIdx++)
    {
        // Insert a section break before each new page, in case of a multi-frame image.
        if (frameIdx != 0)
            builder.insertBreak(BreakType.SECTION_BREAK_NEW_PAGE);

        // Select active frame.
        BufferedImage image = reader.read(frameIdx);

        // We want the size of the page to be the same as the size of the image.
        // Convert pixels to points to size the page to the actual image size.
        PageSetup ps = builder.getPageSetup();

        ps.setPageWidth(ConvertUtil.pixelToPoint(image.getWidth()));
        ps.setPageHeight(ConvertUtil.pixelToPoint(image.getHeight()));

        // Insert the image into the document and position it at the top left corner of the page.
        builder.insertImage(
                image,
                RelativeHorizontalPosition.PAGE,
                0,
                RelativeVerticalPosition.PAGE,
                0,
                ps.getPageWidth(),
                ps.getPageHeight(),
                WrapType.NONE);
    }
}

finally {
    if (iis != null) {
        iis.close();
        reader.dispose();
    }
}

dstDoc.save("E:\\Temp\\awjava-19.11.pdf");

Please refer to the following article:

Please refer to the following article:

Please refer to the Aspose.PDF for Java Documentation.

Please let us know if you need more information; we are always glad to help you.