简体   繁体   中英

How to set the PDDocument as pageable in PDFBox 2.0.0?

How to use the pageable function in PDFBox 2.0.0. I did my application using PDFBox 1.8.3. I can able to set the document in Pageable format using PDFBox 1.8.3. But I'm unable to set the document as pageable in 2.0.0

PrintJob job = new PrintJob();
job.setPageable(pddocument);

Could you please help me.

There is a migration guide for updating from 1.8 to 2.0.

Your code should look like:

job.setPageable(new PDFPageable(pddocument));

Note: It is PDFPageable , not PDPageable .

You can do

job.setPageable(new PDPageable(pddocument, job));

This is, BTW, essentially what PDDocument.print(PrinterJob, boolean) already used to do in PDFBox version 1.8.3.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM