Am 06.03.2017 um 20:21 schrieb Gilad Denneboom:
It was this:
doc.getDocumentCatalog().setPageLayout("Default");
There is no such layout. It is kindof a bug that 1.8 allowed you to pass
an invalid value. Valid values:
SinglePageDisplay one page at a time
OneColumnDisplay the pages in one column
TwoColumnLeftDisplay the pages in two columns, with odd-numbered pages
on the left
TwoColumnRightDisplay the pages in two columns, with odd-numbered pages
on the right
TwoPageLeft(PDF 1.5) Display the pages two at a time, with odd-numbered
pages on the left
TwoPageRight(PDF 1.5) Display the pages two at a time, with odd-numbered
pages on the right
Default value: SinglePage.
So this works:
public class SetLayout
{
public static void main(String[] args) throws IOException
{
try (PDDocument doc = new PDDocument())
{
PDPage page = new PDPage();
doc.addPage(page);
page = new PDPage();
doc.addPage(page);
doc.getDocumentCatalog().setPageLayout(PageLayout.TWO_PAGE_LEFT);
doc.save(new File("layout.pdf"));
}
}
}
Tilman
On Mon, Mar 6, 2017 at 6:26 PM, Tilman Hausherr <[email protected]>
wrote:
Am 06.03.2017 um 16:53 schrieb Gilad Denneboom:
Hi all,
I'm setting various Initial View settings, including the Page Layout
setting which I want to set as Default, but this does not seem to be one
of
the options of the PageLayout enum, nor does it accept it when I use the
fromString method and supply "Default", "" or null as the input parameter.
This works in PDFBox 1.x...
Any ideas how to achieve it with the new version?
Could you please post the code you used in 1.8 ?
Tilman
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]