pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gilad Denneboom <gilad.denneb...@gmail.com>
Subject Re: Setting Page Layout to Default in PDFBox 2.0
Date Mon, 06 Mar 2017 21:37:08 GMT
When I select the "Default" option in Acrobat it doesn't behave the same as
the "Single Page" option, though, and when I examine the file's internal
structure I can see that the Default option basically means that the
PageLayout parameter is missing from the Root. So should it not be possible
to reset this setting using PDFBox?

On Mon, Mar 6, 2017 at 9:48 PM, Tilman Hausherr <THausherr@t-online.de>
wrote:

> 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 <THausherr@t-online.de>
>> 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: users-unsubscribe@pdfbox.apache.org
>>> For additional commands, e-mail: users-help@pdfbox.apache.org
>>>
>>>
>>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message