Open MS Office files WITHOUT XPS add-in?

Forum for the PDF-XChange Editor - Free and Licensed Versions

Moderators: TrackerSupp-Daniel, Tracker Support, Paul - Tracker Supp, Chris - Tracker Supp, Vasyl-Tracker Dev Team, Sean - Tracker, Tracker Supp-Stefan, Ivan - Tracker Software

Post Reply
gerundt
User
Posts: 50
Joined: Fri Nov 15, 2013 10:07 am
Location: Germany
Contact:

Open MS Office files WITHOUT XPS add-in?

Post by gerundt » Thu Jan 21, 2016 8:20 am

I test currently the new version 5.5.316.1 from the PDF-XChange Editor. One feature which reads really cool was the opening from Microsoft Office files!

I tried it on a Windows 7 pc with Office 2007 and a Windows 10 computer with Office 2013. On both computer I get an "Error [PXVLib]: Microsoft Office threw an exception" error.

The problem seems, that we disable the XPS add-in with GPO:

Code: Select all

HKEY_CURRENT_USER\Software\Policies\Microsoft\Office\12.0\Common\FixedFormat\DisablePublishToFixedFormat = 1

  • 0 = Default
  • 1 = Disable XPS
  • 2 = Disable PDF
  • 3 = Disable XPS and PDF

Since we only disable the XPS part and not the PDF part, I hope you can fix the error! Or do you use the XPS add-in?

Thanks for your help!

Greetings,
Tim Gerundt

User avatar
Tracker Supp-Stefan
Site Admin
Posts: 13080
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Open MS Office files WITHOUT XPS add-in?

Post by Tracker Supp-Stefan » Thu Jan 21, 2016 1:07 pm

Hi Tim,

Yes the Editor needs the word document converted to XPS, and then it handles that data internally to generate the PDF document (we do not rely on the Microsoft Office built in PDF generation process).

Regards,
Stefan

gerundt
User
Posts: 50
Joined: Fri Nov 15, 2013 10:07 am
Location: Germany
Contact:

Re: Open MS Office files WITHOUT XPS add-in?

Post by gerundt » Thu Jan 21, 2016 1:39 pm

Ok, but I am not sure if I will enable the XPS add-in for the users. ;)

But can you catch the exception and show a more helpful error message? Something like "XPS add-in is not loaded"?

User avatar
Tracker Supp-Stefan
Site Admin
Posts: 13080
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Open MS Office files WITHOUT XPS add-in?

Post by Tracker Supp-Stefan » Thu Jan 21, 2016 3:07 pm

Hi gerundt,

I don't have the technical expertise to answer that last question - but I presume that if we can get that sort of information from Windows/Office - it won't be a problem to implement a more user friendly error message.
Let me check with the devs and we will come back here later with additional info.

Regards,
Stefan

DolphinMann
User
Posts: 154
Joined: Mon Aug 04, 2014 7:34 pm

Re: Open MS Office files WITHOUT XPS add-in?

Post by DolphinMann » Fri Oct 05, 2018 7:11 pm

I am getting this same message:

ErrorMesssage: Exception from HRESULT: 0x82191044
Stack Trace: at PDFXEdit.IPXV_ImportConverter.Convert(PXV_Inst pInst, Object pSrc, UInt32 nFlags, ICab pParams, IProgressMon pProgress, UInt32 hWndParent, Object pCtx)
at Dolphin.PDFProcess.PDFProcessTools.CreateDolphinPDF(String fileName, String outputFileName, Boolean deleteOriginal)
[10/5/2018 12:06:13 PM][ERROR][ThreadID:1] Error from PDF X-Change: Error [PXVLib]: Microsoft Office threw an exception.

With Microsoft Office 2016 installed and when I attempt to convert XLS and DOC files.

I have also seen it throw this error:
[10/5/2018 12:22:59 PM][ERROR][ThreadID:1] Error from PDF X-Change: Error [PXVLib]: No suitable version of Microsoft Office application has been found.
With the exact same file when executed from a service. But when I launch the program directly from the command line with that same file it works.

What specifically do I need to enable or allow to convert Office files? I know from a previous thread Microsoft Office had to be installed, but is there a specific component, registry setting, or feature I must allow?


Edit: Also, it seems that if I run the program from the command line, it is successfully, but if I launch it from a Windows Service, it is not. I basically have an executable that runs a single PDF command. This works perfectly, but if I launch it from a Windows Service with the code below, it fails:

Code: Select all

            Process testProcess = new Process();

            try
            {
                if (PDFTools.pdfUser != "")
                {
                    testProcess.StartInfo.Domain = PDFTools.domain;
                    testProcess.StartInfo.UserName = PDFTools.pdfUser;
                    testProcess.StartInfo.Password = PDFTools.pdfPassword;
                    Logger.Log("Executing PDF Process as: " + testProcess.StartInfo.Domain + @"\" + testProcess.StartInfo.UserName, 5);
                }

                testProcess.StartInfo.UseShellExecute = false;
                testProcess.StartInfo.FileName = PDFTools.pdfProcessPath;
                testProcess.StartInfo.CreateNoWindow = true;
                testProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
                testProcess.StartInfo.Arguments = "convert \"" + inputFile + "\" \"" + outputFile + "\" " + Convert.ToString(deleteOriginal);
                Logger.Log("Attempting to Create PDF w/External Process. Arguements: " + testProcess.StartInfo.Arguments, 5);
                testProcess.StartInfo.RedirectStandardOutput = true;
                testProcess.Start();

                Logger.Log("Create PDF Process Started. waiting maximum of " + 1000 * 60 * PDFTools.pdfToolsTimeoutInMin + " seconds for completion", 5);
                testProcess.WaitForExit(1000 * 60 * PDFTools.pdfToolsTimeoutInMin);
                if (!testProcess.HasExited)
                {
                    returnValue = false;
                    testProcess.Kill();
                }
                else
                {
                    string mainOutput = testProcess.StandardOutput.ReadToEnd();
                    Logger.Log("CreatePDF from: " + inputFile + " main output: " + mainOutput, 5);
                    returnValue = Convert.ToBoolean(mainOutput);
                }
            }
            catch (Exception ex)
            {
                Logger.Log("Exception", ex, 1);
            }
Basically I just want to convert documents to PDF as part of my larger windows service. This seems to work for all documents BUT microsoft office documents. However the conversion code run directly outside of the service will convert office documents.

I'm guessing it has something to do with office conversion launching a UI or requiring permissions or something, though the service is running as an administrator on the machine. Is there any way to convert an office doc from a windows service?

User avatar
Tracker Supp-Stefan
Site Admin
Posts: 13080
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Open MS Office files WITHOUT XPS add-in?

Post by Tracker Supp-Stefan » Mon Oct 08, 2018 4:21 pm

Hello DolphinMann,

I've asked a colleague from the dev team to take a look at your problem, and am awaiting his feedback!
As soon as I have further news - I will post them here!

Regards,
Stefan

DolphinMann
User
Posts: 154
Joined: Mon Aug 04, 2014 7:34 pm

Re: Open MS Office files WITHOUT XPS add-in?

Post by DolphinMann » Mon Oct 08, 2018 5:28 pm

Thank you very much. This is a road-block for us so I appreciate the help.

The forum(you) have always been pretty helpful!

User avatar
Dimitar - Tracker Supp
User
Posts: 279
Joined: Mon Jan 15, 2018 9:01 am

Re: Open MS Office files WITHOUT XPS add-in?

Post by Dimitar - Tracker Supp » Tue Oct 09, 2018 1:00 pm

Hello DolphinMann,

We are glad to hear that. :-)

Regards.

DolphinMann
User
Posts: 154
Joined: Mon Aug 04, 2014 7:34 pm

Re: Open MS Office files WITHOUT XPS add-in?

Post by DolphinMann » Fri Oct 12, 2018 12:58 am

I do not expect an immediate resolution, but just wanted to check in.

Are you able to replicate the issue? Would you like any of my code? Let me know if there is anything I can provide to make debugging easier.

User avatar
Tracker Supp-Stefan
Site Admin
Posts: 13080
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Open MS Office files WITHOUT XPS add-in?

