Word conversion: protected area

May 11 at 10:19 AM
Hi,

I seem to run in to an issue with files (filled out forms) that fail using officetopdf.
The output says:
"This method or property is not available because the object refers to a protected area of the document."
It's not entirely clear for me what exactly is wrong:
  • I tried printing the document from within Word itself, this works without a problem
  • I tried reproducing it by creating a form from scratch and adding protection, but that also seems to work just fine
I use following command: OfficeToPDF.exe "sourcepath.docx" "destinationpath.pdf" /readonly /verbose /hidden /print. What I see is:
  • Word is opened and is asking to save changes
  • When I do so, it says "your document will be upgraded to the newest file format" (which seemed a little off to me, as the original file is docx, not doc)
  • When I use officetopdf on the resulting file, it does work.
Any idea on what causes this / how I can resolve this?
Thanks in advance
Coordinator
May 11 at 11:37 AM
Hi Anja

We'd need to get an example document so we could replicate the issue here.

You can mail examples to opensource@cognidox.com

Regards
Vittal
May 12 at 8:13 AM
Hi,

I feared as much. I don't think I can mail you the files, as they contain somewhat confidential information. And the problem is of course I can't alter the file, because then the problem is gone.
When I check the app.xml, it seems the file is created in Office 2010 (AppVersion 14.0000). And indeed, when I open the original file (in Office 2016), it opens in 'Compatibility Mode'.
Both files have the same documentprotection element in the settings.xml
<w:documentProtection w:salt="OSa12G4r55AfdEh16vqNWw==" w:hash="20IFhMxj7Rz380rKDR4U3ZPOTJo=" w:cryptSpinCount="100000" w:cryptAlgorithmSid="4" w:cryptAlgorithmType="typeAny" w:cryptAlgorithmClass="hash" w:cryptProviderType="rsaFull" w:enforcement="1" w:edit="forms"/>

Unfortunately, I don't have an Office 2010 to test with.
I'll try some more to find a way to create a file like this or try to find a file with this issue, that doesn't contain much data...

Thanks anyway
Anja
Coordinator
May 12 at 9:01 AM
Hi Anja

You could also try with the /word_field_quick_update or /word_no_field_update options to see if they have an effect.

Regards
Vittal
Marked as answer by cognidox on 5/15/2017 at 5:18 AM
May 15 at 8:22 AM
Edited May 15 at 8:46 AM
Hi Vittal,

It seems that both options seem to work! But I do still wonder why...

I also found out it probably isn't just the presence of protected form fields, the files also contains "hidden" elements. So when I open the files with Word and go to File > Print, the "Page setup" link at the bottom isn't available, so I can't select the option to show hidden elements.

However, I still can't reproduce this myself in Office 2016. When I create a file with hidden/protected/form elements, officetopdf still handles it correctly.

Kind regards
Anja
Coordinator
May 15 at 12:18 PM
Hi Anja

Good to know there is a work-around.

As to why Office 2016 behaves differently, I suspect Microsoft fixed some brokenness in the newer Office interop libraries (the API that OfficeToPDF uses to run Office). it is not unusual to find differences in behaviour between Office versions.

Regards
Vittal