"Failed to load HTTP resource" when trying to publish a pdf

317 次查看(过去 30 天)
Hi, I'm getting a this error message in the command window when I try to publish my code as a pdf in Matlab. Publishing it as a HTML or doc file doesn't give any errors. My code works fine and does not get any errors when running it.
"Error using mlreportgen.re.internal.xml.transform.Transformer/transform"
"Unable to parse input file: {my file location}"
"Reason: failed to load HTTP resource"
The input file points to a .xml file that has the same name as the .m file I try to publish.
In addition, sometimes the reason changes to "Content error in the external subset".
This error occurs on my Windows 10 desktop and my Windows 11 laptop. I'm using MATLAB Version: 24.1.0.2837808 (R2024a) Update 7 in both.
  1 个评论
Thomas
Thomas 2025-4-15
Hi,
I have the same issue, but only since a few days.
Approx. 2 weaks ago it worked fine with exact the same scripts and the same Matlab Version 2023b.
So what has changed in the last 2 weeks?

请先登录,再进行评论。

回答(5 个)

NVSL
NVSL 2025-3-26
I understand you are facing error(s) when trying to publish your MATLAB code to pdf despite the code being error-free.
You can try to go through following MATLAB Answers thread and make sure you are following all the steps correctly.
Alternately, you can publish your MATLAB code into html using the “publish” function by using the following command in MATLAB Command Window.
publish(“file.m”, ‘html’);
This publishes your code to HTML format, and you can open it by double-clicking the published HTML file, which opens it in a browser.
You can print the file as a PDF using the "CTRL+P" keyboard shortcut or the print button located at the top-left corner of the browser.Hope this helps!
  1 个评论
Alex
Alex 2025-4-15
Hi, I'm also dealing with this issue but the other thread didn't seem to help. Is there any specific reasons this error would occur?

请先登录,再进行评论。


Katy
Katy 2025-4-17
I was having the same issue. Updating to R2025a fixed it!

Lazaros
Lazaros 2025-4-15
I am having the same issue

Sydney
Sydney 2025-4-16
I have the same issue as well. Weird because my code is very short and doesn't require any path inputs.

Timothy
Timothy 2025-4-17
编辑:Timothy 2025-4-17
I have a similar error. My error seems to be linked to publishing graphs. Does anyone have any suggestions to get around this and publish as a PDF I really need this for an assignment. I'm on the latest Mac Os and I have 2024a education edition
Error using mlreportgen.re.internal.xml.transform.Transformer/transform
Unable to parse input file: (File Location).
Reason: failed to load external entity
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"

类别

Help CenterFile Exchange 中查找有关 Startup and Shutdown 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by