Post by Tracker Supp-Stefan » Fri Oct 12, 2018 3:49 pm

Hello DolphinMann,

Apologies for the delay with following up on this one, but it turned out I need to check with a different colleague. I am working on this and hope to have some further feedback for you by Monday!

Regards,
Stefan

User avatar
Tracker Supp-Stefan
Site Admin
Posts: 13080
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Open MS Office files WITHOUT XPS add-in?

Post by Tracker Supp-Stefan » Tue Oct 16, 2018 2:55 pm

Hello DolphinMann,

Just a quick update. A colleague is still looking at this problem and trying to reproduce the set up and issue right now. He estimates that he should have further news and results by tomorrow. We will keep you posted!

Regards,
Stefan

DolphinMann
User
Posts: 154
Joined: Mon Aug 04, 2014 7:34 pm

Re: Open MS Office files WITHOUT XPS add-in?

Post by DolphinMann » Tue Oct 16, 2018 4:47 pm

Thanks for the update!

User avatar
Tracker Supp-Stefan
Site Admin
Posts: 13080
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Open MS Office files WITHOUT XPS add-in?

Post by Tracker Supp-Stefan » Wed Oct 17, 2018 4:14 pm

Hello DolphinMann,

The text below is all from a colleague of mine (Oleh) - but he does not have a registration here in the forums so I am posting on his behalf:

++++++++++++
I tried to convert Microsoft Office documents (DOC, XLS, PPT) with Editor's SDK under Windows Service - and it worked fine for me in Office 2016 - all files are successfully converted.
The HRESULT 0x82191044 error which you received, is equivalent to DISP_E_EXCEPTION error HRESULT, that is sometimes returned by MS Office when an error on their side occurs. So, I suspect that there is something not quite right with your Office installation.

There are cases when Microsoft Office applications may prevent the Editor from correct file processing. It may be due to some modal windows that it may display on startup (e.g. "Some plug-in was not loaded", "MS Office is not activated") - as far as these windows are modal - it does not allow to use Office Application converting office files on THEIR side. So, what I would recommend you to do is:
1) Check whether your Office is activated (not activated office displays modal windows)
2) Manually launch Word, Excel and check whether they work correct and whether they display any modal windows on startup OR on opening the files you do your tests on.
3) Try reinstall MS office (who knows, maybe it will help),
4) Try the same thing on different machine/MS Office installation if possible.
5) Also, you may send a brief project sample that reproduces the problem on your side, along with test files you encounter that error on - and I will try to reproduce the problem on my local machine.

@
What specifically do I need to enable or allow to convert Office files? I know from a previous thread Microsoft Office had to be installed, but is there a specific component, registry setting, or feature I must allow?

