Word 转成pdf及打印的开源方案支持xp

news2025/1/11 11:32:29

Word转成pdf、打印的方案几乎没有免费开源的方案,现在提供一个通过LibreOffice实现的方案

操作依赖LibreOffice需要安装,点此下载老版本

5.4.7.2是最后一个支持xp的 版本如需xp要请安装此版本

LibreOffice官方介绍

LibreOffice 是一款开放源代码的自由免费全能办公软件,可运行于 Microsoft Windows, GNU/Linux 以及 macOS 等操作系统上。它包含了 Writer, Calc, Impress, Draw, Math 以及 Base 等组件,可分别用于文本文档、电子表格、幻灯片演示文稿、绘图文档、数学公式编辑、数据库管理等工作。

LibreOffice 采用对企业和个人用户均免费的 MPL 2.0 授权协议。您可以自由分发该软件,无需支付授权费用(但您仍然可以付费获得经认证的专业支持)。它的源代码完全公开,任何人都可以参与软件的开发和维护。

一、通过进程的方式

1.Word打印

  public void PrintWordFile(string file, string printerName)
        {
            if (string.IsNullOrEmpty(file)) throw new Exception("Invalid parameters passed to convert word function.");

            if (!File.Exists(file)) throw new FileNotFoundException($"The file passed to the convert word process ({file}) could not be found.");

            var fileInfo = new FileInfo(file);

            if (fileInfo.Extension.ToLower() != ".doc" && fileInfo.Extension.ToLower() != ".docx")
                throw new ArgumentOutOfRangeException($"The file type passed to the convert word process is an invalid type ({fileInfo.Extension}).");

            var libreOfficePath = Path.Combine(LibreOfficePath, "swriter.exe");

            if (!File.Exists(libreOfficePath)) throw new FileNotFoundException("It seems that LibreOffice is not where it should be, please ensure the path exists.");

            var procStartInfo = new ProcessStartInfo(libreOfficePath, $@"--headless --pt ""{printerName}"" ""{file}""")
            {
                RedirectStandardOutput = true,
                RedirectStandardError = true,
                UseShellExecute = false,
                CreateNoWindow = true,
                WorkingDirectory = Environment.CurrentDirectory
            };

            Process process = new Process() { StartInfo = procStartInfo };

            // Attach event handlers to capture output and error streams
            process.OutputDataReceived += (sender, args) => Console.WriteLine("OUT: " + args.Data);
            process.ErrorDataReceived += (sender, args) => Console.WriteLine("ERR: " + args.Data);

            process.Start();

            // Start reading the output asynchronously
            process.BeginOutputReadLine();
            process.BeginErrorReadLine();

            process.WaitForExit();

            if (process.ExitCode != 0)
            {
                throw new LibreOfficeFailedException(process.ExitCode);
            }
        }

2.Word转成PDF

  public string ConvertWordFile(string file, string outputDirectory)
        {
            if (string.IsNullOrEmpty(file) || string.IsNullOrEmpty(outputDirectory)) throw new Exception("Invalid parameters passed to convert word function.");

            if (!File.Exists(file)) throw new FileNotFoundException($"The file passed to the convert word process ({file}) could not be found.");

            if (!Directory.Exists(outputDirectory)) throw new DirectoryNotFoundException($"The output folder passed to the convert word process ({outputDirectory}) does not exist.");

            if (outputDirectory.EndsWith(@"\")) outputDirectory = outputDirectory.TrimEnd('\\');

            var fileInfo = new FileInfo(file);

            if (fileInfo.Extension.ToLower() == ".doc" && fileInfo.Extension.ToLower() == ".docx") throw new ArgumentOutOfRangeException($"The file type passed to the convert word process is an invalid type ({fileInfo.Extension}).");

            var outputFile = outputDirectory + @"\" + Path.GetFileNameWithoutExtension(fileInfo.Name) + ".pdf";

            if (File.Exists(outputFile)) File.Delete(outputFile);

            var libreOfficePath = Path.Combine(LibreOfficePath, "swriter.exe");

            if (!File.Exists(libreOfficePath)) throw new FileNotFoundException("It seems that LibreOffice is not where it should be, please ensure the path exists.");
            var procStartInfo = new ProcessStartInfo(libreOfficePath, $@"--headless --convert-to pdf:writer_pdf_Export ""{file}"" --outdir ""{outputDirectory}""")
            {
                RedirectStandardOutput = true,
                UseShellExecute = false,
                CreateNoWindow = true,
                WorkingDirectory = Environment.CurrentDirectory
            };

            Process process = new Process() { StartInfo = procStartInfo };

            process.Start();

            process.WaitForExit();

            if (process.ExitCode != 0)
                throw new LibreOfficeFailedException(process.ExitCode);

            if (!File.Exists(outputFile)) throw new FileNotFoundException("The convert to word process has failed to convert the file!");

            return outputFile;
        }

 public class LibreOfficeFailedException : Exception
    {
        public LibreOfficeFailedException(int exitCode) : base($"LibreOffice has failed with {exitCode}") { }
    }

二、通过cli库调用,下附代码

CLI下载

   public class WordPrint
    {
        private XComponentContext context;
        private XMultiServiceFactory service;
        private XComponentLoader component;
        private XComponent doc;
        private static WordPrint wordPrint;
        private List<string> filters = new List<string>();
        #region Constructors
        
        WordPrint()
        {
            NativeMethods.InitializationLibrary();
            /// This will start a new instance of OpenOffice.org if it is not running, 
            /// or it will obtain an existing instance if it is already open.
            context = uno.util.Bootstrap.bootstrap();

            /// The next step is to create a new OpenOffice.org service manager
            service = (XMultiServiceFactory)context.getServiceManager();

            /// Create a new Desktop instance using our service manager
            component = (XComponentLoader)service.createInstance("com.sun.star.frame.Desktop");

            // Getting filters
            XNameContainer filters = (XNameContainer)service.createInstance("com.sun.star.document.FilterFactory");
            foreach (string filter in filters.getElementNames())
                this.filters.Add(filter);
        }

        ~MiniWordPrint()
        {
            if (doc != null)
                doc.dispose();
            doc = null;
        }
        #endregion

        #region Private methods
        private string FilterToString(ExportFilter filter)
        {
            switch (filter)
            {
                case ExportFilter.Word97: return "MS Word 97";
                case ExportFilter.WriterPDF: return "writer_pdf_Export";
                case ExportFilter.CalcPDF: return "calc_pdf_Export";
                case ExportFilter.DrawPDF: return "draw_pdf_Export";
                case ExportFilter.ImpressPDF: return "impress_pdf_Export";
                case ExportFilter.MathPDF: return "math_pdf_Export";
            }
            return "";
        }
        #endregion

        #region Public methods
        /// <summary>
        /// load docx
        /// </summary>
        /// <param name="filename">file path</param>
        /// <param name="hidden">load document invisible Defines if the loaded component is made visible. If this property is not specified, the component is made visible by default.</param>
        /// <returns></returns>
        public bool Load(string filename, bool hidden)
        {
            return Load(filename, hidden, "", "");
        }

        /// <summary>
        /// load docx
        /// </summary>
        /// <param name="filename">file path</param>
        /// <param name="hidden">load document invisible Defines if the loaded component is made visible. If this property is not specified, the component is made visible by default. </param>
        /// <param name="filter_index">internal filter name <see cref="Filters"/> Filters index
        /// Name of a filter that should be used for loading or storing the component.Names must match the names of the TypeDetection configuration, invalid names are ignored.If a name is specified on loading, it still will be verified by a filter detection, but in case of doubt it will be preferred.</param>
        /// <param name="filter_options">additional properties for filter
        /// Some filters need additional parameters; use only together with property MediaDescriptor::FilterName.Details must be documented by the filter. This is an old format for some filters. If a string is not enough, filters can use the property MediaDescriptor::FilterData.</param>
        /// <returns></returns>
        public bool Load(string filename, bool hidden, int filter_index, string filter_options)
        {
            return Load(filename, hidden, filters[filter_index], filter_options);
        }

        /// <summary>
        /// load docx
        /// </summary>
        /// <param name="filename">file path</param>
        /// <param name="hidden">load document invisible Defines if the loaded component is made visible. If this property is not specified, the component is made visible by default.</param>
        /// <param name="filter_name">internal filter name <see cref="Filters"/>
        /// Name of a filter that should be used for loading or storing the component.Names must match the names of the TypeDetection configuration, invalid names are ignored.If a name is specified on loading, it still will be verified by a filter detection, but in case of doubt it will be preferred.</param>
        /// <param name="filter_options"> additional properties for filter
        /// Some filters need additional parameters; use only together with property MediaDescriptor::FilterName.Details must be documented by the filter. This is an old format for some filters. If a string is not enough, filters can use the property MediaDescriptor::FilterData.</param>
        /// <returns></returns>
        public bool Load(string filename, bool hidden, string filter_name, string filter_options)
        {
            List<PropertyValue> pv = new List<PropertyValue>();
            pv.Add(new PropertyValue("Hidden", 0, new uno.Any(hidden), PropertyState.DIRECT_VALUE));
            if (filter_name != "")
            {
                pv.Add(new PropertyValue("FilterName", 0, new uno.Any(filter_name), PropertyState.DIRECT_VALUE));
                pv.Add(new PropertyValue("FilterOptions", 0, new uno.Any(filter_options), PropertyState.DIRECT_VALUE));
            }
            try
            {
                doc = component.loadComponentFromURL(
                "file:///" + filename.Replace('\\', '/'), "_blank",
                    0, pv.ToArray());
                return true;
            }
            catch
            {
                doc = null;
                return false;
            }
        }
        /// <summary>
        ///  a given document xDoc to print to the standard printer without any settings
        /// </summary>
        /// <returns></returns>
        public bool Print()
        {
            return Print("", 1, "");
        }
        /// <summary>
        /// a given document xDoc to print 
        /// </summary>
        /// <param name="printName">string - Specifies the name of the printer queue to be used.</param>
        /// <param name="copies">short - Specifies the number of copies to print.</param>
        /// <param name="pages">string - Specifies the pages to print in the same format as in the print dialog of the GUI (e.g. "1, 3, 4-7, 9-")</param>
        /// <param name="orientation">com.sun.star.view.PaperOrientation. Specifies the orientation of the paper.</param>
        /// <param name="paperFormat">com.sun.star.view.PaperFormat. Specifies a predefined paper size or if the paper size is a user-defined size.</param>
        /// <returns></returns>
        public bool Print(string printName, int copies, string pages, MiniOrientation orientation = MiniOrientation.PORTRAIT, MiniFormat paperFormat = MiniFormat.A4)
        {
            var printerDesc = new List<PropertyValue>();
            if (!string.IsNullOrEmpty(printName))
                printerDesc.Add(new PropertyValue("Name", 0, new uno.Any(typeof(string), printName), PropertyState.DIRECT_VALUE));
            printerDesc.Add(new PropertyValue("PaperOrientation", 0, new uno.Any(typeof(PaperOrientation), orientation), PropertyState.DIRECT_VALUE));
            printerDesc.Add(new PropertyValue("PaperFormat", 0, new uno.Any(typeof(PaperFormat), paperFormat), PropertyState.DIRECT_VALUE));

            var printOpts = new List<PropertyValue>();
            printOpts.Add(new PropertyValue("CopyCount", 0, new uno.Any(copies), PropertyState.DIRECT_VALUE));
            if (!string.IsNullOrEmpty(pages))
                printOpts.Add(new PropertyValue("Pages", 0, new uno.Any(pages), PropertyState.DIRECT_VALUE));
            printOpts.Add(new PropertyValue("Wait", 0, new uno.Any(true), PropertyState.DIRECT_VALUE));
            //if (doc is XPrintable)
            try
            {
                ((XPrintable)doc).setPrinter(printerDesc.ToArray());
                ((XPrintable)doc).print(printOpts.ToArray());
                return true;
            }
            catch { return false; }
        }
        /// <summary>
        /// a given document xDoc to print with custom
        /// </summary>
        /// <param name="printerDesc">
        ///----------- Properties of com.sun.star.view.PrinterDescriptor--------
        ///*** Name string - Specifies the name of the printer queue to be used.
        ///*** PaperOrientation com.sun.star.view.PaperOrientation.Specifies the orientation of the paper.
        ///*** PaperFormat com.sun.star.view.PaperFormat.Specifies a predefined paper size or if the paper size is a user-defined size.
        ///*** PaperSize com.sun.star.awt.Size.Specifies the size of the paper in 1/100 mm.
        ///*** IsBusy boolean - Indicates if the printer is busy.
        ///*** CanSetPaperOrientation boolean - Indicates if the printer allows changes to.PaperOrientation
        ///*** CanSetPaperFormat boolean - Indicates if the printer allows changes to.PaperFormat
        ///*** CanSetPaperSize boolean - Indicates if the printer allows changes to.PaperSize
        /// </param>
        /// <param name="printerDesc">
        ///------------- Properties of com.sun.star.view.PrintOptions--------
        ///CopyCount short - Specifies the number of copies to print.
        ///FileName string - Specifies the name of a file to print to, if set.
        ///Collate boolean - Advises the printer to collate the pages of the copies.If true, a whole document is printed prior to the next copy, otherwise the page copies are completed together.
        ///Pages string - Specifies the pages to print in the same format as in the print dialog of the GUI (e.g. "1, 3, 4-7, 9-")
        ///Wait boolean - Advises that the print job should be performed synchronously, i.e.wait until printing is complete before returning from printing.Otherwise return is immediate and following actions(e.g.closing the corresponding model) may fail until printing is complete.Default is false.
        /// </param>
        /// <param name="pagePrintSettings">
        /// ------------- Properties of com.sun.star.text.PagePrintSettings--------
        /// PageRows short - Number of rows in which document pages should appear on the output page.
        /// PageColumns short - Number of columns in which document pages should appear on the output page.
        /// LeftMargin long - Left margin on the output page.
        /// RightMargin long - Right margin on the output page.
        /// TopMargin long - Top margin on the output page.
        /// BottomMargin long - Bottom margin on the output page.
        /// HoriMargin long - Margin between the columns on the output page.
        /// VertMargin long - Margin between the rows on the output page.
        /// IsLandscape boolean - Determines if the output page is in landscape format.
        /// </param>
        /// <returns></returns>
        public bool Print(List<MiniPropertyValue> printerDesc, List<MiniPropertyValue> printOpts, List<MiniPropertyValue> pagePrintSettings)
        {
            try
            {
                var printSettings = pagePrintSettings.ConvertAll(v => ToPropertyValue(v));
                var desc = printerDesc.ConvertAll(v => ToPropertyValue(v));
                var opts = printOpts.ConvertAll(v => ToPropertyValue(v));
                ((XPagePrintable)doc).setPagePrintSettings(printSettings.ToArray());
                ((XPrintable)doc).setPrinter(desc.ToArray());
                ((XPrintable)doc).print(opts.ToArray());
                return true;
            }
            catch { return false; }
        }
        /// <summary>
        /// save pdf
        /// </summary>
        /// <param name="filename">file path</param>
        /// <param name="filter"><see cref="ExportFilter"/></param>
        /// <returns></returns>
        public bool Save(string filename, ExportFilter filter)
        {
            return Save(filename, FilterToString(filter));
        }
        /// <summary>
        /// save pdf
        /// </summary>
        /// <param name="filename">file path</param>
        /// <param name="filter">
        /// internal filter name <see cref="Filters"/>
        /// Name of a filter that should be used for loading or storing the component.Names must match the names of the TypeDetection configuration, invalid names are ignored.If a name is specified on loading, it still will be verified by a filter detection, but in case of doubt it will be preferred.
        /// </param>
        /// <returns></returns>
        public bool Save(string filename, string filter)
        {
            List<PropertyValue> pv = new List<PropertyValue>();
            pv.Add(new PropertyValue("FilterName", 0, new uno.Any(filter), PropertyState.DIRECT_VALUE));
            pv.Add(new PropertyValue("Overwrite", 0, new uno.Any(true), PropertyState.DIRECT_VALUE));
            try
            {
                filename = filename.Replace("\\", "/");
                ((XStorable)doc).storeToURL("file:///" + filename, pv.ToArray());
                return true;
            }
            catch { return false; }
        }
        /// <summary>
        /// export pdf
        /// </summary>
        /// <param name="filename">file path</param>
        /// <returns></returns>
        public bool ExportToPdf(string filename)
        {
            filename = Path.ChangeExtension(filename, ".pdf");
            bool ret = Save(filename, "writer_pdf_Export");
            if (!ret) ret = Save(filename, "impress_pdf_Export");
            if (!ret) ret = Save(filename, "calc_pdf_Export");
            if (!ret) ret = Save(filename, "draw_pdf_Export");
            if (!ret) ret = Save(filename, "impress_pdf_Export");
            if (!ret) ret = Save(filename, "math_pdf_Export");
            return ret;
        }
        /// <summary>
        /// close XComponent 
        /// doc stream must be not use,otherwise dispose() has no return
        /// </summary>
        public void Close()
        {
            doc.dispose();
            doc = null;
        }
        /// <summary>
        ///  new docx
        /// </summary>
        /// <param name="app"><see cref="AppType"/></param>
        /// <param name="hidden">load document invisible Defines if the loaded component is made visible. If this property is not specified, the component is made visible by default.</param>
        /// <returns></returns>
        public bool New(AppType app, bool hidden)
        {
            try
            {
                string sapp = "private:factory/";
                switch (app)
                {
                    case AppType.Writer:
                        sapp += "swriter";
                        break;
                    case AppType.Calc:
                        sapp += "scalc";
                        break;
                    case AppType.Impress:
                        sapp += "simpress";
                        break;
                    case AppType.Draw:
                        sapp += "sdraw";
                        break;
                    case AppType.Math:
                        sapp += "smath";
                        break;
                }
                PropertyValue pv = new PropertyValue("Hidden", 0, new uno.Any(hidden), PropertyState.DIRECT_VALUE);
                doc = component.loadComponentFromURL(sapp, "_blank", 0, new PropertyValue[1] { pv });
                return true;
            }
            catch
            {
                doc = null;
                return false;
            }
        }
        #endregion

        #region Properties
        /// <summary>
        /// internal filter name
        /// Name of a filter that should be used for loading or storing the component.Names must match the names of the TypeDetection configuration, invalid names are ignored.If a name is specified on loading, it still will be verified by a filter detection, but in case of doubt it will be preferred.
        /// </summary>
        public List<string> Filters
        {
            get { return filters; }
        }
        #endregion

        private PropertyValue ToPropertyValue(MiniPropertyValue miniProperty)
        {
            return new PropertyValue(
                Name: miniProperty.Name,
                Handle: miniProperty.Handle,
                Value: new uno.Any(
                    type: miniProperty.Value.Type,
                    value: miniProperty.Value.Value),
                State: (PropertyState)miniProperty.State);
        }
    }

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2274880.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

网络-ping包分析

-a&#xff1a;使 ping 在收到响应时发出声音&#xff08;适用于某些操作系统&#xff09;。-b&#xff1a;允许向广播地址发送 ping。-c count&#xff1a;指定发送的 ping 请求的数量。例如&#xff0c;ping -c 5 google.com 只发送 5 个请求。-i interval&#xff1a;指定两…

国产linux系统(银河麒麟,统信uos)使用 PageOffice 实现后台生成单个PDF文档

PageOffice 国产版 &#xff1a;支持信创系统&#xff0c;支持银河麒麟V10和统信UOS&#xff0c;支持X86&#xff08;intel、兆芯、海光等&#xff09;、ARM&#xff08;飞腾、鲲鹏、麒麟等&#xff09;、龙芯&#xff08;LoogArch&#xff09;芯片架构。 PageOffice 版本&…

Win10微调大语言模型ChatGLM2-6B

在《Win10本地部署大语言模型ChatGLM2-6B-CSDN博客》基础上进行&#xff0c;官方文档在这里&#xff0c;参考了这篇文章 首先确保ChatGLM2-6B下的有ptuning AdvertiseGen下载地址1&#xff0c;地址2&#xff0c;文件中数据留几行 模型文件下载地址 &#xff08;注意&#xff1…

Windows11环境下设置MySQL8字符集utf8mb4_unicode_ci

1.关闭MySQL8的服务CTRLshiftESC&#xff0c;找到MySQL关闭服务即可 2.找到配置文件路径&#xff08;msi版本默认&#xff09; C:\ProgramData\MySQL\MySQL Server 8.0 3.使用管理员权限编辑my.ini文件并保存 # Other default tuning values # MySQL Server Instance Config…

js代理模式

允许在不改变原始对象的情况下&#xff0c;通过代理对象来访问原始对象。代理对象可以在访问原始对象之前或之后&#xff0c;添加一些额外的逻辑或功能。 科学上网过程 一般情况下,在访问国外的网站,会显示无法访问 因为在dns解析过程,这些ip被禁止解析,所以显示无法访问 引…

vue3 + ts + element-plus(el-upload + vuedraggable实现上传OSS并排序)

这里创建项目就不多说了 安装element-plus npm install element-plus 安装vuedraggable npm install vuedraggable 安装ali-oss npm install ali-oss 这里是封装一下&#xff1a;在components创建文件夹jc-upload>jc-upload.vue 在封装的过程中遇到了一个问题就是dr…

理解Unity脚本编译过程:程序集

https://docs.unity3d.com/Manual/script-compilation.html 关于Unity C#脚本编译的细节&#xff0c;其中一个比较重要的知识点就是如何自定义Assembly。 预定义的assembly 默认情况下&#xff0c;Unity会按照这个规则进行编译。 PhaseAssembly nameScript files1Assembly-…

设计模式 行为型 责任链模式(Chain of Responsibility Pattern)与 常见技术框架应用 解析

责任链模式&#xff08;Chain of Responsibility Pattern&#xff09;是一种行为型设计模式&#xff0c;它允许将请求沿着处理者链进行发送。每个处理者对象都有机会处理该请求&#xff0c;直到某个处理者决定处理该请求为止。这种模式的主要目的是避免请求的发送者和接收者之间…

VS2022如何修改我们新建工程打开新建文件中,默认输入我们的main函数和宏定义

1.右击我们的VS环境&#xff0c;选择【打开文件位置】 2. 进入C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE 目录 进入【VC】文件夹 进入【VCProjectItems】文件夹 3. 修改newcfile.cpp文件 右击选择【打开方式】选择【记事本】 添加如下内容 #defi…

2025-1-10-sklearn学习(36、37) 数据集转换-无监督降维+随机投影 沙上并禽池上暝。云破月来花弄影。

文章目录 sklearn学习(36、37) 数据集转换-无监督降维随机投影sklearn学习(36) 数据集转换-无监督降维36.1 PCA: 主成份分析36.2 随机投影36.3 特征聚集 sklearn学习(37) 数据集转换-随机投影37.1 Johnson-Lindenstrauss 辅助定理37.2 高斯随机投影37.3 稀疏随机矩阵 sklearn学…

openssl编译

关于windows下&#xff0c;openssl编译 环境准备 安装 perl:https://djvniu.jb51.net/200906/tools/ActivePerl5_64.rar安装nasm&#xff1a;https://www.nasm.us/pub/nasm/releasebuilds/2.13.01/win64/nasm-2.13.01-installer-x64.exe下载opensll源码&#xff1a;https://o…

2025-1-9 QT 使用 QXlsx库 读取 .xlsx 文件 —— 导入 QXlsx库以及读取 .xlsx 的源码 实践出真知,你我共勉

文章目录 1. 导入QXlsx库2. 使用 QXlsx库 读取 .xlsx 文件小结 网上有很多教程&#xff0c;但太费劲了&#xff0c;这里有个非常简便的好方法&#xff0c;分享给大家。 1. 导入QXlsx库 转载链接 &#xff1a;https://github.com/QtExcel/QXlsx/blob/master/HowToSetProject.md…

先辑芯片HPM5300系列之SEI多摩川协议命令表问题研究

多摩川协议有9条命令&#xff0c;但是先辑SEI的命令表只有8张。0-6是可用的&#xff0c;第7张是黑洞表&#xff0c;所以只有7张可用。 命令表的限制颇多&#xff0c;比如命令表只能按顺序使用 &#xff1a;例如0、1、3&#xff0c;那么命令表3是不能用的。 如果想要实现9个命令…

kotlin项目无法访问Java类的问题

使用IntelliJ创建一个Kotlin项目&#xff0c;然后在src/main/kotlin中创建一个java接口&#xff1a;Animal.java&#xff0c;然后在Main.kt中打印这个java接口&#xff0c;如下&#xff1a; fun main() {println(Animal::class.java) }代码在编辑器中并没有报错&#xff0c;但…

全栈面试(一)Basic/微服务

文章目录 项目地址一、Basic InterviewQuestions1. tell me about yourself?2. tell me about a time when you had to solve a complex code problem?3. tell me a situation that you persuade someone at work?4. tell me a about a confict with a teammate and how you…

医疗可视化大屏 UI 设计新风向

智能化交互 借助人工智能与机器学习技术&#xff0c;实现更智能的交互功能。如通过语音指令或手势控制来操作大屏&#xff0c;医护人员无需手动输入&#xff0c;可更便捷地获取和处理信息。同时&#xff0c;系统能根据用户的操作习惯和数据分析&#xff0c;自动推荐相关的医疗…

Angular由一个bug说起之十三:Cross Origin

跨域 想要了解跨域&#xff0c;首要要了解源 什么是源&#xff0c;源等于协议加域名加端口号 只有这三个都相同&#xff0c;才是同源&#xff0c;反之则是非同源。 比如下面这四个里&#xff0c;只有第4个是同源 而浏览器给服务器发送请求时&#xff0c;他们的源一样&#xff0…

【LeetCode Hot100 贪心算法】 买卖股票的最佳时机、跳跃游戏、划分字母区间

贪心算法 买卖股票的最佳时机买卖股票的最佳时机II跳跃游戏跳跃游戏II划分字母区间 买卖股票的最佳时机 给定一个数组 prices &#xff0c;它的第 i 个元素 prices[i] 表示一支给定股票第 i 天的价格。 你只能选择 某一天 买入这只股票&#xff0c;并选择在 未来的某一个不同的…

MCANet: 基于多模态字幕感知的大语言模型训练无关视频异常检测

目录 摘要01 引言02 相关工作2.1 视频异常检测2.2 基于视频的大语言模型&#xff08;VLLMs&#xff09; 03 方法论3.1 问题定义3.2 MCANet3.3 图像字幕分支3.4 音频字幕分支3.5 基于LLM的异常评分3.6 视频-文本分数优化 04 实验4.1 数据集和评估指标4.2 实现细节4.3 定性结果4.…

为深度学习引入张量

为深度学习引入张量 什么是张量&#xff1f; 神经网络中的输入、输出和转换都是使用张量表示的&#xff0c;因此&#xff0c;神经网络编程大量使用张量。 张量是神经网络使用的主要数据结构。 张量的概念是其他更具体概念的数学概括。让我们看看一些张量的具体实例。 张量…