Next step is to copy or add both pdfcreactivex.tlh and pdfcreactivex.tli files to your main project. #import "PDFCreactiveX.dll" raw_interfaces_only raw_dispinterfaces rename("GetObject", "PDFCreactiveX_GetObject") rename("TextOut", "PDFCreactiveX_TextOut") rename("GetCharWidth", "PDFCreactiveX_GetCharWidth") rename("DrawText", "PDFCreactiveX_DrawText") When you compile the console app, Qt will automatically generate this two wrappers. tli files create a Qt console project and add the import statement below to the main.cpp file. You need to generate a pdfcreactivex.tlh and pdfcreactivex.tli that you will later include in your project. I suspect that there may be more efficient ways to add a COM object to Qt but I will leave that up to you. Please refer to this guide to know how to use AppImage.To debug this situation further I have downloaded the Qt Creator Community edition and believe I am able to add access the PDF Creator COM object. To let you easily use the tool, we have packaged it in AppImage format. You may find the source code of the PDF Compressor on our GitHub repository. If you are not satisfied with the compression, you can choose another compression level and compress the file again. The compressed file is renamed by appending -compressed to the original file name. Your original PDF file remains untouched. The compressed PDF file is saved in the same folder as the original PDF file. The tool gives you a simple UI where you can select your input file, select a compression level and click on the compress button to compress the PDF file. Panos from It’s FOSS team worked on creating a Python-Qt based GUI wrapper for the Ghostscript. This is why we at It’s FOSS worked on creating a GUI version of the Ghostscript command that you saw above. The PDF editors in Linux doesn’t help much with compression. I understand that not everyone is comfortable with command line tool. Method 2: Compress PDF files in Linux using GUI tool There is not much you can do in such cases. Applying compression on some PDF files may even produce a file bigger than the original. Lower quality output (72 dpi) but smallest possible output file sizeĭo keep in mind that some PDF files may not be compressed a lot or at all. Medium quality output (150 dpi) with moderate output file size Higher quality output (300 dpi) but bigger size This is what determines the compression level and thus the quality of your compressed PDF file. What you need to know is the dPDFSETTINGS parameter. In the above command, you should add the correct path of the input and out PDF file. Now that you have made sure that Ghostscript is installed, you can use the following command to reduce the size of your PDF file: gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/prepress -dNOPAUSE -dQUIET -dBATCH -sOutputFile=compressed_PDF_file.pdf input_PDF_file.pdf On Debian/Ubuntu based distributions, use the following command to install Ghostscript: sudo apt install ghostscript However, you can still try to install it just to make sure. Most Linux distributions include the open source version of Ghostscript already. You can use Ghostscript command line tool for compressing a PDF file. Method 1: Reduce PDF file size in Linux command line I’ll show both command line and GUI methods. In this quick tutorial, I’ll show you how to reduce the size of PDF files in Linux. This is the reason why I prefer compressing PDF files on my system rather than uploading it to some random server. You could never be sure that they don’t keep a copy your uploaded PDF document. A file with important documents uploading to an unknown server is not a good idea. Now, you may use an online PDF compressing website but I don’t trust them. This only meant that I needed to somehow reduce the size of the PDF file. The upload failed because it exceeded the maximum file size limit. The problem came when I tried to upload this PDF file. I gathered all the scanned images and combined them in one PDF using gscan2pdf tool. I was filling some application form and it asked to upload the necessary documents in PDF format. Both command line and GUI methods have been discussed. Brief: Learn how to reduce the size of a PDF file in Linux.
0 Comments
Leave a Reply. |