Actually you only need Microsoft Office 2007 or later. (activated preferred)
2007's version should have XPS Add-In installed and also there are some registry settings that may disable Office's ability to convert files to XPS and PDF (as you've seen earlier in this post).
But since you are using MS Office 2016 and you are able to convert files when you run your program as *.exe file - everything is OK with what I've just mentioned.
+++++++++++++++

And he also gave me this code which he says does work properly for him:

Code: Select all

public partial class Service1 : ServiceBase
 {
  public Service1()
  {
   InitializeComponent();
  }
  protected override void OnStart(string[] args)
  {
   PDFXEditTestFunc();
  }
  public void PDFXEditTestFunc()
  {
   PDFXEdit.PXV_Inst Inst = new PDFXEdit.PXV_Inst();
   Inst.Init(null, "", null, null, null, (int)PDFXEdit.PXV_AppTypeFlags.PXV_AppType_SDK);
   //MS EXCEL
   string sRequiredConv = "conv.imp.office.xls";
   string sSrcFile = "SampleFile.xls";
   //MS POWERPOINT
   //string sRequiredConv = "conv.imp.office.ppt";
   //string sSrcFile = "SampleFile.pptx";
   //MS WORD
   //string sRequiredConv = "conv.imp.office.doc";
   //string sSrcFile = "SampleFile.doc";

   PDFXEdit.IPXV_ImportConverter iConv = null;
   for (uint i = 0; i < Inst.ImportConvertersCount; i++)
   {
    if (Inst.ImportConverter[i].ID.Equals(sRequiredConv))
    {
     iConv = Inst.ImportConverter[i];
     break;
    }
   }

   if (iConv != null) //found converter
   {
    PDFXEdit.IAFS_Inst fsInst = (PDFXEdit.IAFS_Inst)Inst.GetExtension("AFS");
    string curDir = AppDomain.CurrentDomain.BaseDirectory + "\\Files\\";
    PDFXEdit.IAFS_Name sSrcFilename = fsInst.DefaultFileSys.StringToName(curDir + sSrcFile);
    int openFileFlags = (int)(PDFXEdit.AFS_OpenFileFlags.AFS_OpenFile_Read | PDFXEdit.AFS_OpenFileFlags.AFS_OpenFile_ShareRead);
    PDFXEdit.IAFS_File srcFile = fsInst.DefaultFileSys.OpenFile(sSrcFilename, openFileFlags);
    PDFXEdit.ICab cab = Inst.GetFormatConverterParams(true, sRequiredConv);
    PDFXEdit.IPXC_Document resDoc = null;
    try
    {
     resDoc = iConv.Convert((PDFXEdit.PXV_Inst)Inst, srcFile, 0, cab);
    }
    catch
    {

    }

    if (resDoc != null)
    {
     resDoc.WriteToFile(curDir + sSrcFile + ".pdf");
     resDoc.Close();
    }
   }
   Inst.Shutdown();
  }
  protected override void OnStop()
  {
   
  }
}
I hope the above will help you resolve the problem at your end, and if it does not please send us the sample Oleh asks for in 5) above.

Regards,
Stefan

DolphinMann
User
Posts: 154
Joined: Mon Aug 04, 2014 7:34 pm

Re: Open MS Office files WITHOUT XPS add-in?

Post by DolphinMann » Mon Oct 22, 2018 6:43 pm

Thank you for the feedback. I found the following things.

1.) Microsoft Office was not registered, so i did add a product key and officially register it.
2.) I ensured that Word/Excel do not have any pop-ups or modal window popups in general(opening clean) or with the file I am attempting to convert
3.) Created a new service from the code you provide, with paths changed to my file and some logging lines, and I am getting the same error

[10/22/2018 11:38:51 AM][ERROR][ThreadID:4] Calling actual Conversion
[10/22/2018 11:38:53 AM][ERROR][ThreadID:4] Failure in conversion
ErrorMesssage: Exception from HRESULT: 0x82191044
Stack Trace: at PDFXEdit.IPXV_ImportConverter.Convert(PXV_Inst pInst, Object pSrc, UInt32 nFlags, ICab pParams, IProgressMon pProgress, UInt32 hWndParent, Object pCtx)
at WindowsService1.Service1.PDFXEditTestFunc() in C:\Users\mark.mann\Documents\Visual Studio 2017\Projects\WindowsService1\WindowsService1\Service1.cs:line 72


At this point I am not sure what the problem is but it is clearly something about permissions or Office on this machine as the same call outside of a service does not cause this error. I'm going through some of the office options to try and see if anything makes sense.

EDIT 1:
I also tried: I also tried the following: https://docs.microsoft.com/en-us/window ... e-services

Which says to change the "NoInteractiveServices" registry key. This did not work either

EDIT 2:
I have tried another machine(also with Office 2016) with the same service code you provided and it was not successful. I am going to try a different version of Office

Edit 3: Completely reinstalled Office and Tried Office 2010 as well.


I can continue to get the conversion to work if executed from the command line, but it will not function with my service or the test service created by your developer. The service mode seems to convert all files except Office files with no issue.

I'm sort of at a loss here. Is there anything else I could check? Would a G2M make sense?

DolphinMann
User
Posts: 154
Joined: Mon Aug 04, 2014 7:34 pm

Re: Open MS Office files WITHOUT XPS add-in?

Post by DolphinMann » Mon Oct 22, 2018 10:36 pm

