Friday, December 7, 2018

Optimize PDF and clean it up with a simple code

    0

Optimize PDF with easy PDF SDK

Portable Document Format is a container that consists of textual, graphical and technical information, such as fonts, metadata, color profiles, etc. With the popularity of Portable Document Format, the software to create or write a PDF file has also proliferated. Today there are thousands of software products/Applications, which create PDF files.

However, all PDFs are not created equal.

Each software product or Application is geared toward writing the PDF file, focusing on the artifacts in the PDF of interest to them. PDF writers aren’t always careful about maintaining the integrity of the PDF document, and take shortcuts in writing files. The result is still a valid PDF, conforming to PDF/A and PDF/X standards, but may have many discrepancies like:

  • Abandoned pages;
  • Abandoned images;
  • Abandoned hyperlinks;
  • Unsupported fonts.

As a PDF file gets passed among different people who use diverse software to read/write it, or by the same person feeding it to different applications, the above inconsistencies may creep into the file. This typically results in the file size growing mysteriously. Your application may remove some pages, but the file size may still grow! These PDF files are also slow to load in Acrobat Reader, or may not load at all in your software environment.

PDF file before optimization


The best way to optimize your PDF and decrees it size is removing such clutter. It all could be easily done programmatically if you have the time and the where with all to manipulate PDF files.

BCL’s eadyPDF SDK has the functionality to rectify this problem. The SDK has two functions which optimize the PDF, and bring it back to a well-knit efficient structure.

void Optimize(string InputFileName, string OutputFileName, string Password)
void Optimize2(string InputFileName, string OutputFileName, string Password, int Flags, string AdvancedOptions)

Optimizing PDF in .net environment

These functions parse the PDF file, check for unused items, and physically remove them. They also check the sanctity of all objects embedded in the PDF files. The functions take in a Password parameter, in case the PDF file is encrypted. The Optimize2 function uses a Flags parameter, which dictates if the private application data called PieceInfo, and XMP metadata is to be removed. These functions can be called explicitly which processing the PDF form your software, or can be called automatically after the call to any other method in the library. This is controlled by the Boolean OptimizeAfterEachProcess.

PDF Optimized by easyPDF SDK


Thus, no matter the source of your PDF, the easyPDF library can help you keep it optimized, so that it reduces the burden on your applications. After all, you can get the same PDF in a smaller size and of the same quality, which is ready for printing or archiving in a matter of minutes and with a few simple lines of code.

Test the optimization function today by downloading and installing easy PDF SDK free trial now.

No comments:
Write comments

© 1993 - , BCL Technologies. All other trademarks are the property of their respective owners. Privacy Policy