# Optimize the PDF file resources Reduce PDF file size with GroupDocs.Viewer. Optimize images, remove data, and more for smaller output files. Resource optimization allows you to reduce the size of the output PDF file. While optimizing, GroupDocs.Viewer may reduce the image size or quality, remove notes or form fields, remove objects, fonts, or personal information from a document, and so on. The following code snippet shows how to optimize the PDF file by default: {{< tabs "Example1">}} {{< tab "Python" >}} ```python from groupdocs.viewer import Viewer from groupdocs.viewer.options import PdfViewOptions, PdfOptimizationOptions def optimize_pdf_resources(): # Load document with Viewer("sample.docx") as viewer: viewOptions = PdfViewOptions("optimize_pdf_resources/optimized_resources.pdf") viewOptions.pdf_optimization_options = PdfOptimizationOptions() viewer.view(viewOptions) if __name__ == "__main__": optimize_pdf_resources() ``` {{< /tab >}} {{< tab "sample.docx" >}} {{< tab-text >}} `sample.docx` is the sample file used in this example. Click [here](https://docs.groupdocs.com/viewer/python-net/_sample_files/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimization-pdf-resources/sample.docx) to download it. {{< /tab-text >}} {{< /tab >}} {{< tab "optimized_resources.pdf" >}} ```text Binary file (PDF, 719 KB) ``` [Download full output](https://docs.groupdocs.com/viewer/python-net/_output_files/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimization-pdf-resources/optimize_pdf_resources/optimized_resources.pdf) {{< /tab >}} {{< /tabs >}}