I also found this link: https://helpx.adobe.com/acrobat/kb/trou ... ffice.html

I tried adding the PDF Edit dll but that did not work. Could there be something like this going on?

User avatar
Tracker Supp-Stefan
Site Admin
Posts: 13080
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Open MS Office files WITHOUT XPS add-in?

Post by Tracker Supp-Stefan » Tue Oct 23, 2018 12:26 pm

Hello DolphinMann,

I've asked Oleh to take another look, and as soon as I have any further feedback I will post it here!

Also - can you please let us know what you mean with the G2M abbreviation above?

Regards,
Stefan

DolphinMann
User
Posts: 154
Joined: Mon Aug 04, 2014 7:34 pm

Re: Open MS Office files WITHOUT XPS add-in?

Post by DolphinMann » Tue Oct 23, 2018 2:48 pm

GoTo Meeting, where I can show you my screen or give you temporary access to my environment.

Thanks for taking another look. This is our last hurdle for our product

User avatar
Tracker Supp-Stefan
Site Admin
Posts: 13080
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Open MS Office files WITHOUT XPS add-in?

Post by Tracker Supp-Stefan » Tue Oct 23, 2018 4:29 pm

Hello DolphinMan,

Thanks for the clarification. I do not think a remote meeting is necessary at thsi point, but if my colleagues request it - I am happy to hear you are willing to show us the issue directly!

HRESULT: 0x82191044 stands for exception in Microsoft Office, and my colleagues suspect there is a problem with that and they think that you might be right that the problem is with Office permissions.

For the moment they have asked for
1) A brief simple project sample that reproduces the problem on your end.
2) The version of the .dll files you use and whether they are x32 or x64 but.
3) Any test file(s) would also be appreciated!
And we will then try to reproduce the problem on our local machines.

Regards,
Stefan

DolphinMann
User
Posts: 154
Joined: Mon Aug 04, 2014 7:34 pm

Re: Open MS Office files WITHOUT XPS add-in?

Post by DolphinMann » Tue Oct 23, 2018 9:50 pm

1.) No need for a sample project. I get the same error with the exact code you put in this thread!
2.) Version: 7.0.324.22579, 32bit
3.) Is there a way I can send a test file securely? This would be our customer data and I don't want to put it in the thread. However my experience shows any Excel File will exhibit this behavior.

User avatar
TrackerSupp-Daniel
Site Admin
Posts: 1512
Joined: Wed Jan 03, 2018 6:52 pm

Re: Open MS Office files WITHOUT XPS add-in?

Post by TrackerSupp-Daniel » Tue Oct 23, 2018 11:29 pm

Hello DolphinMann,

Thank you for verifying the first two points.
As for the test file, You can send a test file via email to Support@tracker-software.com, or if the files are too large for email, you can upload them to our useruploads server: https://www.tracker-software.com/knowle ... le-service
Please send us an email with a link to this thread when the files are uploaded notifying us of the name of the files, so that we can proceed from there.
Daniel McIntyre
Support Technician
Tracker Software Products (Canada) LTD

Sales: +1 (250) 324-1621
Fax: +1 (250) 324-1623

DolphinMann
User
Posts: 154
Joined: Mon Aug 04, 2014 7:34 pm

Re: Open MS Office files WITHOUT XPS add-in?

Post by DolphinMann » Wed Oct 24, 2018 3:23 pm

Email Sent

User avatar
Tracker Supp-Stefan
Site Admin
Posts: 13080
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Open MS Office files WITHOUT XPS add-in?

Post by Tracker Supp-Stefan » Wed Oct 24, 2018 4:13 pm

Thanks DolphinMann,

Oleh says he managed to reproduce the issue with the dll version you are using and is looking at why it is happening.
We are currently at build 327.0 of our products though - so is it possible for you to try with this latest one and let us know if the issue is still present?

Regards,
Stefan

DolphinMann
User
Posts: 154
Joined: Mon Aug 04, 2014 7:34 pm

Re: Open MS Office files WITHOUT XPS add-in?

Post by DolphinMann » Wed Oct 24, 2018 5:17 pm

Same issue with version: 7.0.327.0, x86 version

However slightly different HRESULT code

[10/24/2018 10:12:28 AM][ERROR][ThreadID:4] Failure in conversion
ErrorMesssage: Exception occurred. (Exception from HRESULT: 0x80020009 (DISP_E_EXCEPTION))
Stack Trace: at PDFXEdit.IPXV_ImportConverter.Convert(PXV_Inst pInst, Object pSrc, UInt32 nFlags, ICab pParams, IProgressMon pProgress, UInt32 hWndParent, Object pCtx)
at WindowsService1.Service1.PDFXEditTestFunc() in C:\Users\mark.mann\Documents\Visual Studio 2017\Projects\WindowsService1\WindowsService1\Service1.cs:line 72


EDIT: I am only testing with your test service that was provided in this thread, to eliminate any variables my code/project may add

User avatar
Tracker Supp-Stefan
Site Admin
Posts: 13080
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Open MS Office files WITHOUT XPS add-in?

Post by Tracker Supp-Stefan » Thu Oct 25, 2018 1:10 pm

Hello DolphinMan,

Here is the reply from Oleh with his findings so far!
We've managed to reproduce the problem on a local PC. It turned out that when running as a service, Microsoft Office needs a certain folder be present on the PC. (We do not know the reason why they need it, it's just something that other Office developers figured out.)
So, if you are using a Windows version newer than Vista , then the workaround that fixed the problem for us and many other users is to create the following folders if they are not already present:
C:\Windows\System32\config\systemprofile\Desktop
or if you are using 32-bit office on 64-bit Windows
C:\Windows\SysWOW64\config\systemprofile\Desktop
(you can create them both manually)

This workaround is from Microsoft's forums, so here is the link to the source in case it helps:
https://social.msdn.microsoft.com/Forum ... teonoffice

Please do try this and let us know if it helped.


Regards,
Stefan

DolphinMann
User
Posts: 154
Joined: Mon Aug 04, 2014 7:34 pm

Re: Open MS Office files WITHOUT XPS add-in?

Post by DolphinMann » Thu Oct 25, 2018 4:32 pm

Wow, interesting find.

Initial results show this as.....

Using x86 Version: 7.0.327.0

NOT working with Microsoft Office 2010
Working with Microsoft Office 2016

I will keep testing and let you know if anything changes, but that is an amazing find, thank you so much.


Edit: While I have a thread about Office Conversion Open, what is the config param to switch the conversion to use a landscape style page instead of portrait?

User avatar
Tracker Supp-Stefan
Site Admin
Posts: 13080
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Open MS Office files WITHOUT XPS add-in?

Post by Tracker Supp-Stefan » Fri Oct 26, 2018 3:00 pm

Hello DolphinMann,

Just checked with Oleh. It turns out that we will use the paper size/orientation as supplied by the Word file itself, and apply the same to the PDF file we will generate. So it does not seem like something you can control at conversion time. You will need the source document to be landscape in the first place.

Regards,
Stefan

DolphinMann
User
Posts: 154
Joined: Mon Aug 04, 2014 7:34 pm

Re: Open MS Office files WITHOUT XPS add-in?

Post by DolphinMann » Fri Oct 26, 2018 3:16 pm

Will this be the same for Excel(assuming the answer is yes).

Obviously Excel will convert much better as a landscape on average.

User avatar
Tracker Supp-Stefan
Site Admin
Posts: 13080
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Open MS Office files WITHOUT XPS add-in?

Post by Tracker Supp-Stefan » Fri Oct 26, 2018 3:20 pm

Hello DolphinMann,

I was just speaking with Oleh on exactly the same issue. And he told me that yes - Excel decides how to do the page splits, and then send us an XPS file with the dimensions of the pages that we need to create already calculated.

Regards,
Stefan

User avatar
Tracker Supp-Stefan
Site Admin
Posts: 13080
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Open MS Office files WITHOUT XPS add-in?

Post by Tracker Supp-Stefan » Tue Oct 30, 2018 4:09 pm

Hello DolphinMann,

Oleh advised that he tried to reproduce the issue you encountered and these are his notes:

