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

Investigate transcribing the PDF content into something lighter weight. #2

Closed
rummelsworth opened this issue Mar 21, 2022 · 7 comments · Fixed by #6
Closed

Investigate transcribing the PDF content into something lighter weight. #2

rummelsworth opened this issue Mar 21, 2022 · 7 comments · Fixed by #6
Milestone

Comments

@rummelsworth
Copy link
Owner

Could still be PDF. Just generating it from plain text might make the vmod file a whole lot smaller.

@rummelsworth rummelsworth added this to the v0.2.0 milestone Mar 21, 2022
@rummelsworth
Copy link
Owner Author

rummelsworth commented Apr 11, 2022

Since it's almost certain I'll be using pandoc for build-automated HTML/PDF generation, I should make sure the markdown I write follows pandoc: https://pandoc.org/MANUAL.html#pandocs-markdown

@rummelsworth
Copy link
Owner Author

rummelsworth commented Apr 12, 2022

When the dust settles on this, I need to update the Dev section in the readme. Specifically, the stuff that eases workflow, like the build watch modes and any other tools (like the Live Preview extension in VS Code).

@rummelsworth
Copy link
Owner Author

Need to consider trying different resize of the images. Instead of 25% for all, maybe 20% for the map and 40--50% for the unit counters.

@rummelsworth
Copy link
Owner Author

The HTML is not opening at all from the menu. Not sure why. No errors are shown at all, including in Event Viewer. The PDFs (direct from pandoc and also printed from the HTML) don't look good at all, so that's kinda not a workaround. Not sure what to do next. I guess try filing a bug/question at the Vassal forums.

@rummelsworth
Copy link
Owner Author

I found the Vassal log file, and it shows two errors when the HTML help menu item is selected:

2022-04-24 17:19:41,519 [3828-AWT-EventQueue-0] ERROR VASSAL.build.module.documentation.BrowserHelpFile - File not found in data archive: help/Rules
java.nio.file.NoSuchFileException: C:\Users\William\AppData\Local\Temp\vassal_10416522038674513410\VASSAL\help\Rules\images\Christian_Cannon_1-0.png
	at java.base/sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:85)
	at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103)
	at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:108)
	at java.base/sun.nio.fs.WindowsFileSystemProvider.newByteChannel(WindowsFileSystemProvider.java:236)
	at java.base/java.nio.file.spi.FileSystemProvider.newOutputStream(FileSystemProvider.java:484)
	at java.base/java.nio.file.Files.newOutputStream(Files.java:228)
	at VASSAL.build.module.documentation.BrowserHelpFile.internalExtractContents(BrowserHelpFile.java:165)
	at VASSAL.build.module.documentation.BrowserHelpFile.extractContents(BrowserHelpFile.java:123)
	at VASSAL.build.module.documentation.BrowserHelpFile.launch(BrowserHelpFile.java:103)
	at VASSAL.build.module.documentation.BrowserHelpFile$1.actionPerformed(BrowserHelpFile.java:96)
	at java.desktop/javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1972)
	at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2313)
	at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:405)
	at java.desktop/javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:262)
	at java.desktop/javax.swing.AbstractButton.doClick(AbstractButton.java:374)
	at java.desktop/javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1028)
	at java.desktop/javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1072)
	at java.desktop/java.awt.Component.processMouseEvent(Component.java:6626)
	at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3389)
	at java.desktop/java.awt.Component.processEvent(Component.java:6391)
	at java.desktop/java.awt.Container.processEvent(Container.java:2266)
	at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5001)
	at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2324)
	at java.desktop/java.awt.Component.dispatchEvent(Component.java:4833)
	at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4948)
	at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4575)
	at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4516)
	at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2310)
	at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2780)
	at java.desktop/java.awt.Component.dispatchEvent(Component.java:4833)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:773)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:722)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:716)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:97)
	at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:746)
	at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:744)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:743)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
2022-04-24 17:19:41,521 [3828-AWT-EventQueue-0] ERROR VASSAL.build.module.documentation.BrowserHelpFile - Malformed URL: rules.html
java.net.MalformedURLException: no protocol: rules.html
	at java.base/java.net.URL.<init>(URL.java:674)
	at java.base/java.net.URL.<init>(URL.java:569)
	at java.base/java.net.URL.<init>(URL.java:516)
	at VASSAL.build.module.documentation.BrowserHelpFile.setFallbackUrl(BrowserHelpFile.java:137)
	at VASSAL.build.module.documentation.BrowserHelpFile.extractContents(BrowserHelpFile.java:127)
	at VASSAL.build.module.documentation.BrowserHelpFile.launch(BrowserHelpFile.java:103)
	at VASSAL.build.module.documentation.BrowserHelpFile$1.actionPerformed(BrowserHelpFile.java:96)
	at java.desktop/javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1972)
	at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2313)
	at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:405)
	at java.desktop/javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:262)
	at java.desktop/javax.swing.AbstractButton.doClick(AbstractButton.java:374)
	at java.desktop/javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1028)
	at java.desktop/javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1072)
	at java.desktop/java.awt.Component.processMouseEvent(Component.java:6626)
	at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3389)
	at java.desktop/java.awt.Component.processEvent(Component.java:6391)
	at java.desktop/java.awt.Container.processEvent(Container.java:2266)
	at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5001)
	at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2324)
	at java.desktop/java.awt.Component.dispatchEvent(Component.java:4833)
	at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4948)
	at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4575)
	at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4516)
	at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2310)
	at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2780)
	at java.desktop/java.awt.Component.dispatchEvent(Component.java:4833)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:773)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:722)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:716)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:97)
	at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:746)
	at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:744)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:743)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

When I checked the named temp folder, it indeed did not have any of the files at all, images or HTML. (It wasn't just missing the images.) However, the bundled help archive inside the module has them. So it's like they're not getting successfully extracted from the archive-inside-the-VMOD to the temp folder. No indications why.

(It also complains that the "start page" value of "rules.html" is malformed because it lacks a protocol. The Designer Guide clearly shows that "rules.html" is a valid "start page" value. So, this 2nd error might be a red herring, just a weird consequence of the first error.)

What's more, is that when I simply remove the images from the content folder and repeat the addition of an HTML help menu item, this problem just doesn't happen. The temp folder extraction succeeds and the HTML file is there, and it gets loaded by the Vassal UI (with broken image links of course, because they're not there anymore).

@rummelsworth
Copy link
Owner Author

rummelsworth commented Apr 25, 2022

Attaching a "test" VMOD to demo the problem, in order to share at the Vassal forum (which doesn't seem to support non-image file insertion/attachment).

test.zip

This file has a "zip" extension because GitHub required it. It's just a VMOD, rename it as necessary.

This VMOD is an empty "new module" but has 3 HTML help items:

  • "Test": Content has single HTML file. Works fine.
  • "Test with image": Content has one HTML file and one image. Works fine.
  • "Test with image folder": Content has one HTML file and, in a subfolder, one image. Reproduces the bug and generates the error in Vassal's log.

Confirmed the "flat folder" workaround as the solution for my actual, non-test module.

@rummelsworth
Copy link
Owner Author

Attaching a new pair of test vmod files for sharing at the Vassal forum.

  • test - before rezip.zip
    • This was recreated from scratch in the Vassal module editor. Both of the img src attribute values are correct here. The help item with an image in a subfolder demonstrates the bug.
  • test - after rezip.zip
    • This was created by unzipping the first vmod, unzipping the problematic help item, rezipping the latter, and finally rezipping the former. The help item in question works here.

@rummelsworth rummelsworth linked a pull request Apr 27, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant