Readable MATLAB source documents
Export MATLAB source code as a paged PDF
KissPDF turns an uploaded .m file or pasted MATLAB script or function into normal PDF pages—not screenshots and not one tall image. Functions, matrices, element-wise operators, control flow, strings, comments, plotting commands, and section markers remain easy to scan while the text stays selectable and searchable.
Use this converter when you need to save, print, submit, or share the MATLAB source code itself. It formats the code without running MATLAB or GNU Octave, evaluating the script, calculating workspace values, or rendering figures. The exact preview and downloaded PDF use the same document snapshot.
To export a MATLAB Live Script (.mlx), generated output, or plots, use MATLAB's Live Editor Export or Publish workflow instead. Those MATLAB features can include executed results and figures; KissPDF deliberately creates a readable PDF from plain .m source code only.
Three steps
How to convert MATLAB code or a .m file to PDF
Upload or paste MATLAB code
Open a plain-text .m file or replace the sample with a MATLAB script, function, class definition, numerical method, signal-processing routine, or assignment excerpt. The converter reads source code, not binary .mlx files.
Customize the code document
Adjust the code size, light or dark theme, line numbers, title, paper format, margins, and page numbering while the editor keeps the MATLAB source structure visible.
Preview, save, and download
Inspect the actual paginated PDF, zoom or move around the preview, and download the same layout. You can then save, share, submit, or print the MATLAB code PDF without using a system print-to-PDF workflow.
Made for MATLAB source
When a MATLAB code PDF is useful
MATLAB projects belong in source control, but a stable paged copy is useful when code must be submitted, reviewed, printed, archived, or attached to a report without requiring MATLAB on the reader's device. The PDF presents the source code; it is not a replacement for executable .m files.
Engineering and research appendices
Add numerical methods, simulations, optimization routines, matrix calculations, or data-processing code to a paper or technical report with stable line numbers.
Signal, image, and control-system reviews
Share filtering, FFT, plotting, image-processing, or control scripts as searchable source code without packaging a MATLAB project or workspace.
Assignments and reproducibility records
Present functions, scripts, and experiment setup code in conventional pages that instructors and reviewers can annotate or print.
MATLAB-aware editing
Keep matrices, functions, and comments readable
MATLAB source mixes matrix notation, transposes, element-wise operators, continuation lines, command syntax, and comments. A monospaced code document preserves that structure while automatic pagination creates conventional PDF pages.
MATLAB-compatible CodeMirror highlighting
The editor uses CodeMirror's official legacy Octave grammar, which covers the shared MATLAB and GNU Octave syntax used by common scripts and functions.
Source formatting preserved
Indentation, line breaks, matrix literals, function signatures, percent comments, section markers, and continuation lines remain in the order supplied.
Normal pages and selectable text
Long .m files continue across A4 or Letter pages. The result remains selectable and searchable rather than being flattened into an image.
Source PDF, not MATLAB output
The converter does not start MATLAB or Octave, load toolboxes, open MAT-files, execute commands, inspect a workspace, or generate plot output. Use MATLAB Publish or Live Editor Export when the PDF must include calculated results or figures.
Common questions
MATLAB to PDF FAQ
How do I convert or save a MATLAB .m file as PDF?
Click Open file and choose a local .m source file, or paste MATLAB code into the editor. Adjust the document options, inspect the exact page preview, and download the PDF. You can save or print the downloaded document normally, and the source file is read locally in your browser.
Does the PDF preserve MATLAB matrices and comments?
Yes. Matrix literals, operators, function definitions, indentation, percent comments, section markers, and original line breaks are preserved as selectable source text.
Does this converter execute MATLAB code?
No. MATLAB code is treated only as source text. The converter does not run scripts, load toolboxes, inspect variables, calculate results, or include command-window output.
Will plotting commands create charts in the PDF?
No. Calls such as plot, tiledlayout, imshow, and surf appear as highlighted source code. The tool does not execute them or embed the figures they would generate.
Can I convert a MATLAB Live Script .mlx file?
Not directly. An .mlx file is a packaged Live Script rather than plain MATLAB source. To preserve its formatted text, output, and figures, open it in MATLAB's Live Editor and use Export to PDF. To create a source-code-only PDF with KissPDF, save or copy the code into a plain .m file first.
Is this the same as MATLAB Publish or Live Editor Export?
No. MATLAB Publish and Live Editor Export can execute or interpret project content and include results or figures. KissPDF creates a readable, syntax-highlighted PDF of the source code itself without requiring MATLAB.
Why does the editor use an Octave grammar?
CodeMirror provides an official legacy Octave mode, and MATLAB and GNU Octave share most everyday syntax. It gives reliable highlighting for common .m scripts and functions, though a MATLAB-only construct may receive less detailed coloring.
Can I remove the document title or line numbers?
Yes. The title, line numbers, and page numbers are separate settings, and the exact PDF preview updates before download.
Is my MATLAB source uploaded to a server?
The source file and generated PDF are processed in this browser. The code is not sent to a document-conversion API, although normal website and CDN requests can still occur.