I am using FreeSpire.Doc to manipulate an image in a Word document generated by a different extension.
Once I'm done with the file, I use the Gembox.Document extension to try and print the document. The printer prints out a Test page instead of the document. It seems like the document is still being reserved by Freespire.Doc even after I try to Close() and Dispose() of the file.
To confirm the problem is indeed in Freespire.Doc, I installed the Trial version of Spire.Doc to see if the same bug happens (using the exact same code) and I do not get that error. The document does print part of the image, before the "Trial version" message appears to cut off half the document. I also tried printing the Word document without doing the manipulations I'm doing with Freespire.Doc, and the file also prints just fine...
I believe this bug was fixed in a Hotfix in the standard Spire.Doc extension, referring to this ticket:
..../word-can-t-open-file-after-spiredoc-process-t7937.html
Here's a sample of my code:
- Code: Select all
//Relevant Freespire.Doc code
Spire.Doc.Document spireDoc = new Spire.Doc.Document(m_strFilePath + ".docx");
Spire.Doc.Documents.Paragraph paragraph = spireDoc.Sections[0].Paragraphs[0];
DocPicture picture = paragraph.AppendPicture(System.Drawing.Image.FromFile(m_strFilePath));
picture.Rotation = 270;
picture.TextWrappingStyle = TextWrappingStyle.Through;
picture.TextWrappingType = TextWrappingType.Both;
picture.HorizontalAlignment = ShapeHorizontalAlignment.Right;
picture.VerticalAlignment = ShapeVerticalAlignment.Bottom;
spireDoc.SaveToFile(m_strFilePath + ".docx", FileFormat.Docx);
spireDoc.Close();
spireDoc.Dispose();
//Gembox.Document to print it
m_strFilePath += ".docx";
GemBox.Document.DocumentModel document = GemBox.Document.DocumentModel.Load(m_strFilePath);
string printerName = "GeniePrinter1";
document.Print(printerName);
Is this a known bug, or am I doing something wrong?
Thank you for your assistance.