如何在vb.net中拆分pdf或docx文件 [英] how to split pdf or docx file in vb.net

查看:159
本文介绍了如何在vb.net中拆分pdf或docx文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将pdf文件拆分为多个文件,如1.pdf,vb.net 2010中的2.pdf,我的代码如下。我已经计算了pdf文档的行数和pdf文档的总字节数。现在如何分割它

i want to split pdf file into mulitple file like 1.pdf,2.pdf in vb.net 2010 my code is as under. i have counted lines of a pdf docs and total bytes of the pdf docs. now how to split it

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
       Dim infoReader As System.IO.FileInfo = _
   My.Computer.FileSystem.GetFileInfo("C:\Users\nhbg\Desktop\RamNiwas\AccessTutorial.pdf")
       Label1.Text = infoReader.Length

       Dim data() As String = IO.File.ReadAllLines("C:\Users\nhbg\Desktop\RamNiwas\AccessTutorial.pdf")
       For Each lines As String In data
           Dim splt As String() = lines.Split(" ,")


       Next

推荐答案

PDF和DOCX文件不是文本文件,使用字符串函数进行拆分。 :-)



要使用PDF,请参阅这组可以使用的PDF库: http://csharp-source.net/open-source/pdf-libraries



To使用.docx,请参阅:

https:// msdn。 microsoft.com/en-us/library/office/bb448854.aspx [ ^ ],

http://www.microsoft.com/en-us/download/details.aspx?id=30425 [ ^ ],

http://openxmldeveloper.org [ ^ ]。



开放S.来自Microsoft Open Technologies的资源: https://github.com/OfficeDev/Open-XML-SDK [ ^ ]。



现在,关于阅读Word文档: https://msdn.microsoft.com/ en-us / library / office / ff478541.aspx [ ^ ]。



此CodeProject文章也很有用:使用OpenXML和C#编辑Word文档,无需自动化/互操作 [ ^ ]。



-SA
PDF and DOCX files are not text files, to be split using string functions. :-)

To work with PDF, please see this set of referenced to PDF libraries you can use: http://csharp-source.net/open-source/pdf-libraries.

To work with .docx, please see:
https://msdn.microsoft.com/en-us/library/office/bb448854.aspx[^],
http://www.microsoft.com/en-us/download/details.aspx?id=30425[^],
http://openxmldeveloper.org[^].

Open Source from Microsoft Open Technologies: https://github.com/OfficeDev/Open-XML-SDK[^].

Now, about reading a Word document: https://msdn.microsoft.com/en-us/library/office/ff478541.aspx[^].

This CodeProject article can also be useful: Edit Word Documents using OpenXML and C# Without Automation/Interop[^].

—SA


这篇关于如何在vb.net中拆分pdf或docx文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