I have a multipage PDF. I need to convert each page to an image first, then reduce the image size to below 240 kb. How can I do it?
Hi @Ush_Dhar
You can use from UiPath.PDF.Activities Package activity called ExportPDFPageAsImage
Loop through all the pages in the pdf for images.
You can use the Get File Info Activity and check the Size of the image in loop.
Ref- How do i get exact image size? - #4 by rikulsilva
If above 240 kb you can resize the image by using following way
Ref- Resize images - #10 by ppr
Hope this helps
Hi @AJ_Ask,
Thanks for the reply. Can you please share the workflow of this code?
Hi @Ush_Dhar
Maybe you don’t even need to work with on resizing the image just try changing the image dpi to 96. It will give you low resolution images.
or if that is not working you can use this flow. Try chaning the Target Y this will change the height of the images. Which will again reduce the file size of the image.
Please find attched the flow.
PDF_TO_IMG.zip (608.8 KB)
Hope this helps
Hi, @AJ_Ask
To perform the conversion of a multi-page PDF to images and reduce the size of each image to less than 240 KB in UiPath, you can follow the following workflow:
1. Extract Pages from PDF and Convert Them to Images
You can use the Export PDF Page As Image activity or an integration with third-party libraries, such as the UiPath.PDF.Activities package, which allows you to extract each page of the PDF and convert it to images (typically in .png or .jpeg format).
Here is an example of how to perform this step:
Install the PDF Package: Make sure that the UiPath.PDF.Activities package is installed in your project.
Use the “Extract PDF Page Range” Activity: This activity allows you to extract specific pages from the PDF and convert them to images.
2. Reduce the Size of Images
After converting the pages to images, you will need to ensure that the image size is below 240 KB. For this, you can use image manipulation activities in UiPath or integrate third-party libraries like ImageResizer
Hi @AJ_Ask & @Erimateia thank you for your suggestion. I tried all of your solutions and got the needed solution. Also I solve this by using vb code. here is the workflow for further reference.
Main.xaml (16.0 KB)
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.