Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a PdfSmartCopy Equivalent in iText7

Tags:

itext7

Is there an equivalent to iText 5's PdfSmartCopy class in iText 7? If not, how do I achieve the same functionality in iText 7?

like image 985
Zdynobeat Avatar asked Dec 11 '25 05:12

Zdynobeat


1 Answers

You can set the SmartMode property of a PdfWriter to true:

/**
 * Sets the smart mode.
 * <p/>
 * In smart mode when resources (such as fonts, images,...) are
 * encountered, a reference to these resources is saved
 * in a cache, so that they can be reused.
 * This requires more memory, but reduces the file size
 * of the resulting PDF document.
 */
public PdfWriter setSmartMode(boolean smartMode)

Using such a PdfWriter to copy pages to is the equivalent of using a PdfSmartCopy.

like image 125
mkl Avatar answered Dec 15 '25 10:12

mkl



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!