1. He tried the workaround suggested above with Office 2010 - and it worked out for both 32-bit and 64-bit versions
2. We in our local office have also discovered that MS Office uses some Shell functions that in turn use virtual filesystem. Because of that these functions sometimes need folders like "Desktop" as you see there. We are now considering how we can fix this MS Office's specificity on our side
3. He would also like to ask if you managed to fix the problem by creating a "Desktop" folder in the path(s) posted earlier? Did you use this workaround or maybe you found your own? Or are you still having issues with this? How are things progressing?

Any feedback from you would be greatly appreciated!

Cheers,
Stefan

DolphinMann
User
Posts: 154
Joined: Mon Aug 04, 2014 7:34 pm

Re: Open MS Office files WITHOUT XPS add-in?

Post by DolphinMann » Thu Nov 01, 2018 5:07 pm

Thanks for checking in. I installed Office 2016 and then used the MSDN article you provided about creating those two folders. That seems to have worked.

I did not test again with 2010, as it seemed unnecessary to use an older version of Office when we have more recent license keys.

So far things seem ok. I still get some strange crashes sometimes with conversion and OCR, which are both plugins, but otherwise it seems very stable.

The attached image seems to crash OCR every time with default settings
Attachments
1.pdf
(61.02 KiB) Downloaded 10 times

DolphinMann
User
Posts: 154
Joined: Mon Aug 04, 2014 7:34 pm

Re: Open MS Office files WITHOUT XPS add-in?

Post by DolphinMann » Thu Nov 01, 2018 5:55 pm

edit: While it seems the version update did help conversion, now all OCR systems crash, so I am completely down on that side of the fence it seems, the example I put in this thread fails.

This is a hard crash, again without using a service or any extra code, just the following:

Code: Select all

            bool returnValue = false;
            PDFXEdit.IPXC_Document doc = null;
            PDFXEdit.IOperation Op = null;
            PDFXEdit.ICabNode options = null;
            PDFXEdit.ICabNode input = null;

            try
            {
                if (File.Exists(inputPDF))
                {
                    string pageValues = "";
                    PDFXEdit.IPXC_Inst pxcInst = (PDFXEdit.IPXC_Inst)viewerInstance.GetExtension("PXC");
                    doc = pxcInst.OpenDocumentFromFile(inputPDF, clbk);

                    int nID = viewerInstance.Str2ID("op.document.OCRPages", false);
                    Op = viewerInstance.CreateOp(nID);
                    input = Op.Params.Root["Input"];
                    input.v = doc;
                    options = Op.Params.Root["Options"];

                    if (pages.Length == 0 || (pages.Length == 1 && pages[0] == -1))
                    {
                        options["PagesRange.Type"].v = "All";
                        pageValues = "All";
                    }
                    else
                    {
                        options["PagesRange.Type"].v = "Exactly";

                        for (int count = 0; count < pages.Length; count++)
                        {
                            if (pageValues != "")
                            {
                                pageValues += ",";
                            }

                            pageValues += Convert.ToString(pages[count]);
                        }

                        options["PagesRange.Text"].v = pageValues;
                    }

                    options["OutputType"].v = 0;
                    options["OutputDPI"].v = 300;
                    options["ExtParams.Language"].v = languages;

                    Logger.Log("Attempting to execute OCR on document: " + inputPDF + " with pages: " + pageValues + " and languages: " + languages, 5);
                    Op.Do();

                    doc.WriteToFile(inputPDF);
                    Logger.Log("PDF File: " + inputPDF + " had OCR completed", 5);

                    doc.Close();
                    options.Clear();
                    input.Clear();
                    pxcInst = null;
                    returnValue = true;
                }
                else
                {
                    Logger.Log("PDF File: " + inputPDF + ", does not exist. Cannot execute OCR", 1);
                }
            }
            catch (Exception ex)
            {
                Logger.Log("Error running OCR on PDF: " + inputPDF, ex, 1);
                int hr = Marshal.GetHRForException(ex);
                PDFProcessTools.LogErrMsg(hr);
                returnValue = false;
            }
            finally
            {
                if (doc != null)
                {
                    doc.Close();
                    doc = null;
                }
                if (options != null)
                {
                    options.Clear();
                    options = null;
                }
                if (input != null)
                {
                    input.Clear();
                    input = null;
                }
            }

            return returnValue;

