File.Delete(Application.StartupPath "\\Temp" "\\Codingvila_Articles_Report.pdf") File.Exists(Application.StartupPath "\\Temp" "\\Codingvila_Articles_Report.pdf")) Check for File Existing or Not if (System.IO. Store path/name of pdf file one by one string StrPathN = Application.StartupPath "\\Temp" "\\Codingvila_Articles_Report" i.ToString() ".Pdf" įPath = FPath = "" ? StrPathN : FPath "," StrPathN ĬryRpt.ExportToDisk(, StrPathN) StrPath = StrPath "rptCodingvila_Articles_Report.rpt" Store path of .rpt file string StrPath = Application.StartupPath "\\RPT" ReportDocument cryRpt = new ReportDocument() Create For loop for get/create muliple report on single click based on row of gridview control for ( int j = 0 j 0) Let's take an example to use this function in C# So, If you analyzed above function then this function requires 2 arguments as an input parameter PDFfileNames for input files and OutputFile as output file where PDFfileNames is a string Array that holds name/path of input files. form = PDFreader.AcroForm Īfter, Create this function here I will show you how you can use this function to merge your multiple pdf documents. page = PDFwriter.GetImportedPage(PDFreader, i) PDFreader.ConsolidateNamedDestinations() Create a PDFreader for a certain PDFdocument PDFwriter = new (PDFdoc, MyFileStream) įoreach ( string fileName in PDFfileNames) Create a PDFwriter that is listens to the Pdf document Create a object of FileStream which will be disposed at the end using (System.IO. Now, after downloading the Itextsharp.dll and as I said after adding this assembly as a reference in your project you need to add the following function in your code behind.įunction To Marge Multiple PDF Document Using ItextsharpĬ# public static void MargeMultiplePDF( string PDFfileNames, string OutputFile) You can download Itextsharp.dll from the internet, there is many websites are available where you can find this DLL file. So, let's start with an example to a merge pdf document in the single document, but before that, you need to download Itextsharp.dll file and add in your project as a reference assembly. Itextsharp is an advanced tool library that is a free and open source which is used for creating complex pdf documents and that help to convert page output or HTML content in a PDF file.ġ) Export Multiple Crystal Report in PDF File on Singal Click and Save that documents Directory of Project.Ģ) Marge All the Exported Document in Single PDF Document.ģ) If Exists Then Remove All The Existing Exported PDF Document from The Directory. So, I have analyzed that solution and wrote a method and using this method we can merge multiple PDF Document in Single Document and got a solution that I gonna share with you. Then from my current company, one of my superior/senior suggest some ideas like I should export the report in PDF Document using Itextsharp library with help of looping mechanism and save these documents in any temporary folder of the project directory and finally create a method to merge all these exported PDF Documents.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |