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

Question

Question

How to import a PDF using RA

SDK
asked on March 11, 2014

Hi,

 

I would like to know how to import a PDF into the repository using RA (Repository Access). I can do this using COM, but I'm not quite getting to grips with doing this in RA. The .Net SDK sample documentation is not as comprehensive as the COM samples.

 

Any assistance would be appreciated.

 

Thanks

Sheldon 

0 0

Answer

SELECTED ANSWER
replied on March 11, 2014 Show version history

Sheldon,

 

Not sure what you have tried and don't want to provide code that is too basic but this code snippet will import a PDF into a new LF document.  (No provision for generating pages and/or OCR as that would be handled with Client Automation via the SDK)

 

        'Instantiate a new Session object...
        Dim raSession As Session = New Session

        'Connect and login...
        raSession.Connect(New RepositoryRegistration("localhost", "LFMAIN"))
        raSession.LogIn("admin", "admin")

        'Instantiate an importer instance...
        Dim docImporter As DocumentImporter = New DocumentImporter

        'Create the new LF document...
        Dim entryID As Integer = Document.Create("\\New Document", "DEFAULT", EntryNameOption.AutoRename, raSession)

        'Set the document to import the PDF into...
        docImporter.Document = Document.GetDocumentInfo(entryID, raSession)

        'Import the PDF with the correct MIME type...
        docImporter.ImportEdoc("application/pdf", "C:\TestData\Test.pdf")

        'Cleanup...
        docImporter = Nothing
        raSession.Close()
        raSession = Nothing

 

Let me know if this is what you were looking for...

4 0

Replies

replied on March 13, 2014

Hi Cliff,

 

Thanks for the hack, this is exactly what I needed.

 

Regards,

Sheldon

0 0
replied on February 10, 2015

Hi Guys,

Could you please help me, after import the document and try to export pages using PdfExporter90.pdfexporter 

I received the following message "the document has no pages" 

any know how to regenerate pages via programming or if i missing a detail to avoid this issue

0 0
replied on February 10, 2015

PDFExporter exports image pages as a PDF, it does not export the electronic component of a document. And it sounds like your document does not have image pages.

You want to use DocumentExporter.ExportElecDoc to export the electronic document.

0 0
replied on February 10, 2015

The PdfExporter is for exporting Laserfiche image pages to PDF, so the document must have image pages. As Cliff noted:

(No provision for generating pages and/or OCR as that would be handled with Client Automation via the SDK)

his solution does not generate pages for the document after importing the PDF.

If you wish to generate pages for your document, this post might help:

https://answers.laserfiche.com/questions/48724/Pdf-to-tiff-via-sdk-and-tiff-to-pdf-its-possible- 

If you don't care about generating pages and just want to export the PDF that you imported, there is a method DocumentExporter.ExportElecDoc that should help.

0 0
replied on April 13, 2015

I am doing something similar but my script fails on:

docImporter.Document = Document.GetDocumentInfo(entryPath, RASession);

I'm using DocumentProcessor91.DocumentImporterClass and  RepositoryAccess on 9.1

I was trying to follow the example above but I'm getting cast errors docImporter.Document wants an object and Document.GetDocumentInfo returns a DocumentInfo type.

What am I missing here?

0 0
replied on April 13, 2015

Nevermind I was referencing the wrong assembly.

I needed to use DocumentServices instead.

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

Sign in to reply to this post.