Balancing unbalanced Pages tree

A Pages tree in a PDF should of course be a balanced tree. But PDFs exist where all the pages are in a single array, and we must deal with them. I am faced with a file with a Pages tree with more than 10,000 elements in the Kids array. Performance is terrible, gets exponentially worse as one gets towards the end of the file, and Acrobat and plug-ins appear to hang because simple APIs take a long time to complete.
I know that, if one adds pages entirely in Acrobat the pages are balanced. And I know there is no API specifically to rebalance a tree. But I was wondering if a particular API or sequence of APIs would lead to the tree being rebalanced as a side effect. I thought maybe adding a page to the end of the file would work, but that just splits the array into one small one and one with the rest of the elements (rather than a 50:50) split. Any ideas? I'm trying various things, but waiting around to see if they work is rather tedious. (I suspect that adding a page after each 100 pages, then deleting them, might have the desired effect.)

Interestingly, I wrote a simple balancer for this file (simply divides into N nodes of N elements, where N~=sqrt(nodes). So N is about 100 in this case; not an optimal tree, but a quick balancing act. This balancing is not as heavyweight as I expected, just taking a few seconds. And once done, performance on this file returns to normal; before it would take several minutes just to delete a page, or iterate through all pages. Since it does not alter pages (except the Parent key of each Page dictionary) there does not seem to be any notification required.
Can you think of any downside to this little trick?

Similar Messages

  • I have created two related books in Lightroom 5 (Volumes 1 and 2) but my balance of page numbers is off. So I'd like to take some pages out of one book (complete with images) and paste them into the other. Is this possible?

    I have created two related Blurb books in Lightroom 5 (Volumes 1 and 2) but my balance of page numbers is off. So I'd like to take some pages out of one book (complete with images) and paste them into the other. Is this possible?

    Can you zip up a few of your GoPro images, upload them to dropbox.com and post a share link, here, so others can experiment with them, or do you mean this issue is global to all camera models?

  • Same dictionary for document info dictionary and Page Tree

    Hi,
    recently i came across a pdf file which had the same dictionary for the info dictionary and the page tree.
    Thus this "dictionary" looked like this:
    5 0 obj
    <</Author (author) /Count 1 /CreationDate (D:2011112617302401'00') /Creator() /Keywords (keywords) /Kids [8 0 R] /ModDate (D:2011112617302401'00') /Producer (producer) /Subject (subject) /Title (title) /Trapped /False /Type /Pages >>
    Beside the (bad) readability aspect - is that spec compliant?
    Thanks
    ToM

    Depends on your definition of “compliant”.
    Since one is permitted to put whatever keys they want into any dictionary, provided that the required keys are there, assuming that the /Kids array below actually points to a valid page tree, then yes – this would be perfectly fine.  (REALLY WEIRD and STUPID, for a variety of reasons, but valid).
    HOWEVER, a PDF validator or grammar checker, such as the one built into Acrobat, will flag all the keys that don’t belong.

  • Site Index Portlet - Doesn't show page tree

    After installing the Site Index Portlet and adding it to the repository, portlet was visible and could be added to the page. However, it won't show the page tree of the sub-pages.
    Are there any configuration or options to look at to make the sub-pages/page tree visible?
    Portal version is 10g
    Thank you in advance,
    Jouni

    I run again with user Portal
    got the message successfully inserted all the strings
    but i am not sure it whent right as shows following queries
    select ID,count(*) from WWNLS_STRINGS$
    WHERE ID BETWEEN 45075 AND 45098
    group BY ID
    order BY ID;
    one line only exists per ID
    and then
    select SUBSCRIBER_ID, ID, DOMAIN, NAME, LANGUAGE,
    TEXT,
    substr(TEXT_START,1,30),
    BASE_STRING_ID, substr(TEXT_STRING,1,50)
    from WWNLS_STRINGS$
    WHERE LANGUAGE in ('us', 'fr')
    AND ID BETWEEN 45075 AND 45098
    order by LANGUAGE;
    field TEXT seems incomplete and having still NLs in it.
    I run it for Language us and Language fr but got only first version back
    Should I delete those entries first before reinserting them?
    Isnt there an easier way?
    I

  • TRIAL BALANCE WITH  ALV TREE CONTROL

    Hi Friends,
    My manager wants to see trial balance with cost centers like ALV tree control display.
    Does SAP have any Std trial balance report which can show cost centers also for accounts and activities within those cost centers.
    Please help.
    Thanks

    Nelow message will appear and not possible technically
    Output option ALV Tree Control: Parameter Scaling set to 0/0
    Message no. FR098
    Diagnosis
    You selected output option ALV Tree Control. For technical reasons, only  the value 0/0 is possible for the parameter Scaling.
    System Response
    Parameter Scaling set to the value 0/0.
    Procedure
    If you want to compare the program output for output options ALV Tree Control and Classical list, you have to also set the parameter Scaling  to '0/0' when running the program with output option Classical list.

  • Dashboards + pages tree

    Hi,
    is there any option how to display the list of dashboards and their pages in a tree menu within home page?
    thanks
    robo

    hi,
    For the dashboards you have to add the following tag in instanceconfig.xml
    +<DashboardMaxBeforeMenu>1</DashboardMaxBeforeMenu>+
    For pages pls go through this post
    Re: OBIEE Dashboard  -   Dashboard Pages as drop-down menu items
    thanks,
    saichand

  • Web Page Tree View Not Working for One Client

    Hello all,
    I have one client who is suddenly having problems with the "Tree View" in Web Pages. He clicks it and nothing happens, so he can only view pages by List View. Also, when he clicks the pagination at the bottom of List View, nothing happens. However, he can still use the Next/Previous and First Page/Last Page arrows - they work, but it takes forever to find a page since it's a very large site.
    He logged in on a co-worker's computer, and did not have the problem. He's running Windows XP, and it happens in both FF & Chrome. He updated flash and java, and disabled all his extensions and it still caused the problem.
    Has anyone else seen this? I'm at a loss as to what to do. He's the only one within the organization that is having this problem, and of course, he's the one who uses ABC the most. He's super frustrated.
    Thanks!

    Okay, it turns out the problem is when the client is logged in in French. When he switches his account to English, the problem goes away. When he logs in on his computer with a co-workers username, it works in English, but not in French. When he logs in at the co-worker's computer with either his or her username, same thing - it works in English, but not in French.
    So, there is something wrong with French UI.

  • ACE Load balancing web page hosted by Microsoft CMS reponding too slow

    My pages hosted by an CMS (content managment server), open too slow when passing trought the ace. Any ideas?
    Regard's,
    Miguel Amaral

    2 GB is the minimum memory configuration to run Yosemite at all. Given that limitation you will constantly need to be mindful of the programs you're running.
    ESET will only place additional demands on that Mac's limited system resources. Uninstall it. It is capable of nothing beneficial and your Mac cannot operate properly with it installed.
    Back up your Mac prior to making any changes to its file system. To learn how to use Time Machine read Mac Basics: Time Machine backs up your Mac - Apple Support.
    ESET offers no obvious way to uninstall it. To do that you must use the "Eset Cyber Security Pro Setup Wizard" included with its installation package.
    Use the Uninstall icon:
    Disregard the blatantly fraudulent "Warning!" that appears:
    Lie about the reason in the following step, which cannot be bypassed. ESET's developer is disingenuous and expects the same of its users:
    ESET's uninstaller leaves components behind but it is sufficiently effective to render this piece of trash inert.

  • How to display XML file(as markup) in jsp page..?

    Hi All,
    * I have to display the XML file(as markup) in jsp page (Tree Format)....
    * My XML file is an java.io.file object , and how to view this XML file on my JSP page...........
    Thanks in Advance,
    JavaImran

    You mean you want to see the XML source?
    You need to replace the characters '<' and '&' with corresponding entities '&lt;' and '&amp;'. You can use replaceAll, but do the ampersands first.
    Then I suggest you probably want to put them in a <PRE> block.

  • Setting a Custom Scope in a Page

    Greetings again
    i am trying to set a custom scope for my pages, i am following the example 6.3.2 Setting Scope in a Page - Create New Task Flow in the Oracle® Fusion Middleware
    Developer's Guide for Oracle WebCenter 11g Release 1 (11.1.1) E10148-06.
    i have a managed bean whose class name is AdministratorPagView and has a method called getScopeName() that returns a String. My adfc-config.xml archive looks like this
    adfc-config xmlns="http://xmlns.oracle.com/adf/controller" version="1.2">
    <managed-bean id="__3">
    <managed-bean-name id="__1">adminPagView</managed-bean-name>
    <managed-bean-class id="__2">view.AdministratorPagView</managed-bean-class>
    <managed-bean-scope id="__4">request</managed-bean-scope>
    </managed-bean>
    </adfc-config>
    then in my page definition archive called AdministratorPagPageDef.xml that corresponds to the JSPX where the create page task flow, there is a parameter for that task flow like this:
    <parameters>
    <parameter id="oracle_webcenter_page_createpage_scopename"
    value="${adminPagView.scopeName}"/>
    </parameters>
    so i try creating a page and when i finish creating it the getPateTreeITerator does not show me anything and looking into the WL Server floders for the mds, i just found a scope.xml file in a path structure like this one
    DefaultDomain/webcenter/mds-integServerRepos/<my_app_name>/oracle/webcenter/framework/scope/scopedMD/<custom_scope_name>/scope.xml, but the new folder that reference to a new scope is not being created
    is there something i am missing?
    Edited by: Luis_muxhaxho_betancourth on 24/06/2010 08:46
    Edited by: Luis_muxhaxho_betancourth on 24-jun-2010 18:54

    the pages are being placed in a diferent folder from the one used when defaultScope is set, how can i make those pages visible in the page tree for my user ?

  • Adding a page path to an "all items in page group" SELECT?

    I have a case where a client's asked me to produce a "report" (nothing fancy, so I'm thinking a basic SELECT right out of the DB here rather than a full solution like Discoverer or Business Objects) for them on all items in particular page groups in our Portal (v10.1.2.0.2).
    I have a query that Oracle Support provided which I can fiddle with a bit to get most of the info I need:
    select I.ID, I.display_name, I.name, I.itemtype, P.name
    from PORTAL.WWSBR_ALL_ITEMS I,
    PORTAL.WWSBR_ALL_CONTENT_AREAS CA,
    PORTAL.WWSBR_ALL_FOLDERS P
    where CA.name = 'MY_PAGE_GROUP'
    and P.caid = CA.id
    and I.caid = CA.id
    and I.folder_id=P.id
    and I.active=1
    and I.is_current_version=1
    and I.visible=1
    and I.itemtype in ('basefile','baseimagemap','basetext','baseurl');
    ...however, what I'd like to do is add a "page path" column; that is, one that would trace up the tree from the item's page to the root of the page group and present something like "My Page Group > Departments > HR" like you get in Portal Navigator.
    I can think of how to do this, conceptually, by tracing through the parent pages in WWSBR_ALL_FOLDERS, but what I'm not quite sure about is how to do it for an arbitrary depth in the page tree - i.e., the page can be any (reasonable) number of levels from the page group's root.
    Any thoughts? I'd prefer to do this as a basic SQL query if at all possible, but writing a little reusable PL/SQL procedure to do it isn't out of the question. My knowledge of PL/SQL is pretty rudimentary but I have enough programming experience in other languages that I could probably manage to bumble through it if necessary.
    Thanks.

    First create a page that can contain two regions. One for a page-path item, and another to have a report portlet.
    For the page-path, you can have another region in your page. Then edit this region to make it items type. Now add an item of type 'Page Path', with depth 3.
    Now, you can create a portal report based on your SQL query, publish it as portlet, add it on that page as portlet.
    That will give you exactly what you have described you want.
    hope that helps!
    AMN

  • Tree component customization

    Hi all,
    I'm new to flex and having a hard time figuring out the best way to approach the following problem (in Flex context, _not_ AIR):
    I need a tree representation of some hierarchical/composite data structures as depicted below (for those familiar with XMLSpy, the diagram is similar to the XSD tree structure diagrams):                                                                                     |-------------|
                                                                                         | Child       |
                                                                                         | child info  |
                                          |------------------|                           |-------------|
                                       |--| Child            |--------- Choice (x) ------|
                                       |  | Child Info      (x)                          |-------------|
                                       |  --------------------                           | Child       |
                                       |                                                 | child info  |
    ---------------                    |  |------------------|                           |-------------|
    | Parent      |------ Sequence (x)-|--| Child            |
    | Parent Info (x)                  |   | Child Info     (x)
    ---------------                    |   --------------------
                                       |
                                       |  |------------------|
                                       |--| Child            |
                                          | Child Info      (x)
    The (x) in the picture are the collapse/expand buttons.
    What would be the best way to approach this project ?
    - Is it a customization of the standard Tree component + custom Tree Item Renderer ?
    - The nodes should be expandable/collapsible + selectable (additional information to be displayed on selection of node without expand/collapse effect)
    - For the nodes would it make sense to derive them from the ToggleButton ? (and what would be the most sensefull way of introducing the second line on the button ? Or just building a proper graphical component for it (derived from Group)?
    - What is the most effective way to deal with the balancing of the tree in such a way that subtrees move out of the way/in place on expand resp. collapse of nodes ? (through (H/V)groups ?)
    - What would be the most efficient way to deal with the connectors between nodes ?
    - dataprovider would be an XML structure - what is the best place to put the building algo ? (Every node know how to create itself and the first level children ? Or a tree traverse on the XML structure, building all components in one go ?)
    Any advice/thoughts/references are welcome !
    Thanks in advance,
    Best regards,
    Bart

    Sorry for the "text picture" - if you copy/paste it in word (with courier new font
    ), the picture becomes clear ;-)

  • Error when trying to see pages in webcenter app with adf security activated

    Greetings
    I have this problem
    I developed a WebCenter Application that uses ADF Security with form authentication. This App has
    two JSPX the first one is the login page and the second one is the page where i manage runtime created pages
    using the CREATE PAGE task flow and a page tree iterator to see my created pages.
    when i deploy de application on the weblogic server i am able to login successfully and create as many pages as
    i want and also see them using the link generated. the problem is that when a delete the application from the weblogic
    server, i mean the deployed application, then redeploy the same application on the server i can login again and
    see the pages i created before but when i try to reach them i get this error showed in my internet browser:
    Error 401--Unauthorized
    From RFC 2068 Hypertext Transfer Protocol -- HTTP/1.1:
    10.4.2 401 Unauthorized
    The request requires user authentication. The response MUST include a WWW-Authenticate header field (section 14.46)
    containing a challenge applicable to the requested resource. The client MAY repeat the request with a suitable Authorization
    header field (section 14.8). If the request already included Authorization credentials, then the 401 response indicates that
    authorization has been refused for those credentials. If the 401 response contains the same challenge as the prior response,
    and the user agent has already attempted authentication at least once, then the user SHOULD be presented the entity that was
    given in the response, since that entity MAY include relevant diagnostic information. HTTP access authentication is explained
    in section 11.
    Does anybody now what kind of configuration i am missing or what is happening?
    thanks for your help

    this issue has a solution showed on the this thread Re: ERROR when trying to see pages created with create page task flow

  • Tree Issues

    Hi All,
    I'm using APEX 4.1 with Oracle 11g. I have created a page with the following:
    1. Tree region which includes the selected_node_page_item option so the user can click on a node and the node is remembered when user browses away from the page and returns.
    2. SQL Report built on a dynamic query so the user can enter a search which returns a results of potential records/nodes that the user may want to navigate to in my tree region (by clicking on a search result)
    Everything is working quite well except for a couple of issues that need to be addressed:
    1. The tree loads with no issues in Firefox and Chrome however, it is extremely slowly to load in IE8 and in some cases I get an IE prompt stating:
    "Stop running this script? A script on this page is causing Internet Explorer to run slowly. If it continues to run, your computer may become unresponsive."
    2. Although my search feature is working in that it highlights the tree node that the user selects in my search grid, it does not actually scroll the page/tree to where the highlighted node is. This means that the user has to scroll the page and keep a sharp eye to spot the highlighted node, not ideal for large trees ! Is there a way I can get the cursor to the highlighted node?
    Any help on both issues would be appreciated.
    Thanks
    Billy

    Billy,
    While i can't really say why IE8 would be so much slower, I can't say it really surprises me. 3000 nodes is a lot too! It's probably just real slow in processing it all.
    However, you could eliminate a lot of frustration by not having your page submit on every action. Having to reload the page just because you want to select a different node is complete overkill when your tree is so large, and especially when the browser is so slow.
    What actually happens when you use the default method which submits? On load, the tree is initialized, and it runs some javascript code which will select the branch corresponding to the id in the selected node item:
    apex.jQuery.tree.reference(l$Tree).select_branch(l$Node);By implementing some javascript you can skip the entire submit process, saving time and bandwidth. I've implemented this on my tree demo page : http://apex.oracle.com/pls/apex/f?p=54687:38
    All the code I used is there aswell, so it shouldn't be to hard to figure out what you need. Leave a comment if you do need some help.
    I've also added in code which will scroll to the selected node until it is in view at the top of the page. This is a solution from StackOverflow: http://stackoverflow.com/questions/6677035/jquery-scroll-to-element
    $("#button").click(function() {
         $('html, body').animate({
             scrollTop: $("#elementtoScrollToID").offset().top
         }, 2000);
    });

  • How to refresh the tree

    hi
    I am using jdev 11g
    in my page ,i use <af:panelSplitter> panel , left is my tree ,right is tree node details with dynamic region , because the different level has the different details page, so i use dynamic region
    But when the node details update or delete at right, my left tree can not refresh ,how to refresh with ManagerBean or others ?
    who can help me? thanks very much , i am waiting for your reply on line.

    hi, tks,
    in dynamic region , there is another page ,how to set PartialTriggers between two page(tree page and page in region ), perhaps it can't?

Maybe you are looking for