We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Page Margin changes after adding Table and Radio Button Aspose PDF for .NET

Hi,

I am facing issues after adding Table and Radio Options to the existing PDF.
I have attachedSample_1.pdf (537.3 KB)
the Sample PDF and code is below:

private static void AddRadioField()
{
string dataDir = GetDir() + “Sample_1.pdf”;

        Aspose.Pdf.Document doc = new Aspose.Pdf.Document(dataDir);
        Aspose.Pdf.Table table = new Aspose.Pdf.Table();
        table.Margin.Top = 200;
        table.ColumnWidths = "120 120 120";
        doc.Pages[3].Paragraphs.Add(table);
        Row r1 = table.Rows.Add();
        Cell c1 = r1.Cells.Add();
        Cell c2 = r1.Cells.Add();
        Cell c3 = r1.Cells.Add();

        RadioButtonField rf = new RadioButtonField(doc.Pages[3]);
        rf.PartialName = "radio";
        doc.Form.Add(rf, 3);

        RadioButtonOptionField opt1 = new RadioButtonOptionField();
        RadioButtonOptionField opt2 = new RadioButtonOptionField();
        RadioButtonOptionField opt3 = new RadioButtonOptionField();

        opt1.OptionName = "Item1";
        opt2.OptionName = "Item2";
        opt3.OptionName = "Item3";

        opt1.Width = 15;
        opt1.Height = 15;
        opt2.Width = 15;
        opt2.Height = 15;
        opt3.Width = 15;
        opt3.Height = 15;

        rf.Add(opt1);
        rf.Add(opt2);
        rf.Add(opt3);

        opt1.Border = new Aspose.Pdf.InteractiveFeatures.Annotations.Border(opt1);
        opt1.Border.Width = 1;
        opt1.Border.Style = BorderStyle.Solid;
        opt1.Characteristics.Border = System.Drawing.Color.Black;
        opt1.DefaultAppearance.TextColor = System.Drawing.Color.Red;
        opt1.Caption = new TextFragment("Item1");
        opt2.Border = new Aspose.Pdf.InteractiveFeatures.Annotations.Border(opt1);
        opt2.Border.Width = 1;
        opt2.Border.Style = BorderStyle.Solid;
        opt2.Characteristics.Border = System.Drawing.Color.Black;
        opt2.DefaultAppearance.TextColor = System.Drawing.Color.Red;
        opt2.Caption = new TextFragment("Item2");
        opt3.Border = new Aspose.Pdf.InteractiveFeatures.Annotations.Border(opt1);
        opt3.Border.Width = 1;
        opt3.Border.Style = BorderStyle.Solid;
        opt3.Characteristics.Border = System.Drawing.Color.Black;
        opt3.DefaultAppearance.TextColor = System.Drawing.Color.Red;
        opt3.Caption = new TextFragment("Item3");
        c1.Paragraphs.Add(opt1);
        c2.Paragraphs.Add(opt2);
        c3.Paragraphs.Add(opt3);

        dataDir = dataDir + "RadioButtonWithOptions_out.pdf";
        // Save the PDF file
        doc.Save(dataDir);

}

If you compare the page no.2 and page no. 3 after adding Radio button you will see the difference in the page margin.
Can you please help me to rectify the issue?

Thanks

@psluzhevsky

Thanks for contacting support.

We have tested the scenario in our environment using Aspose.PDF for .NET 18.9.1 which is latest version of the API and were unable to notice the change in page margin of resultant PDF. RadioButtonWithOptions_out.pdf (611.0 KB)

Would you please try using latest version of the API and see if the issue still persists. Also, it would be helpful if you can please share a screenshot of the issue showing margin differences. We will again test the scenario in our environment and address it accordingly.