MATLAB Answers

Create PDF of Live Script produces broken PDF file

44 views (last 30 days)
Jon
Jon on 13 Nov 2017
Edited: Danielle on 2 Mar 2018
I am running MATLAB 2017a, on a MacBook Pro (2017, 15"), under OS X 10.13.1. When I try to save a Live Script as PDF, I get about 1000 java errors. The PDF is still generated, BUT the PDF file is broken - Acrobat will not open it.
When I open the same Live Script, under the same OS, but on my 2013 MBA, the PDF is generated with a thousand JAVA errors, BUT the PDF is not broken. Adobe Acrobat will open the PDF.
So it would appear that there is some interaction between the new crop of MBPs and MATLAB that is a problem. My MBP is Model Name: MacBook Pro Model Identifier: MacBookPro14,3 Processor Name: Intel Core i7 Processor Speed: 3.1 GHz Number of Processors: 1 Total Number of Cores: 4 L2 Cache (per Core): 256 KB L3 Cache: 8 MB Memory: 16 GB Display: 15.4-inch (2880 x 1800) Graphics: Radeon Pro 560 4 GB ...
My version of Java is current. I typically run with an external Thunderbolt display, but that is not the issue - I get the same result on the MBP if I run only the laptop screen.
For me, and I would guess anyone that is trying to use Live Scripts as a way to generate class-ready materials as PDF that this is a significant problem.
I would add - whether a good PDF is generated or not... seeing all those JAVA errors is disconcerting, and puzzling.
Best, ---jon---
  3 Comments
Steffany Reyna Marquez
Steffany Reyna Marquez on 15 Nov 2017
Hello! I have exactly the same issue as Jon (a long message error and PDF empty). I run MATLAB 2017a in macOs highSierra (10.13.1). I updated my computer to this last version of macOS yesterday and whenever I click on "export to PDF" I get the following error:
Exception in thread "AWT-EventQueue-0" com.mathworks.util.event.EventListenerInvocationException: Error firing event:
caused by:
java.lang.OutOfMemoryError: Java heap space
at org.apache.commons.io.output.ByteArrayOutputStream.toByteArray(ByteArrayOutputStream.java:322)
at org.apache.commons.io.IOUtils.toByteArray(IOUtils.java:463)
at org.apache.fop.fonts.truetype.FontFileReader.<init>(FontFileReader.java:44)
at org.apache.fop.fonts.autodetect.FontInfoFinder.find(FontInfoFinder.java:204)
at org.apache.fop.fonts.FontAdder.add(FontAdder.java:63)
at org.apache.fop.fonts.FontDetectorFactory$DefaultFontDetector.detect(FontDetectorFactory.java:105)
at org.apache.fop.fonts.FontManager.autoDetectFonts(FontManager.java:229)
at org.apache.fop.fonts.DefaultFontConfigurator.configure(DefaultFontConfigurator.java:82)
at org.apache.fop.render.PrintRendererConfigurator.getCustomFontCollection(PrintRendererConfigurator.java:147)
at org.apache.fop.render.PrintRendererConfigurator.setupFontInfo(PrintRendererConfigurator.java:127)
at org.apache.fop.render.intermediate.IFUtil.setupFonts(IFUtil.java:170)
at org.apache.fop.render.intermediate.IFRenderer.setupFontInfo(IFRenderer.java:187)
at org.apache.fop.area.RenderPagesModel.<init>(RenderPagesModel.java:75)
at org.apache.fop.area.AreaTreeHandler.setupModel(AreaTreeHandler.java:135)
at org.apache.fop.area.AreaTreeHandler.<init>(AreaTreeHandler.java:105)
at org.apache.fop.render.RendererFactory.createFOEventHandler(RendererFactory.java:350)
at org.apache.fop.fo.FOTreeBuilder.<init>(FOTreeBuilder.java:107)
at org.apache.fop.apps.Fop.createDefaultHandler(Fop.java:104)
at org.apache.fop.apps.Fop.<init>(Fop.java:78)
at org.apache.fop.apps.FOUserAgent.newFop(FOUserAgent.java:182)
at org.apache.fop.apps.FopFactory.newFop(FopFactory.java:240)
at com.mathworks.hg.print.MWFopFactory.newFop(MWFopFactory.java:137)
at com.mathworks.mde.liveeditor.widget.rtc.export.PDFFileUtils.write(PDFFileUtils.java:69)
at com.mathworks.mde.liveeditor.widget.rtc.export.PDFExporter.writeXSLToPDFWithFile(PDFExporter.java:31)
at com.mathworks.mde.liveeditor.widget.rtc.export.PDFExporter.export(PDFExporter.java:40)
at com.mathworks.mde.liveeditor.LiveEditorClient.handleSaveAsNonMlxFile(LiveEditorClient.java:584)
at com.mathworks.mde.liveeditor.LiveEditorClient.access$700(LiveEditorClient.java:121)
at com.mathworks.mde.liveeditor.LiveEditorClient$5.saveAsAboutToHappen(LiveEditorClient.java:539)
at com.mathworks.widgets.datamodel.AbstractFileBackingStore.saveToFile(AbstractFileBackingStore.java:118)
at com.mathworks.widgets.datamodel.AbstractFileBackingStore.doSaveToFileAndUpdateBackingStore(AbstractFileBackingStore.java:259)
at com.mathworks.widgets.datamodel.AbstractFileBackingStore.doNegotiateSaveAs(AbstractFileBackingStore.java:237)
at com.mathworks.widgets.datamodel.AbstractBackingStore.negotiateSaveAs(AbstractBackingStore.java:131)
at com.mathworks.util.event.EventListenerList$1.invoke(EventListenerList.java:83)
at com.sun.proxy.$Proxy7.listItemSelected(Unknown Source)
at com.mathworks.toolstrip.plaf.TSListCellRenderer.mouseReleased(TSListCellRenderer.java:482)
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:290)
at java.awt.Component.processMouseEvent(Component.java:6516)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3321)
at java.awt.Component.processEvent(Component.java:6281)
at java.awt.Container.processEvent(Container.java:2229)
at java.awt.Component.dispatchEventImpl(Component.java:4872)
at java.awt.Container.dispatchEventImpl(Container.java:2287)
at java.awt.Component.dispatchEvent(Component.java:4698)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)
at java.awt.Container.dispatchEventImpl(Container.java:2273)
at java.awt.Window.dispatchEventImpl(Window.java:2719)
at java.awt.Component.dispatchEvent(Component.java:4698)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:740)
at java.awt.EventQueue.access$300(EventQueue.java:103)
at java.awt.EventQueue$3.run(EventQueue.java:699)
at java.awt.EventQueue$3.run(EventQueue.java:697)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
at java.awt.EventQueue$4.run(EventQueue.java:713)
at java.awt.EventQueue$4.run(EventQueue.java:711)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:710)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
I have to say that this error has not appeared before updating to highSierra (I have been working with live scripts for the past 2 months with the older version Sierra).
Hope this helps you to try and find the bug in the software. Best Regards Steffany

