Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/ViewerPreferences [/FitWindow] #303

Closed
THausherr opened this issue Aug 7, 2015 · 14 comments
Closed

/ViewerPreferences [/FitWindow] #303

THausherr opened this issue Aug 7, 2015 · 14 comments
Assignees
Labels

Comments

@THausherr
Copy link

I found this in a PDF created with your software:

1 0 obj
<< /Title (Example Manual)
/Author (Doc Writer)
/Creator (Asciidoctor PDF 1.5.0.alpha.9, based on Prawn 1.3.0)
/Producer (Doc Writer)
/CreationDate (D:20150807192809+02'00')
/ModDate (D:20150807192809+02'00')
>>
endobj
2 0 obj
<< /Type /Catalog
/Pages 3 0 R
/Names 14 0 R
/Outlines 70 0 R
/PageLabels 86 0 R
/PageMode /UseOutlines
/ViewerPreferences [/FitWindow]
>>
endobj

Viewer preferences dictionary is a dictionary, not an array. Such wrong PDFs can result in problems with PDF software, as shown here:
https://issues.apache.org/jira/browse/PDFBOX-2924

@mojavelinux
Copy link
Member

Can you explain what it should be?

I believe I set it this way because it's the only thing that made evince work correctly. Of course, I'll try it with the way you propose to verify that evince responds to a dictionary as well.

@THausherr
Copy link
Author

Probably like this:

/ViewerPreferences <</FitWindow true>>

@mojavelinux mojavelinux added this to the v1.5.0.beta.1 milestone Aug 10, 2015
@mojavelinux mojavelinux self-assigned this Aug 10, 2015
@mojavelinux
Copy link
Member

Thanks for the clarification.

I learned a few things here. First, that /ViewerPreferences is indeed supposed to be a map. Once I switched to a map, I realized that /FitWindow isn't the preference we want anyway. That adjusts the window size to fit the initial magnification, which is not what we want. Instead, we need to use /OpenAction to control the initial magnification (and the first page to open, which we'll set to page 1 for now).

I'm also going to enable the /DisplayDocTitle to show the document title in the window title bar.

mojavelinux added a commit that referenced this issue Aug 11, 2015
resolves #303 use map for ViewerPreferences; set initial magnification
@mojavelinux
Copy link
Member

How does the solution in #304 look to you, @THausherr?

@THausherr
Copy link
Author

I would have to see a PDF generated with your software. I am not a user of your software, I just got in trouble with a software generated with your product. Either point me to an URL where it is (maybe in the repository), or e-mail it to me here: tilman at snafu dot de.

@mojavelinux
Copy link
Member

Oops! I forgot to regenerate the example PDF files. Once I do that, you can pull it directly out of the repo. Stay tuned.

mojavelinux added a commit that referenced this issue Aug 13, 2015
@mojavelinux
Copy link
Member

@THausherr I have made the example PDFs available in the following directory:

https://github.com/asciidoctor/asciidoctor-pdf/tree/master/examples

Here's how the header is now written:

2 0 obj
<< /Type /Catalog
/Pages 3 0 R
/Names 15 0 R
/Outlines 22 0 R
/PageLabels 25 0 R
/PageMode /UseOutlines
/OpenAction [7 0 R /FitH 793.0]
/ViewerPreferences << /DisplayDocTitle true
>>
>>
endobj

@THausherr
Copy link
Author

2 files were updated, but these 2 don't have any ViewerPreferences?!

@mojavelinux
Copy link
Member

mojavelinux commented Aug 13, 2015 via email

@THausherr
Copy link
Author

I answered several days ago, and my comment is gone?!

this is the basic-example.pdf file:

1 0 obj
<</Type /Catalog /Pages 3 0 R
/Outlines 5 0 R
/PageLabels<<
/Nums [0 <<
/P (i)
>> 2 <<
/P (2)
>>]
>>
/Metadata 44 0 R
>>
endobj

no /OpenAction, no /ViewerPreferences.

@mojavelinux
Copy link
Member

I answered several days ago, and my comment is gone?!

😟 That's troubling. Are you sure it posted? The last notification I received was the comment from Aug 13 (5 days ago), so perhaps the browser didn't submit it successfully (or the other end didn't receive).

I'll go ahead and link to an uncompressed version of the file so that you can see the output exactly as it is generated.

Note that it was generated from the master branch, not from a release.

@THausherr
Copy link
Author

The new file is fine, both internally and does have the expected effects when opening with Adobe Reader. The file from 6 days ago doesn't.

@mojavelinux
Copy link
Member

\o/

@mojavelinux
Copy link
Member

Thanks for testing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants