A component that the plugin needs is missing from the application or from the system. The document is not at fault.
A metered license issued for another plugin throws InvalidOperationException; see Licensing.
Handle an Unsupported Input Format
The following example passes a DOCX document to the SplitPdf plugin and prints the message of the exception.
usingSystem;usingGroupDocs.Merger.Exceptions;usingGroupDocs.Merger.LowCode;// Load license keysvarpublicKey=Environment.GetEnvironmentVariable("GD_PUBLIC_KEY");varprivateKey=Environment.GetEnvironmentVariable("GD_PRIVATE_KEY");// Apply the licenseLicense.Set(publicKey,privateKey);try{// A DOCX document passed to the PDF pluginvarsplitter=newSplitPdf("business-plan.docx",new[]{1});splitter.Save("output/page.pdf");}catch(FileTypeNotSupportedExceptionex){// Input format does not match the expected format 'PDF'; the supplied file is ...Console.WriteLine(ex.Message);}
ImportsSystemImportsGroupDocs.Merger.ExceptionsImportsGroupDocs.Merger.LowCodeModuleProgramSubMain()' Load license keys
DimpublicKey=Environment.GetEnvironmentVariable("GD_PUBLIC_KEY")DimprivateKey=Environment.GetEnvironmentVariable("GD_PRIVATE_KEY")' Apply the license
License.Set(publicKey,privateKey)Try' A DOCX document passed to the PDF plugin
DimsplitterAsNewSplitPdf("business-plan.docx",{1})splitter.Save("output/page.pdf")CatchexAsFileTypeNotSupportedException' Input format does not match the expected format 'PDF'; the supplied file is ...
Console.WriteLine(ex.Message)EndTryEndSubEndModule
openSystemopenGroupDocs.Merger.ExceptionsopenGroupDocs.Merger.LowCode[<EntryPoint>]letmain_=// Load license keys
letpublicKey=Environment.GetEnvironmentVariable("GD_PUBLIC_KEY")letprivateKey=Environment.GetEnvironmentVariable("GD_PRIVATE_KEY")// Apply the license
License.Set(publicKey,privateKey)try// A DOCX document passed to the PDF plugin
letsplitter=SplitPdf("business-plan.docx",[|1|])splitter.Save("output/page.pdf")with:?FileTypeNotSupportedExceptionasex->// Input format does not match the expected format 'PDF'; the supplied file is ...
printfn"%s"ex.Message0
The following example tries to remove a page that doesn’t exist.
usingSystem;usingGroupDocs.Merger.Domain.Options;usingGroupDocs.Merger.Exceptions;usingGroupDocs.Merger.LowCode;// Load license keysvarpublicKey=Environment.GetEnvironmentVariable("GD_PUBLIC_KEY");varprivateKey=Environment.GetEnvironmentVariable("GD_PRIVATE_KEY");// Apply the licenseLicense.Set(publicKey,privateKey);try{// The document has 18 pagesvarremover=newRemovePagesPdf("business-plan.pdf",newRemoveOptions(new[]{50}));remover.Save("output/trimmed.pdf");}catch(GroupDocsMergerExceptionex){// Page number more than page count.Console.WriteLine(ex.Message);}
ImportsSystemImportsGroupDocs.Merger.Domain.OptionsImportsGroupDocs.Merger.ExceptionsImportsGroupDocs.Merger.LowCodeModuleProgramSubMain()' Load license keys
DimpublicKey=Environment.GetEnvironmentVariable("GD_PUBLIC_KEY")DimprivateKey=Environment.GetEnvironmentVariable("GD_PRIVATE_KEY")' Apply the license
License.Set(publicKey,privateKey)Try' The document has 18 pages
DimremoverAsNewRemovePagesPdf("business-plan.pdf",NewRemoveOptions({50}))remover.Save("output/trimmed.pdf")CatchexAsGroupDocsMergerException' Page number more than page count.
Console.WriteLine(ex.Message)EndTryEndSubEndModule
openSystemopenGroupDocs.Merger.Domain.OptionsopenGroupDocs.Merger.ExceptionsopenGroupDocs.Merger.LowCode[<EntryPoint>]letmain_=// Load license keys
letpublicKey=Environment.GetEnvironmentVariable("GD_PUBLIC_KEY")letprivateKey=Environment.GetEnvironmentVariable("GD_PRIVATE_KEY")// Apply the license
License.Set(publicKey,privateKey)try// The document has 18 pages
letremover=RemovePagesPdf("business-plan.pdf",RemoveOptions([|50|]))remover.Save("output/trimmed.pdf")with:?GroupDocsMergerExceptionasex->// Page number more than page count.
printfn"%s"ex.Message0
MissingDependencyException means that the plugin couldn’t load a component it depends on. Its AssemblyName property names the assembly when it is known. Typical causes:
The application was published with trimming or as a single file, and an assembly of the package was removed or can’t be loaded. Publish the application without trimming.
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.