Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Fri Apr 24, 2015 4:39 pm

Hi,
I'm evaluating the trial version of Spire.Doc (5.3.46.3020).
I want to batch convert all doc files in a folder to pdf.

code :
Dim di As New IO.DirectoryInfo("c:\doc\subst\")
Dim diar1 As IO.FileInfo() = di.GetFiles("*.doc")
Dim dra As IO.FileInfo

'list the names of all files in the specified directory
Dim doc As New Document()

For Each dra In diar1
doc = New Document()
doc.LoadFromFile(dra.FullName, FileFormat.Doc)
doc.SaveToFile("c:\doc\subst\pdf\" + Mid(dra.Name, 1, InStr(dra.Name, ".") - 1) + ".PDF", FileFormat.PDF)
doc.Close()
Next
The problem I have is that some doc files don't work the the SaveToFile crashes or hangs. I attached one of these files.
Do you have special requirement of doc document ?
I tried with .Net2.0 & .NET3.5 (5.3.46.3035) DLLs.

I also tested version 5.3.83.3035
Here I get these errors in doc QMManualEntry_01_00000101.doc:

1.
System.NotSupportedException was unhandled
Message="Das angegebene Pfadformat wird nicht unterstützt."
Source="mscorlib"
StackTrace:
bei System.Security.Util.StringExpressionSet.CanonicalizePath(String path, Boolean needFullPath)
bei System.Security.Util.StringExpressionSet.CreateListFromExpressions(String[] str, Boolean needFullPath)
bei System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionAccess access, AccessControlActions control, String[] pathListOrig, Boolean checkForDuplicates, Boolean needFullPath, Boolean copyPathList)
bei System.Security.Permissions.FileIOPermission..ctor(FileIOPermissionAccess access, String[] pathList, Boolean checkForDuplicates, Boolean needFullPath)
bei System.IO.Path.GetFullPath(String path)
bei Spire.Pdf.PdfDocumentBase.Save(String filename)
bei Spire.Doc.Document.ᜂ(String A_0)
bei Spire.Doc.Document.SaveToFile(String fileName, FileFormat fileFormat)
bei ToPDF.Form1.button1_Click(Object sender, EventArgs e) in C:\VBAA_NET\Doc2PDF\Form1.vb:Zeile 44.
bei System.Windows.Forms.Control.OnClick(EventArgs e)
bei System.Windows.Forms.Button.OnClick(EventArgs e)
bei System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
bei System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
bei System.Windows.Forms.Control.WndProc(Message& m)
bei System.Windows.Forms.ButtonBase.WndProc(Message& m)
bei System.Windows.Forms.Button.WndProc(Message& m)
bei System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
bei System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
bei System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
bei System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
bei System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
bei System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
bei System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
bei System.Windows.Forms.Application.Run(Form mainForm)
bei ToPDF.Program.Main() in C:\VBAA_NET\Doc2PDF\Program.vb:Zeile 12.
bei System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
bei System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
bei Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
bei System.Threading.ThreadHelper.ThreadStart_Context(Object state)
bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
bei System.Threading.ThreadHelper.ThreadStart()
InnerException:

2.
System.ArgumentException was unhandled
Message="Die Breite oder Höhe des Rechtecks {X=0,Y=0,Width=0,Height=0} kann nicht 0 (null) sein."
Source="System.Drawing"
StackTrace:
bei System.Drawing.Bitmap.Clone(RectangleF rect, PixelFormat format)
bei spr₮.ᜀ(DocPicture A_0)
bei spr₮.ᜀ(DocPicture A_0, sprᵛ A_1, Boolean A_2)
bei spr₮.ᜁ(DocPicture A_0, sprᵛ A_1, Boolean A_2)
bei Spire.Doc.Fields.DocOleObject.Spire.Doc.Layout.IDocumentBase.Draw(spr₮ dc, sprᵛ ltWidget)
bei sprᵛ.ᜀ(spr₮ A_0)
bei sprᵛ.ᜀ(spr₮ A_0)
bei sprᵛ.ᜀ(spr₮ A_0)
bei sprᵛ.ᜀ(spr₮ A_0)
bei sprᵛ.ᜀ(spr₮ A_0)
bei sprᵛ.ᜀ(spr₮ A_0)
bei sprᵛ.ᜀ(spr₮ A_0)
bei sprᵛ.ᜀ(spr₮ A_0)
bei sprᵛ.ᜀ(spr₮ A_0)
bei sprᠦ.ᜀ(spr₮ A_0)
bei sprᲛ.ᜀ(Int32 A_0, Int32 A_1, ImageType A_2, MemoryStream A_3, Boolean A_4, Boolean A_5, Boolean A_6)
bei spr᧥.ᜀ(sprᲛ A_0)
bei spr᧥.ᜀ(Document A_0)
bei Spire.Doc.Document.ᜂ(String A_0)
bei Spire.Doc.Document.SaveToFile(String fileName, FileFormat fileFormat)
bei ToPDF.Form1.button1_Click(Object sender, EventArgs e) in C:\VBAA_NET\Doc2PDF\Form1.vb:Zeile 38.
bei System.Windows.Forms.Control.OnClick(EventArgs e)
bei System.Windows.Forms.Button.OnClick(EventArgs e)
bei System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
bei System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
bei System.Windows.Forms.Control.WndProc(Message& m)
bei System.Windows.Forms.ButtonBase.WndProc(Message& m)
bei System.Windows.Forms.Button.WndProc(Message& m)
bei System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
bei System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
bei System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
bei System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
bei System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
bei System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
bei System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
bei System.Windows.Forms.Application.Run(Form mainForm)
bei ToPDF.Program.Main() in C:\VBAA_NET\Doc2PDF\Program.vb:Zeile 12.
bei System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
bei System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
bei Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
bei System.Threading.ThreadHelper.ThreadStart_Context(Object state)
bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
bei System.Threading.ThreadHelper.ThreadStart()
InnerException:

mklueppel
 
Posts: 6
Joined: Thu Apr 23, 2015 5:03 pm

Mon Apr 27, 2015 7:13 am

Hello,

Thanks for your inquiry.
Sorry that I failed to reproduce your issue with Spire.Doc (V5.3.83) and the code you provide. Did you try to only convert the doc(QMManualEntry_01_00000101.doc) to pdf, and the issue still happen?

Best Regards,
Betsy
E-iceblue support team
User avatar

Betsy
 
Posts: 802
Joined: Mon Jan 19, 2015 6:14 am

Mon Apr 27, 2015 4:47 pm

Yes, I tried to convert only that one file.
Try the attached QMManualEntry_01_00000093.doc. I just won't work.
I attached a new file and the error message, it's in German so I translated it : "the width for height of a square {X=0,Y=0,Width=0,Height=0} can't be 0 (null)."

Can you check for this error please ? I'm really time constrained to find a component that works with our documents.

Also, do you have example code for the following requirements?
1. Convert all word documents in a folder to pdf and then merge these pdfs to one big pdf.
2. create a 100x100 thumbnail jpg from the first page of a pdf.

Thanks for assisting me evaluating your components

mklueppel
 
Posts: 6
Joined: Thu Apr 23, 2015 5:03 pm

Mon Apr 27, 2015 7:17 pm

just tested 5.4 and the : "the width for height of a square {X=0,Y=0,Width=0,Height=0} can't be 0 (null)." - error still comes

mklueppel
 
Posts: 6
Joined: Thu Apr 23, 2015 5:03 pm

Tue Apr 28, 2015 9:58 am

Hello,

Thanks for your response.
I have reproduced the issue of the document(QMManualEntry_01_00000093.doc), and posted it to our dev team. Once there is any process, we will let you know.
1. Convert all word documents in a folder to pdf and then merge these pdfs to one big pdf.
please refer the following code:
Code: Select all
 Dim di As New System.IO.DirectoryInfo("F:\doc")
        Dim diar1 As System.IO.FileInfo() = di.GetFiles("*.doc")
        Dim dra As System.IO.FileInfo
        'list the names of all files in the specified directory
        Dim doc As New Document()

        For Each dra In diar1
            doc = New Document()
            doc.LoadFromFile(dra.FullName, Spire.Doc.FileFormat.Doc)
            doc.SaveToFile("F:\doc\" + Mid(dra.Name, 1, InStr(dra.Name, ".") - 1) + ".PDF", Spire.Doc.FileFormat.PDF)
            doc.Close()
        Next

        Dim sourceDirectory As String = "F:\doc"
        Dim files As String() = Directory.GetFiles(sourceDirectory, "*.pdf")
        Dim document As PdfDocumentBase = PdfDocument.MergeFiles(files)
        document.Save("result.pdf")

2. create a 100x100 thumbnail jpg from the first page of a pdf.
You can use the pdf.SaveAsImage() method.

Best Regards,
Betsy
E-iceblue support team
User avatar

Betsy
 
Posts: 802
Joined: Mon Jan 19, 2015 6:14 am

Tue Apr 28, 2015 6:34 pm

thank you very much. I hope your DEV team can resolve that problem.

mklueppel
 
Posts: 6
Joined: Thu Apr 23, 2015 5:03 pm

Tue May 05, 2015 2:08 pm

Do you have any news on this matter?

mklueppel
 
Posts: 6
Joined: Thu Apr 23, 2015 5:03 pm

Wed May 06, 2015 1:32 am

Hello,

Sorry for long silence.
I got the information from our dev team that the issue has been resolved and it is waiting for testing. We will inform you when the new version has been released.

Best Regards,
Betsy
E-iceblue support team
User avatar

Betsy
 
Posts: 802
Joined: Mon Jan 19, 2015 6:14 am

Wed May 13, 2015 6:07 am

Hello,

Now, the version( Spire.Doc Pack Version:5.4.15 ) has been released, please download it from the following link and have a try:
http://www.e-iceblue.com/Download/downl ... t-now.html

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy
 
Posts: 802
Joined: Mon Jan 19, 2015 6:14 am

Thu May 14, 2015 7:55 am

Hello,

Have you tried the newest hotfix? Has your issue been resolved?

Thanks,
Betsy
E-iceblue support team
User avatar

Betsy
 
Posts: 802
Joined: Mon Jan 19, 2015 6:14 am

Fri May 15, 2015 2:01 pm

Hi,
we're getting somewhere :-)
Now 223 of 224 are successfully converted and the new merging method is working properly too.
Though one word document is still failing. It just times out during the save process of conversion from doc to pdf.
I attached it. Maybe the document is too large ? Are there any restriction for file size ?
If you can get this problem fixed also I think I can make a good case to my boss for buying your software :-)

Best,
Michael

mklueppel
 
Posts: 6
Joined: Thu Apr 23, 2015 5:03 pm

Mon May 18, 2015 2:14 am

Hello,

Thanks for your feedback.
There is no restriction for file size. I have reproduced the issue, and posted it to our dev team. We will inform you when it is fixed.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy
 
Posts: 802
Joined: Mon Jan 19, 2015 6:14 am

Fri May 29, 2015 9:17 am

Hello,

Sorry for keep you waiting.
Now the issue has been resolved, and the newest hotfix of Spire.Doc has been released.Please download the Spire.Doc Pack(hot fix) Version:5.4.25 from the following link and have a try:
http://www.e-iceblue.com/Download/downl ... t-now.html

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy
 
Posts: 802
Joined: Mon Jan 19, 2015 6:14 am

Return to Spire.Doc

cron