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

Question

Question

How to Iterate a document using SDK

SDK
asked on July 24, 2014

Hi there, 

 

How can i iterate one document to know all the pages so that it can export all pages as PDF ? 

 

 

 

 

0 0

Answer

SELECTED ANSWER
replied on August 1, 2014

Hi there, 

 

I solve my problem with this code: 

 

 Int32 docId = Int32.Parse(textBox1.Text.Trim());

                    session = Util.ConexaoRepositorio.buildSessionRepository("NTBSBTI01.arqdigital.local", "Teste", "admin", "a"); //loga no repositório. 

                    docInfo = Document.GetDocumentInfo(docId, session); //busca o documento no repositório com base no ID passado. 
                    docInfo.Lock(LockType.Exclusive);
                    docInfo.GetPageInfo(1); //Pega a primeira página do Documento.

                    String DirBaseApp = AppDomain.CurrentDomain.BaseDirectory;
                    Directory.SetCurrentDirectory(DirBaseApp);
                    string criarDirAtual = Path.Combine(DirBaseApp, "PDF");

                    if (!Directory.Exists(criarDirAtual))
                    {
                        Directory.CreateDirectory(criarDirAtual);   
                    }                    
                   
                    DocumentExporter exportador = new DocumentExporter();
                    exportador.ExportPdf(docInfo, docInfo.AllPages, PdfExportOptions.None, criarDirAtual + docInfo.Name);

                    textBox1.Text = "";
                    
                    axAcroPDF1.LoadFile(criarDirAtual + docInfo.Name);

                    docInfo.Dispose();
                    session.LogOut();

 

0 0

Replies

replied on July 24, 2014

If you just need to know the total number of pages, the PageCount property of DocumentInfo will return the total number of pages in the document.

 

However, if you are using PDFExporter.ExportPages, it should default to exporting all pages if you do not set specific pages to export.

1 0
replied on August 1, 2014

Hi Allan, 

 

If your question has been answered, please let us know by clicking the "This answered my question" button on the response.

 

If you still need assistance with this matter, just update this thread. Thanks!

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

Sign in to reply to this post.