Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 1ADC7200C2F for ; Mon, 6 Mar 2017 22:52:07 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 19857160B76; Mon, 6 Mar 2017 21:52:07 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 5F3A8160B66 for ; Mon, 6 Mar 2017 22:52:06 +0100 (CET) Received: (qmail 83278 invoked by uid 500); 6 Mar 2017 21:52:05 -0000 Mailing-List: contact users-help@pdfbox.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@pdfbox.apache.org Delivered-To: mailing list users@pdfbox.apache.org Received: (qmail 83267 invoked by uid 99); 6 Mar 2017 21:52:04 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 06 Mar 2017 21:52:04 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 66E591AA953 for ; Mon, 6 Mar 2017 21:52:04 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -1.2 X-Spam-Level: X-Spam-Status: No, score=-1.2 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, RP_MATCHES_RCVD=-2.999] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id 8QkkfBEY3-yT for ; Mon, 6 Mar 2017 21:52:02 +0000 (UTC) Received: from mailout11.t-online.de (mailout11.t-online.de [194.25.134.85]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id 00A9E5F403 for ; Mon, 6 Mar 2017 21:52:01 +0000 (UTC) Received: from fwd11.aul.t-online.de (fwd11.aul.t-online.de [172.20.27.152]) by mailout11.t-online.de (Postfix) with SMTP id 88E5D425BB0B for ; Mon, 6 Mar 2017 22:52:01 +0100 (CET) Received: from [192.168.2.105] (bKVMPoZE8hTIkZGKT86n9OD64RKupygq9hTjTLTNkTbwPoj662WAf4Kh8qDOuoTZqv@[217.231.157.82]) by fwd11.t-online.de with (TLSv1.2:ECDHE-RSA-AES256-SHA encrypted) esmtp id 1cl0Xt-0EUusS0; Mon, 6 Mar 2017 22:51:57 +0100 Subject: Re: Setting Page Layout to Default in PDFBox 2.0 To: users@pdfbox.apache.org References: <062c9978-f0ba-64de-849c-d6d57c38e7cd@t-online.de> From: Tilman Hausherr Message-ID: <98512b62-a2e9-fe20-703a-a2e210149de0@t-online.de> Date: Mon, 6 Mar 2017 22:51:58 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-ID: bKVMPoZE8hTIkZGKT86n9OD64RKupygq9hTjTLTNkTbwPoj662WAf4Kh8qDOuoTZqv X-TOI-MSGID: e5390242-8048-4cd5-8f3b-0dc787f8f168 archived-at: Mon, 06 Mar 2017 21:52:07 -0000 Am 06.03.2017 um 22:37 schrieb Gilad Denneboom: > 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? sure, just do this: doc.getDocumentCatalog().getCOSObject().removeItem(COSName.PAGE_LAYOUT); Tilman > > On Mon, Mar 6, 2017 at 9:48 PM, Tilman Hausherr > 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 >>> 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 >> >> --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org For additional commands, e-mail: users-help@pdfbox.apache.org