User avatar
Tracker Supp-Stefan
Site Admin
Posts: 13080
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Open MS Office files WITHOUT XPS add-in?

Post by Tracker Supp-Stefan » Fri Nov 02, 2018 1:45 pm

Hello DolphinMann,

Thanks for the follow up.
I've asked Oleh to once again take a look at this, and as soon as we have any further news and feedback we will post them here!

Regards,
Stefan

User avatar
Tracker Supp-Stefan
Site Admin
Posts: 13080
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Open MS Office files WITHOUT XPS add-in?

Post by Tracker Supp-Stefan » Mon Nov 05, 2018 10:47 am

Hello DolphinMann,

Oleh has some questions which if you can answer would help us a lot!
1. Do you start your code as a service or not?
2. What is that other plug-in that crashes apart from OCR ? Do you mean the "PDF to MS-Office Converters" plug-in or something else?

Regarding the Office 2 PDF issue:
3. We are glad that you've fixed the issue with Converting from MS Office to PDF with the workaround we suggested. We, as developers would also highly appreciate if you could tell us whether the fix with Office2PDF works with Office 2010 on your side - so we could investigate this at our end and provide possible workaround for other developers that use older Offices.

Thanks!
Stefan

DolphinMann
User
Posts: 154
Joined: Mon Aug 04, 2014 7:34 pm

Re: Open MS Office files WITHOUT XPS add-in?

Post by DolphinMann » Mon Nov 05, 2018 10:24 pm

I think I have an open support ticket as well, so there may be some overlap between that and this thread.

I have the ability to do both, start the code as a service or run as simple command line EXE.

Only OCR crashes now....I think things got mixed up here.

Original Issue: Office documents not converting when running application as a service. This was fixed by ensuring the Microsoft Office application was properly registered and licensed and then adding the windows folders to the machine. I now have this working in 2 locations. I also upgraded to version 7.0.327.1 as part of this process.

New Issue: Usign 7.0.327.1 or 7.0.327.0 OCR no longer works under any conditions, service or direct EXE call. This is what my current support ticket is over. I can reproduce this with the same code that works with an older 6.X version and *any* document. I suggest we keep the resolution to that in the support ticket so not to confusing this thread.


I also tried Office2PDF, but unless I am misunderstanding something, that seems to use the "Printer SDK/API" to do the conversion, I do not have that installed. Am I missing something? I do not have a need for or use the printer driver, unless you think that is a better option for all of my conversion needs.

DolphinMann
User
Posts: 154
Joined: Mon Aug 04, 2014 7:34 pm

Re: Open MS Office files WITHOUT XPS add-in?

Post by DolphinMann » Mon Nov 12, 2018 4:43 pm

Question about Conversion.....

Does the Editor SDK come with the printer driver? It may be easier to simply print everything to PDF than attempt to directly convert.

User avatar
Tracker Supp-Stefan
Site Admin
Posts: 13080
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Open MS Office files WITHOUT XPS add-in?

Post by Tracker Supp-Stefan » Mon Nov 12, 2018 5:30 pm

Hello DolphinMann,

Apologies, my colleague Oleh had some further comments on your post from last week, that I forgot to include. Here they are now:

Regarding the OCR issue - indeed it would be better if we keep that discussion separate and in it's corresponding support ticket, in order not to mix MS Office and OCR issues into a single thread.

Regarding MS Office:
In the Editor SDK there is the only way to convert Office files to PDF - using a corresponding IPXV_ImportConverter. Office2PDF is a separate utility that uses Printer Drivers to convert files. More details on the Office2PDF utility are available here:
https://www.tracker-software.com/office2pdf.html

And to answer your new question - No the Editor SDK does not include the Drivers API. The Pro SDK package includes it, but if you already have the Editor SDK, then a separate purchase of the Drivers API is cheaper.

Regards,
Stefan

Post Reply