Create a new text field on an existing PDF

Hi,

I am creating a new PTField and placing it into the PTPDFDoc which is already existing. But I do not see the newly created field displayed on the document. Please guide me with creating the same

I have the following code snippet to create the field:

PTField newfield = [document FieldCreateWithString:@“TextField” type:e_pttext field_value:@"" def_field_value:@"*"];

PTWidget *newWidget = [PTWidget Create:[document GetSDFDoc] pos:[[PTPDFRect alloc] initWithX1:20 y1:120 x2:10 y2:10] field:newfield];

[Widgetpage AnnotPushBack:newWidget];//Widgetpage is the page object into which filed has to be displayed

[document RefreshFieldAppearances];//document is a PTPDFDoc object

Regards,

Everything looks correct, I suspect the issue is with the Widget rectangle. The x2,y2 values are the opposite corner to the rectangle, not the width. Try something like the following.

`
PTWidget *newWidget = [PTWidget Create:[document GetSDFDoc] pos:[[PTPDFRect alloc] initWithX1:200 y1:500 x2:300 y2:600] field:newfield]; // 100x100 rect starting at 200,500

`

If that doesn’t help, you can post the before and after PDF files here, or if they are confidential you can send them to support at pdftron.