【Foxit PDF SDK】福昕GSDK如何通过压缩PDF文件中的彩色、灰度和黑白图像来减少PDF文件的大小?

请参考以下代码:

PauseUtil pause = new PauseUtil();

OptimizerSettings settings = new OptimizerSettings();

System.out.println("Optimized Start.");

Progressive progressive = Optimizer.optimize(doc, settings, pause);

int state = Progressive.e_ToBeContinued;

while (state == Progressive.e_ToBeContinued) {

state = progressive.resume();

int rate = progressive.getRateOfProgress();

System.out.println("Optimize progress percent: " + rate + "%");

}

if(state == Progressive.e_Finished)

{

doc.saveAs("ImageCompression_Optimized.pdf",e_SaveFlagRemoveRedundantObjects);

}