public static void GetSubmitButtonURL() { // ExStart:GetSubmitButtonURL // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdf_Forms(); // Open document Document pdfDocument = new Document(dataDir + "GetValueFromField.pdf"); SubmitFormAction act = pdfDocument.Form[1].OnActivated as SubmitFormAction; if (act != null) { Console.WriteLine(act.Url.Name); } // ExEnd:GetSubmitButtonURL }
internal override Action Clone(IDocumentEssential owner) { PDFDictionary dict = new PDFDictionary(); dict.AddItem("Type", new PDFName("Action")); dict.AddItem("S", new PDFName("SubmitForm")); IPDFObject fs = _dictionary["F"]; if (fs != null) { dict.AddItem("F", fs); } string[] keys = { "Fields", "Flags" }; for (int i = 0; i < keys.Length; ++i) { IPDFObject obj = _dictionary[keys[i]]; if (obj != null) { dict.AddItem(keys[i], obj.Clone()); } } SubmitFormAction action = new SubmitFormAction(dict, owner); IPDFObject next = _dictionary["Next"]; if (next != null) { for (int i = 0; i < Next.Count; ++i) { action.Next.Add(Next[i]); } } return(action); }
public void ExecuteAction(ActionSet actionSet, BlockBase sourceBlock, Node sourceNode, long sourceViewID) { foreach (ActionBase action in actionSet.Actions) { switch (action.ActionType) { case ActionType.GotoNodeStable: { GotoNodeStableAction gns = action as GotoNodeStableAction; if (gns != null) { GoToNodeByURI(gns.URI, gns.Transition, gns.IsPopup, sourceViewID); } break; } case ActionType.GotoNodeStableSSP: { GotoNodeStableSSPAction gns = action as GotoNodeStableSSPAction; if ((gns != null) && (gns.Signpost >= 0)) { DisplayData dd = Core.UIFactory.FindSignpostedData(gns.Signpost, sourceViewID); if ((dd != null) && (dd.DisplayType == DisplayType.String)) { string uri = dd.Data as string; if (!String.IsNullOrEmpty(uri)) { GoToNodeByURI(uri, gns.Transition, gns.IsPopup, sourceViewID); } } } break; } case ActionType.GotoNodeInFrame: { GotoNodeInFrameAction gnif = action as GotoNodeInFrameAction; if (gnif != null) { View target = ResolveFrameID(gnif.FrameID, sourceBlock); if (target != null) { GoToNodeByURI(gnif.URI, gnif.Transition, gnif.IsPopup, target.ID); } } break; } case ActionType.GotoBack: { GotoBackAction gb = action as GotoBackAction; if (gb != null) { View view = Core.UI[sourceViewID]; if (view != null) { view.GoBack(); } } break; } case ActionType.Refresh: { RefreshAction rfr = action as RefreshAction; if (rfr != null) { View target = ResolveFrameID(rfr.FrameID, sourceBlock); if (target != null) { GoToNodeByURI(target.CurrentNode.URI, NodeTransition.None, false, target.ID, true); } } break; } case ActionType.ClearBackStack: { ClearBackstackAction cbs = action as ClearBackstackAction; if (cbs != null) { View target = ResolveFrameID(cbs.FrameID, sourceBlock); if (target != null) { target.ClearBackstack(); } } break; } case ActionType.SubmitForm: { SubmitFormAction sf = action as SubmitFormAction; if (sf != null) { SendForm(sf, actionSet, sourceNode, sourceBlock, sourceViewID); } break; } case ActionType.SubmitFormToFrame: { SubmitFormToFrameAction sftf = action as SubmitFormToFrameAction; if (sftf != null) { View target = ResolveFrameID(sftf.FrameID, sourceBlock); if (target != null) { SendForm(sftf, actionSet, sourceNode, sourceBlock, sourceViewID, true); } } break; } case ActionType.GotoApplicationHome: { GotoApplicationHomeAction gah = action as GotoApplicationHomeAction; if (gah != null) { GoToApplication(gah.URI, null, gah.Transition, gah.IsPopup, sourceViewID); } break; } case ActionType.GotoApplicationNode: { GotoApplicationNodeAction gan = action as GotoApplicationNodeAction; if (gan != null) { GoToApplication(gan.ApplicationURN, gan.ItemURI, gan.Transition, gan.IsPopup, sourceViewID); } break; } case ActionType.GotoNodeVolatile: case ActionType.SaveApplicationToFavourites: case ActionType.EPGSubmitForm: case ActionType.EPGViewportUp: case ActionType.EPGViewportDown: case ActionType.EPGViewportForward: case ActionType.EPGViewportBackward: case ActionType.EPGViewportForward24Hours: case ActionType.EPGViewportBackward24Hours: case ActionType.EPGViewportGotoChannel: case ActionType.UploadContentAndSubmitForm: case ActionType.SetStateSSP: case ActionType.ToggleStateSSP: //IMPLEMENT: other actions break; default: Core.UIFactory.ExecuteAction(action, sourceBlock, sourceNode, sourceViewID); break; } } }
static void Main() { // Create new document Document pdfDocument = new Document(); pdfDocument.RegistrationName = "demo"; pdfDocument.RegistrationKey = "demo"; // Add page Page page = new Page(PaperFormat.A4); pdfDocument.Pages.Add(page); // Create sample form Font font = new Font(StandardFonts.Times, 14); Brush brush = new SolidBrush(); // EditBox EditBox editBox = new EditBox(20, 20, 100, 25, "editBox1"); editBox.Text = "editBox1"; page.Annotations.Add(editBox); // CheckBox CheckBox checkBox = new CheckBox(20, 60, 15, 15, "checkBox1"); page.Annotations.Add(checkBox); page.Canvas.DrawString("CheckBox", font, brush, 45, 60); // Add Submit button PushButton submitButton = new PushButton(20, 120, 80, 25, "buttonSubmit"); submitButton.Caption = "Submit"; page.Annotations.Add(submitButton); // Add action SubmitFormAction submitAction = new SubmitFormAction(new Uri("http://login.live.com")); submitAction.SubmitFormat = SubmitDataFormat.HTML; submitAction.SubmitMethod = SubmitMethod.Get; submitAction.Fields.Add(editBox); submitAction.Fields.Add(checkBox); submitButton.OnActivated = submitAction; // Add Reset button PushButton resetButton = new PushButton(120, 120, 80, 25, "butonReset"); resetButton.Caption = "Reset"; page.Annotations.Add(resetButton); // Add action ResetFormAction resetAction = new ResetFormAction(); resetAction.Fields.Add(editBox); resetAction.Fields.Add(checkBox); resetButton.OnActivated = resetAction; // Save document to file pdfDocument.Save("result.pdf"); // Cleanup pdfDocument.Dispose(); // Open result document in default associated application (for demo purpose) ProcessStartInfo processStartInfo = new ProcessStartInfo("result.pdf"); processStartInfo.UseShellExecute = true; Process.Start(processStartInfo); }