private HotDocs.Server.OutputOptions ConvertOutputOptions(OutputOptions sdkOpts) { HotDocs.Server.OutputOptions hdsOpts = null; if (sdkOpts is PdfOutputOptions) { PdfOutputOptions sdkPdfOpts = (PdfOutputOptions)sdkOpts; HotDocs.Server.PdfOutputOptions hdsPdfOpts = new HotDocs.Server.PdfOutputOptions(); hdsPdfOpts.Author = sdkPdfOpts.Author; hdsPdfOpts.Comments = sdkPdfOpts.Comments; hdsPdfOpts.Company = sdkPdfOpts.Company; hdsPdfOpts.Keywords = sdkPdfOpts.Keywords; hdsPdfOpts.Subject = sdkPdfOpts.Subject; hdsPdfOpts.Title = sdkPdfOpts.Title; //Remember that these are PDF passwords which are not highly secure. hdsPdfOpts.OwnerPassword = sdkPdfOpts.OwnerPassword; hdsPdfOpts.UserPassword = sdkPdfOpts.UserPassword; hdsi.PdfOutputFlags hdsFlags = 0; if (sdkPdfOpts.EmbedFonts) hdsFlags |= hdsi.PdfOutputFlags.pdfOut_EmbedFonts; if (sdkPdfOpts.KeepFillablePdf) hdsFlags |= hdsi.PdfOutputFlags.pdfOut_KeepFillablePdf; if (sdkPdfOpts.PdfA) hdsFlags |= hdsi.PdfOutputFlags.pdfOut_PdfA; if (sdkPdfOpts.TaggedPdf) hdsFlags |= hdsi.PdfOutputFlags.pdfOut_TaggedPdf; if (sdkPdfOpts.TruncateFields) hdsFlags |= hdsi.PdfOutputFlags.pdfOut_TruncateFields; hdsPdfOpts.PdfOutputFlags = hdsFlags; hdsi.PdfPermissions hdsPerm = 0; if (sdkPdfOpts.Permissions.HasFlag(PdfPermissions.Copy)) hdsPerm |= hdsi.PdfPermissions.COPY; if (sdkPdfOpts.Permissions.HasFlag(PdfPermissions.Modify)) hdsPerm |= hdsi.PdfPermissions.MOD; if (sdkPdfOpts.Permissions.HasFlag(PdfPermissions.Print)) hdsPerm |= hdsi.PdfPermissions.PRINT; hdsPdfOpts.PdfPermissions = hdsPerm; hdsOpts = hdsPdfOpts; } else if (sdkOpts is HtmlOutputOptions) { HtmlOutputOptions sdkHtmOpts = (HtmlOutputOptions)sdkOpts; HotDocs.Server.HtmlOutputOptions hdsHtmOpts = new HotDocs.Server.HtmlOutputOptions(); hdsHtmOpts.Author = sdkHtmOpts.Author; hdsHtmOpts.Comments = sdkHtmOpts.Comments; hdsHtmOpts.Company = sdkHtmOpts.Company; hdsHtmOpts.Keywords = sdkHtmOpts.Keywords; hdsHtmOpts.Subject = sdkHtmOpts.Subject; hdsHtmOpts.Title = sdkHtmOpts.Title; hdsHtmOpts.Encoding = sdkHtmOpts.Encoding; hdsOpts = hdsHtmOpts; } else if (sdkOpts is TextOutputOptions) { TextOutputOptions sdkTxtOpts = (TextOutputOptions)sdkOpts; HotDocs.Server.TextOutputOptions hdsTxtOpts = new HotDocs.Server.TextOutputOptions(); hdsTxtOpts.Encoding = sdkTxtOpts.Encoding; hdsOpts = hdsTxtOpts; } return hdsOpts; }
private HotDocs.Server.OutputOptions ConvertOutputOptions(OutputOptions sdkOpts) { HotDocs.Server.OutputOptions hdsOpts = null; if (sdkOpts is PdfOutputOptions) { PdfOutputOptions sdkPdfOpts = (PdfOutputOptions)sdkOpts; HotDocs.Server.PdfOutputOptions hdsPdfOpts = new HotDocs.Server.PdfOutputOptions(); hdsPdfOpts.Author = sdkPdfOpts.Author; hdsPdfOpts.Comments = sdkPdfOpts.Comments; hdsPdfOpts.Company = sdkPdfOpts.Company; hdsPdfOpts.Keywords = sdkPdfOpts.Keywords; hdsPdfOpts.Subject = sdkPdfOpts.Subject; hdsPdfOpts.Title = sdkPdfOpts.Title; //Remember that these are PDF passwords which are not highly secure. hdsPdfOpts.OwnerPassword = sdkPdfOpts.OwnerPassword; hdsPdfOpts.UserPassword = sdkPdfOpts.UserPassword; hdsi.PdfOutputFlags hdsFlags = 0; if (sdkPdfOpts.EmbedFonts) { hdsFlags |= hdsi.PdfOutputFlags.pdfOut_EmbedFonts; } if (sdkPdfOpts.KeepFillablePdf) { hdsFlags |= hdsi.PdfOutputFlags.pdfOut_KeepFillablePdf; } if (sdkPdfOpts.PdfA) { hdsFlags |= hdsi.PdfOutputFlags.pdfOut_PdfA; } if (sdkPdfOpts.TaggedPdf) { hdsFlags |= hdsi.PdfOutputFlags.pdfOut_TaggedPdf; } if (sdkPdfOpts.TruncateFields) { hdsFlags |= hdsi.PdfOutputFlags.pdfOut_TruncateFields; } hdsPdfOpts.PdfOutputFlags = hdsFlags; hdsi.PdfPermissions hdsPerm = 0; if (sdkPdfOpts.Permissions.HasFlag(PdfPermissions.Copy)) { hdsPerm |= hdsi.PdfPermissions.COPY; } if (sdkPdfOpts.Permissions.HasFlag(PdfPermissions.Modify)) { hdsPerm |= hdsi.PdfPermissions.MOD; } if (sdkPdfOpts.Permissions.HasFlag(PdfPermissions.Print)) { hdsPerm |= hdsi.PdfPermissions.PRINT; } hdsPdfOpts.PdfPermissions = hdsPerm; hdsOpts = hdsPdfOpts; } else if (sdkOpts is HtmlOutputOptions) { HtmlOutputOptions sdkHtmOpts = (HtmlOutputOptions)sdkOpts; HotDocs.Server.HtmlOutputOptions hdsHtmOpts = new HotDocs.Server.HtmlOutputOptions(); hdsHtmOpts.Author = sdkHtmOpts.Author; hdsHtmOpts.Comments = sdkHtmOpts.Comments; hdsHtmOpts.Company = sdkHtmOpts.Company; hdsHtmOpts.Keywords = sdkHtmOpts.Keywords; hdsHtmOpts.Subject = sdkHtmOpts.Subject; hdsHtmOpts.Title = sdkHtmOpts.Title; hdsHtmOpts.Encoding = sdkHtmOpts.Encoding; hdsOpts = hdsHtmOpts; } else if (sdkOpts is TextOutputOptions) { TextOutputOptions sdkTxtOpts = (TextOutputOptions)sdkOpts; HotDocs.Server.TextOutputOptions hdsTxtOpts = new HotDocs.Server.TextOutputOptions(); hdsTxtOpts.Encoding = sdkTxtOpts.Encoding; hdsOpts = hdsTxtOpts; } return(hdsOpts); }