This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Combining PDF files

Dear Community Members, 

I have one question regarding the PDF combination in M-Files. I would like to combine 2 or 3 PDF files from the same class and make it one PDF file in M-Files. Is there any possibilities for doing that? Thank you. 

Best regards, 

Baigal

  • This is not something that's supported out of the box.

    The PDF Processor add-on can merge multiple files into one PDF if the merging is happening as part of a process, e.g. combining an agreement and its appendices into one when the agreement is ready for signing and moves to the "Ready for signing" workflow state.

    If the use case is more about letting users freely combine documents in the client, I believe there are some partner solutions available for that.

  • Thank you Joonas! I've enabled PDF Processor add-on to our M-Files and its working great. It was very helpful. 

  • Hello All

    We have same problem and exactly same situation.

    We are looking for solution or some idea how we can combine PDF files to one PDF file.

    This can be random selection 5-10 files or 500 files  from some view.

    Perfect solution will be add “merge file” to content menu.

    We can’t use PDF Processor due to some limitations.

    The answer from support : 

    "There's no option in M-Files at the moment to merge files such as PDFs. 

    There is an existing development request for our R&D to add support of  Merging multiple PDFs inside a view into one PDF. The request
    ID is 151756"

     

    I know  for rendering MS Office files to PDF  format M-Files use engine from PDF Exchange Editor.

    PDF Exchange Editor have integrated combine PDF module .like in screanshot.

    Maybe we can add same to M-Files Desktop version

    Any Idea?

  • There are some partner solutions in this field, one that I'm aware of is Avalia Document Merger but I haven't used it myself so you should contact the developer directly to check the exact functionality and whether it suits your purposes.

    If you can't find a ready solution then it's possible to develop a custom extension for this (using VAF and some PDF manipulation library such as Aspose).

    As you are working for a reseller, I recommend that you raise this with the local channel team in case they have other suggestions. You can also discuss the requirements for the custom extension with them if that's what's needed in the end.

  • Avalia Document Merger  -  This exactly what we need.

    Thank you very much!

  • Hello Baigal, you can see our sofware PDF Manager for you need.

    https://youtu.be/e5JL4jp8XBI

    Regards

    Sébastien

  • hello Boris,

    You can see our sofware PDF Manager for you need.

    https://youtu.be/e5JL4jp8XBI

    Regards

    Sébastien

  • Hi 

    this app can merge 500 pdf files to the one file in the M-Files desktop interface?

    How long time take to do this , if answer Yes.

  • I'm having a very simple Solution in mind (right click -> combine) but I need help downloading the selected files and reuploading the combined PDF via JS.. If someone could offer me a little help..

    Currently I'm trying to combine the files without downloading but having problems with special characters in file names as the PDF library I'm using for combine (PDFTK) has problems with certain characters.. But I already wrote to the dev if he can fix it.. If this would work than we just need the code for reuploading the output doc and boom Slight smile Another variant would be to direct the output straight to a monitored folder so M-Files pulls the file..

  • Combining is an easy task, here's an example for a custom command button with Foxit Quick PDF Library, unfortunately this is paid software but I'm still looking for a free solution.. There are hundrets of PDF Functions you can call this way..

    The first quote is the part for combining the pdf, second is the full code.. You have to enter a Serial Number (can also be a trial) to make it work.. I have an older Version of this PDF Library I think it is called Foxit SDK now..

    			if( command == commandShow1 ) {
    				var Vault = shellFrame.ShellUI.Vault;
    				var QP = new ActiveXObject("DebenuPDFLibrary64AX1811.PDFLibrary");
    				if (QP.UnlockKey("ENTER YOUR UNLOCK KEY HERE") == 1)
    				{
    				var selectedItems = shellFrame.ActiveListing.CurrentSelection;
    				for (var i = 1; i <= selectedItems.ObjectVersions.Count; i++) {
    					var objectversion = selectedItems.ObjectVersions.Item( i );
    					var selectedpath = Vault.ObjectFileOperations.GetPathInDefaultView( objectversion.ObjVer.ObjID, -1, -1, -1 );
    					QP.AddToFileList("FilesToMerge", selectedpath);
    				}
    				QP.MergeFileList("FilesToMerge", "E:\merged_file_list.pdf");
    				}
    			}

    "use strict";
    
    function OnNewShellUI( shellUI ) {
    	/// <summary>The entry point of ShellUI module.</summary>
    	/// <param name="shellUI" type="MFiles.ShellUI">The new shell UI object.</param>
    
    	// Register to listen new shell frame creation event.
    	shellUI.Events.Register( Event_NewNormalShellFrame, newShellFrameHandler );
    }
    
    function newShellFrameHandler( shellFrame ) {
    	/// <summary>Handles the OnNewShellFrame event.</summary>
    	/// <param name="shellFrame" type="MFiles.ShellFrame">The new shell frame object.</param>
    
    	// Register to listen the started event.
    	shellFrame.Events.Register( Event_Started, getShellFrameStartedHandler( shellFrame ) );
    }
    
    function getShellFrameStartedHandler( shellFrame ) {
    	/// <summary>Gets a function to handle the Started event for shell frame.</summary>
    	/// <param name="shellFrame" type="MFiles.ShellFrame">The current shell frame object.</param>
    	/// <returns type="MFiles.Events.OnStarted">The event handler.</returns>
    
    	// Return the handler function for Started event.
    	return function() {
    	
    		// Shell frame object is now started.
    		
    		// Create a command group
    		// ref: www.m-files.com/.../index.html
    		var commandGroupId = shellFrame.TaskPane.CreateGroup( "PDF", 100 );
    		
    		// Create some commands.
    		var commandShow1 = shellFrame.Commands.CreateCustomCommand( "Combine PDF" );
    
    		// Set command icons.
    		shellFrame.Commands.SetIconFromPath( commandShow1, "png/pdf.ico" );
    		
    		// Add a command to the context menu.
    		shellFrame.Commands.AddCustomCommandToMenu( commandShow1, MenuLocation_ContextMenu_Bottom, 0 );
    		
    		// Add a commands to the task pane.
    		shellFrame.TaskPane.AddCustomCommandToGroup( commandShow1, commandGroupId, 1 );
    		
    		// Hide the command.
    		shellFrame.Commands.SetCommandState( commandShow1, CommandLocation_All, CommandState_Hidden );
    		
    		// Register to listen to when new shell listings are created.
    		shellFrame.Events.Register(
    			Event_NewShellListing,
    			getNewShellListingHandler( shellFrame, commandShow1 ) );
    
    		// Is there already a listing?  If so then we need to hook into it as well.
    		if (null != shellFrame.Listing)
    		{
    			getNewShellListingHandler( shellFrame, commandShow1 )( shellFrame.Listing );
    		}
    		
    		// Set the command handler function.
    		shellFrame.Commands.Events.Register( Event_CustomCommand, function( command ) {
    		
    			// Branch by command.
    			
    			if( command == commandShow1 ) {
    				var Vault = shellFrame.ShellUI.Vault;
    				var QP = new ActiveXObject("DebenuPDFLibrary64AX1811.PDFLibrary");
    				if (QP.UnlockKey("ENTER YOUR UNLOCK KEY HERE") == 1)
    				{
    				var selectedItems = shellFrame.ActiveListing.CurrentSelection;
    				for (var i = 1; i <= selectedItems.ObjectVersions.Count; i++) {
    					var objectversion = selectedItems.ObjectVersions.Item( i );
    					var selectedpath = Vault.ObjectFileOperations.GetPathInDefaultView( objectversion.ObjVer.ObjID, -1, -1, -1 );
    					QP.AddToFileList("FilesToMerge", selectedpath);
    				}
    				QP.MergeFileList("FilesToMerge", "E:\merged_file_list.pdf");
    				}
    			}
    		} );
    	};
    }
    
    function getNewShellListingHandler(shellFrame, commandId)
    {
    	/// <summary>Gets a function to handle the NewShellListing event for shell frame.</summary>
    	/// <param name="shellFrame" type="MFiles.ShellFrame">The current shell frame object.</param>
    	/// <returns type="MFiles.Events.OnNewShellListing">The event handler.</returns>
    
    	// Return the handler function for NewShellListing event.
    	return function(shellListing)
    	{
    		// Listen for selection change events on the listing.
    		shellListing.Events.Register(
    			Event_SelectionChanged,
    			function(selectedItems)
    			{
    				// Sanity.
    				if (false == shellListing.IsActive)
    				{
    					return false;
    				}
    
    				// Has the user got any object versions selected?
    			
    				if (selectedItems.ObjectVersions.Count == 0)
    				{
    					// Hide the menu item - there's nothing selected.
    					shellFrame.Commands.SetCommandState( commandId, CommandLocation_All, CommandState_Hidden );
    					return false;
    				}
    
    				//Get vault object
    				var Vault = shellFrame.ShellUI.Vault;
    
    				//Get select items
    				var selectedItems = shellFrame.ActiveListing.CurrentSelection;
    				var objectversion = selectedItems.ObjectVersions.Item( 1 );
    				var selectedpath = Vault.ObjectFileOperations.GetPathInDefaultView( objectversion.ObjVer.ObjID, -1, -1, -1 );
    				var fileext = selectedpath.split('.').pop().toUpperCase();
    
    				if (fileext == "PDF")
    				{
    					// Show the menu item.
    					shellFrame.Commands.SetCommandState( commandId, CommandLocation_All, CommandState_Active );
    					// We succeeded; return true.
    					return true;
    					} else {
    					shellFrame.Commands.SetCommandState( commandId, CommandLocation_All, CommandState_Hidden );
    					return false;
    				}
    
    			} );
    	};
    }