If I save a pdf while the sidebar view is on Thumbnails, it switches the view to Contents. This is true if I've last clicked on the contents of the pdf, rather than a thumbnail.
I can't replicate this using olular 17.12.1 from the Arch repos. I made sure the document I tested with had a Contents, switch to Thumbnail, and saved using Save As... to a different location.
I'm using okular 1.3.1 and NOT using "save as" but just "save" after editing a file with annotations.
@Michael D - 1.3.1? 3.2.0 was released in 2004. I tested saving with "Save" after adding annotations, still couldn't reproduce.
On this bug, the drop down the version maxes out at 1.3.1, "okular --version" says 1.3.1, and even through the help gui it says 1.3.1, so... Anyway, I can only reproduce it on certain files and not others. I would attach the file here but it's a pdf book and copyrighted, so I can't do that. It may not be helpful at all, but the metadata says that it was created by PScript5.dll version 5.2, the producer is Adobe Acrobat Distiller 6.0 (Windows), format PDF v. 1.5. I thought it might be the pdf reloading and showing bookmarks by default, but it seems not to be, because when I use the hyperref package with LaTeX with bookmarksopen=true, I can't reproduce the bug.
Hmm, I'm new to the KDE (dev) world, not sure why the package version (and versions on github) are different to the version reported by okular itself and the bugtracker. I am also using 1.3.1 as reported by okular. I guess someone needs to find a non-copyrighted PDF that causes the bug...
Could you try to extract a page or two to a separate file? Like a blank page or a page without copyrighted material?
If I extract pages (e.g. using python-pyPdf) the properties of the original pdf won't (necessarily) be preserved in the resulting extraction, so I don't think it will be helpful. I'll try it out using a couple of methods and report back later.
@Huon really you must be testing the wrong thing because any pdf file with Contents will switch to it if you're not there when saving. You can use https://bugs.kde.org/attachment.cgi?id=27458 as an example. This should be relatively easy to fix.
Created attachment 110552 [details] PDF that does not produce this bug
@Albert I can reproduce the bug in the PDF you linked, however the following PDF does not produce this bug: https://bugs.kde.org/attachment.cgi?id=110552
Git commit 5e622484c874a81718faaac3d948d355d4e03164 by Albert Astals Cid, on behalf of Ahmad Osama. Committed on 13/08/2018 at 09:13. Pushed by aacid into branch 'Applications/18.08'. Fix problem of saving pdf switches from thumbnail view in sidebar to contents view Summary: When save/save as functions are called they internally call the openFile() function, in the open file function the side bar item is set to Table of Contents (ToC) item ``` if ( m_document->metaData( QStringLiteral("OpenTOC") ).toBool() && m_sidebar->isItemEnabled( m_toc ) && !m_sidebar->isCollapsed() && m_sidebar->currentItem() != m_toc ) { m_sidebar->setCurrentItem( m_toc, Sidebar::DoNotUncollapseIfCollapsed ); } ``` so I just store the sidebar's item before saving and then set this item back if changed. Reviewers: #okular Subscribers: aacid, okular-devel Tags: #okular Differential Revision: https://phabricator.kde.org/D14740 M +19 -0 autotests/parttest.cpp M +4 -0 part.cpp M +2 -1 ui/sidebar.h https://commits.kde.org/okular/5e622484c874a81718faaac3d948d355d4e03164
Great, thanks for the fix Albert.