Sign in to comment.

Accepted Answer

Jon
Jon on 16 Nov 2017
Martin,
THANKS! Increasing the Java heap size by 50% did correct the problem on the LiveScript I was working with. Since you indicate that this problem was on some machines with the most recent Sierra (which is High Sierra, 10.13.1, I thoought you might want to know more characteristics of my machine. (Below - if more would be useful let me know.)
I really appreciate the responsiveness of the MathWorks in times like this!
---jon---
Hardware Overview:
Model Name: MacBook Pro
Model Identifier: MacBookPro14,3
Processor Name: Intel Core i7
Processor Speed: 3.1 GHz
Number of Processors: 1
Total Number of Cores: 4
L2 Cache (per Core): 256 KB
L3 Cache: 8 MB
Memory: 16 GB
Boot ROM Version: MBP143.0167.B00
SMC Version (system): 2.45f0
Serial Number (system): <snip>
Hardware UUID: <snip>
Video Cards
Intel HD Graphics 630: Chipset Model: Intel HD Graphics 630 Type: GPU Bus: Built-In VRAM (Dynamic, Max): 1536 MB Vendor: Intel Device ID: <snip> Revision ID: 0x0004 Automatic Graphics Switching: Supported gMux Version: 4.0.29 [3.2.8] Metal: Supported, feature set macOS GPUFamily1 v3
Radeon Pro 560: Chipset Model: Radeon Pro 560 Type: GPU Bus: PCIe PCIe Lane Width: x8 VRAM (Total): 4 GB Vendor: AMD (0x1002) Device ID: <snip> Revision ID: 0x00c0 ROM Revision: 113-C980AJ-927 VBIOS Version: 113-C9801AU-A02 EFI Driver Version: 01.00.927 Automatic Graphics Switching: Supported gMux Version: 4.0.29 [3.2.8] Metal: Supported, feature set macOS GPUFamily1 v3 Displays: Color LCD: Display Type: Built-In Retina LCD Resolution: 2880 x 1800 Retina Framebuffer Depth: 30-Bit Color (ARGB2101010) Mirror: Off Online: Yes Rotation: Supported Automatically Adjust Brightness: No Thunderbolt Display: Display Type: LCD Resolution: 2560 x 1440 Framebuffer Depth: 30-Bit Color (ARGB2101010) Display Serial Number: <snip> Main Display: Yes Mirror: Off Online: Yes Rotation: Supported Automatically Adjust Brightness: No Connection Type: DisplayPort

More Answers (1)

Martin Knelleken
Martin Knelleken on 16 Nov 2017
George, Steffany
Thanks for your reply/post. For unknown reasons, you're running out of Java memory on certain machines with the most recent Sierra version. We've to figure out why this happens and how to handle this more nicely.
For now you can try to increase the Java Heap Memory in MATLAB. See https://www.mathworks.com/help/ matlab/matlab_external/java-heap-memory-preferences.html
I expect an increase of 50% would be sufficient.
I hope that helps.
- Martin
  1 Comment
Danielle
Danielle on 2 Mar 2018
Hi Martin. I am experiencing the same problem. I have tried increasing the Java Heap memory but my file continues to stay broken and not opening. It also does not want to print. Any other suggestions?

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!