You are viewing limited content. For full access, please sign in.

Question

Question

Document Extension using LF SDK 9.0 and .NET

SDK
asked on July 21, 2014 Show version history

 Hi There,

 

I am trying to get the document extension using LF SDK 9.0 and .NET. Other document info properties are working fine but not the document extension.

 

Is there anything wrong with the below code ?

Dim docInfo As DocumentInfo

'               docInfo = Document.GetDocumentInfo(docPath & docName, mySess)
docInfo = Document.GetDocumentInfo("\Prakash\123" , mySess)


If (docInfo Is Nothing = False) Then
        MsgBox("Creation time: " & docInfo.CreationTime)
        MsgBox(" Document Extention: " & docInfo.Extension)
        MsgBox(" Document Id " & docInfo.Id)
End If

Regards,

Prakash

0 0

Answer

SELECTED ANSWER
replied on July 24, 2014

Exporting the electronic file component such as a word document is different from exporting the image pages of a document. If you have not used Snapshot to generate image pages for your word documents or excel files, then no image pages will be present, and attempting to export these pages will result in an empty document.

 

Please read section of the SDK help files, Exporting a Document the SDK help files. The last section, Exporting the Electronic File associated with an Electronic Document, gives an example of exporting the electronic file component.

 

Two key points about exporting the electronic file:

  • You do not set the PageFormat property when exporting an electronic file as PageFormat is used only to determine what format to export image pages in. The electronic file can only be exported in it's current  format (docx, xslx, etc.).
  • You use the ExportElecDoc method to export an electronic file rather than the ExportPages, which should only be used to export the image pages

 

You should be able to check whether your document has an electronic file component or not using Bert's code snippet, which checks the IsElectronicDocument properties. From there, you can use the appropriate method to export either the electronic file or the image pages.

0 0

Replies

replied on July 22, 2014 Show version history

Once you have your DocumentInfo object, you can use the .IsElectronicDocument property to only process if it the entry has an electronic document component.

 

        If docInfo.IsElectronicDocument Then
            MsgBox(" Document Extention: " & docInfo.Extension)
        End If

The docInfo.Extension will only have a value if the entry has an electronic document component.  In your Laserfiche repository, import a PDF (keeping it as PDF) and then process it with your program to see how it works with electronic documents.

1 0
replied on July 21, 2014

Can you confirm that your document is an electronic document and not a Laserfiche (image) document?

0 0
replied on July 21, 2014

Hi Alex,

 

Thanks !. I am new to Laserfiche SDK. 

 

I think it's Laserfiche document. I don't know how to differentiate the Laserfiche (image) document vs an electronic document.

 

-Prakash

0 0
replied on July 22, 2014

Please see this page for information about document types as well as other Laserfiche concepts.

1 0
replied on July 22, 2014

Hi,

 

the document is Laserfiche image document. It's of type tiff . Is it possible to get the document extension ?

 

Prakash

0 0
replied on July 22, 2014

As Bert said, the document will only have a value for the extension property if it is not a Laserfiche Image document. What are you trying to use the extension for?

0 0
replied on July 22, 2014

Can you further explain what your overall objective is with the SDK application? What are you using the extension information for? How are imaged documents coming into play with needing to know an extension?

0 0
replied on July 22, 2014

I am writing a VB .NET script to export the files, metadata from a folder and It could have sub folders as well

 

.

0 0
replied on July 24, 2014

Hi there,

 

When I am trying to export .docx (word document) or .xlsx (excel document) . I am getting only empty documents. 

 

exporter.PageFormat = DocumentPageFormat.????

 

Any thoughts ?

 

-Prakash

 

 

0 0
replied on July 24, 2014

DocumentExporter.PageFormat is set for exporting images, not electronic documents. You want to call ExportElecDoc. See the example in the "Exporting a Document" section in the SDK help file.

 

 

0 0
SELECTED ANSWER
replied on July 24, 2014

Exporting the electronic file component such as a word document is different from exporting the image pages of a document. If you have not used Snapshot to generate image pages for your word documents or excel files, then no image pages will be present, and attempting to export these pages will result in an empty document.

 

Please read section of the SDK help files, Exporting a Document the SDK help files. The last section, Exporting the Electronic File associated with an Electronic Document, gives an example of exporting the electronic file component.

 

Two key points about exporting the electronic file:

  • You do not set the PageFormat property when exporting an electronic file as PageFormat is used only to determine what format to export image pages in. The electronic file can only be exported in it's current  format (docx, xslx, etc.).
  • You use the ExportElecDoc method to export an electronic file rather than the ExportPages, which should only be used to export the image pages

 

You should be able to check whether your document has an electronic file component or not using Bert's code snippet, which checks the IsElectronicDocument properties. From there, you can use the appropriate method to export either the electronic file or the image pages.

0 0
replied on July 24, 2014

Hi Brianna,

 

I am looking at the ExportElecDoc method. Do you have any small example for this method ? That will be really appreciated.

 

-Prakash

0 0
replied on July 24, 2014

The SDK help files include at least one example for this function. If you did not install the help files, you can do so by running the installation again, choosing to Modify the installation, and adding the help files.

0 0
replied on July 24, 2014

Hi Brianna,

 

thanks !. that worked fine. Let me know how to award the points to you.

0 0
replied on July 24, 2014

It looks like you found the "This answered my question" button. Thanks for following up and marking the answer smiley That's all you need to do.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.