DEV Community

Hamed Azar
Hamed Azar

Posted on

Introducing Filepix: The All-In-One File Conversion Tool

with filepix convert images into pdf easier

Tired of using multiple packages just to convert your images and PDFs from one format to another? Say goodbye to the hassle and welcome Filepix, your one-stop solution for all file conversion needs. With Filepix, you can easily convert images and PDFs into different formats with just a few lines of code. No more juggling multiple packages, Filepix has got you covered. Whether you need to convert your PDFs into images or vice versa, Filepix can handle it all with ease.

Filepix is a Node.js package that provides a simple, unified API to convert your files from PDF to image, and PDF to docx. The package uses the power of Optical Character Recognition (OCR) to extract text from PDFs, making it possible to convert your PDFs into editable word documents.

Installing Filepix

npm install filepix
Enter fullscreen mode Exit fullscreen mode

Converting Images to PDFs

Say goodbye to the hassle of using multiple packages just to convert your images! With Filepix, you can easily convert your images into a single PDF file with just a few lines of code.

The basic usage of Filepix's "img2PDF" feature is simple and straightforward. If you want to convert all the images inside a specific directory, you can use the following code:

filepix.img2PDF(pages = './inputImagesDir', output = "./outputImageDir/output.pdf");
Enter fullscreen mode Exit fullscreen mode

Or, if your images are stored in different paths, you can use the following code:

filepix.img2PDF(
pages = [
'./1.jpg',
'./public/upload/2.jpg',
'./public/upload/example/3.jpg'
],
output = "./outputImageDir/output.pdf");
Enter fullscreen mode Exit fullscreen mode

with Filepix, converting images to PDF has never been easier.


Converting PDFs to Images

Filepix provides an easy-to-use API to convert your PDFs into multiple images. Simply call the PDF2img method and provide the path to your input PDF and the desired output directory.

filepix.PDF2img('./inputImagesDir/input.pdf', "./outputImageDir");
Enter fullscreen mode Exit fullscreen mode

Add some effects

With Filepix, you can not only convert your images into a single PDF file, but also add amazing effects to your images in the process! Whether you want to apply color modifications or flip the image horizontally or vertically, Filepix makes it easy. Simply set the desired effects in the options when calling the function. For example:

let options = {
   effects: [
              {
                  name: 'mirror'
              }
            ]
  };

filepix.img2PDF(pages = './inputImagesDir', output = "./outputImageDir/output.pdf", options);

Enter fullscreen mode Exit fullscreen mode

For more information on the various effects you can add, check out the readme on the Filepix GitHub repository: https://github.com/hamedpa/filepix.

Filepix offers a convenient and effortless way to convert your PDF documents into multiple images. This feature enables you to easily convert your PDF files into various image formats such as JPG, PNG, and more.

The basic usage is straightforward and requires just a single line of code. All you need to do is provide the path to your PDF document and the destination directory where the images will be saved. For instance, to convert a PDF file located at './inputImagesDir/input.pdf', you can use the following code:

filepix.PDF2img('./inputImagesDir/input.pdf', "./outputImageDir");

Enter fullscreen mode Exit fullscreen mode

This method makes it easy for you to access your PDF documents as individual images, allowing you to work with them in a variety of applications and use cases. Whether you need to edit an image, extract specific pages, or share with others, Filepix has got you covered.


Converting PDFs to Word Documents

Filepix provides an easy-to-use API to convert your PDFs into multiple images. Simply call the PDF2img method and provide the path to your input PDF and the desired output directory.

filepix.PDF2img('./inputImagesDir/input.pdf', "./outputImageDir");
Enter fullscreen mode Exit fullscreen mode

Note: Installing Tesseract

Before you start using Filepix, you need to install Tesseract, an OCR engine that helps extract text from images. Instructions for installing Tesseract for all platforms can be found on the project site. Once you have installed Tesseract, you are ready to use Filepix.

In conclusion, Filepix is a fantastic solution for anyone who needs to convert PDFs into images or Word documents. With its free and open-source nature, it's easy to get started, and with its simple API, it's easy to use. So why wait? Give Filepix a try today!

You can find Filepix on npmjs.com at the following link: https://www.npmjs.com/package/filepix

You can access the source code for Filepix on GitHub at the following link: https://github.com/hamedpa/filepix


Top comments (0)