Some test text!
PDF Flattener component (pdftron.PDF.Flattener) can be used to speed-up PDF rendering on mobile devices and on the Web.
PDF documents can frequently contain very complex page description (e.g. thousands of paths, different shadings, color spaces, blend modes, large images etc.) that may not be suitable for interactive viewing on mobile devices.
Flattener can be used to speed-up PDF rendering on mobile devices and on the Web by simplifying page content (e.g. flattening complex graphics into images) while maintaining vector text whenever possible.
A quick way to try Flattener is by using DocPub CLI (e.g. docpub -f pdf my.pdf).
To flatten a PDF using default settings.
PDFDoc doc = new PDFDoc(input_path + "TigerText.pdf"); Flattener fl = new Flattener(); // The following lines can increase the resolution of background images. //fl.SetDPI(300); //fl.SetMaximumImagePixels(5000000); // This line can be used to output Flate compressed background // images rather than DCTDecode compressed images which is the default //fl.SetPreferJPG(false); // In order to adjust thresholds for when text is Flattened // the following function can be used. //fl.SetThreshold(Flattener.Threshold.e_keep_most); // We use e_fast option here since it is usually preferable // to avoid Flattening simple pages in terms of size and // rendering speed. If the desire is to simplify the // document for processing such that it contains only text and // a background image e_simple should be used instead. fl.Process(doc, Flattener.FlattenMode.e_fast);
Compress & optimize PDF files
Full code sample which shows how to use 'pdftron.PDF.Flattener' by simplifying page content (e.g. flattening complex graphics into images) while maintaining vector text.
Get the answers you need: Support