stacktome
stacktome

Reputation: 790

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.

Upvotes: 1

Views: 1396

Answers (2)

Daniel Rikowski
Daniel Rikowski

Reputation: 72534

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.

Upvotes: 1

mkl
mkl

Reputation: 96029

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.

Upvotes: 0

Related Questions