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

Question

Question

Auto (or Workflow) Generate pdf Electronic File out of Pages

asked on August 1, 2014

Paper documents scanned through LF Scanning/ScanConnect then stored (new document) as pages only in the repository. Looking for an automatic way to generate an electronic file for the entry in pdf format. Ideally at the same time the document is created, otherwise through a workflow.

 

Any suggestion?

0 0

Answer

SELECTED ANSWER
replied on August 9, 2014

Thanks Devin, I'll take a look at your code on my way back from holiday

 

Stay tuned ;-)

0 0

Replies

replied on August 1, 2014 Show version history

It's possible. I do it in some places. How it gets done in Workflow depends on what the final destination of the PDF is going to be. What are you doing with the PDFs?

 

This might work, it's a simplified snippet out of a Workflow script that I use:

            ConnectionWrapperRA wrapper = this.ConnectToRA(ConnectionMethodRA.RepositoryAccess91);

            Session wrapperSession = (Session)wrapper.Connection;

            var srch = new Search(wrapperSession);

            string searchString = @"<Advanced Search Syntax>", ";
            srch.Command = searchString;
            srch.Run();

            SearchStatistics ss = srch.GetSummaryStats();
            SearchResultListing results = srch.GetResultListing(new SearchListingSettings());

            var de = new DocumentExporter();

            for(int i = 1; i <= results.RowsCount; i++)
            {
                    //Convert the documents to PDF and store in a memory stream
                var ms = new MemoryStream();
                DocumentInfo docInfo = Document.GetDocumentInfo(results.GetEntryInfo(i).Id, wrapperSession);
                de.ExportPdf(docInfo, docInfo.AllPages, PdfExportOptions.IncludeText, ms);

            }

 

 

2 0
replied on August 5, 2014

Hello Devin,

 

I intend to ftp the pdf file through (reuse) an SDK activity. Ideally first 'attach' the pdf file to the pages only entry as its electronic file counterpart.

 

Lou

0 0
replied on August 5, 2014 Show version history

Sure, that's not too hard. After the above de.ExportPdf line, add the following:

//Don't want anybody else messing around while we're working
docInfo.Lock(LockType.Exclusive);
DocumentImporter di = new DocumentImporter();
//Associate di with the document we've already got
di.Document = docInfo;
// Attaches the stream that we used to write the PDF
di.ImportEdoc("application/pdf", ms);

//important
docInfo.Save();
//cleanup
docInfo.Unlock();
docInfo.Dispose();

 

1 0
SELECTED ANSWER
replied on August 9, 2014

Thanks Devin, I'll take a look at your code on my way back from holiday

 

Stay tuned ;-)

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

Sign in to reply to this post.