Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Mon Jul 13, 2015 6:09 pm

Hello,
I am trying to use Spire.PDF to fill forms, however I have one form that is in landscape mode where the code is not working. The text gets inserted in the wrong part of the page and the orientation of the text is wrong also.
This is the code I am using:
protected void Page_Load(object sender, EventArgs e)
{
string fileToOpen = Path.Combine(HttpContext.Current.Server.MapPath("~"), "docs\\waiver\\2016_452_3039_waiver.pdf");

PdfDocument doc = new PdfDocument();
try
{
doc.LoadFromFile(fileToOpen);
}
catch (Exception ex)
{

throw new Exception("Waiver template not found at " + fileToOpen + "\n" + ex.ToString());
}

PdfFormWidget formWidget = doc.Form as PdfFormWidget;

if (formWidget != null)
{
//formWidget.
for (int i = 0; i < formWidget.FieldsWidget.List.Count; i++)
{
PdfField field = formWidget.FieldsWidget.List[i] as PdfField;
if (field is PdfTextBoxFieldWidget)
{
PdfTextBoxFieldWidget textBoxField = field as PdfTextBoxFieldWidget;
textBoxField.Text = textBoxField.Name;
field.Flatten = true;
field.ReadOnly = true;
}

}
}

MemoryStream attachStream = new MemoryStream();

doc.SaveToStream(attachStream);
doc.Close();
Response.AddHeader("Content-Disposition", "attachment; filename=waiver.pdf");
Response.AddHeader("Content-Length", attachStream.Length.ToString());
Response.ContentType = "application/pdf";
Response.BinaryWrite(attachStream.ToArray());
Response.Flush();
}
}


I tried uploading the PDF but I got a message that that extension is not allowed

[email protected]
 
Posts: 1
Joined: Mon Jul 13, 2015 6:03 pm

Tue Jul 14, 2015 2:08 am

Hello,

Thanks for your inquiry.
Please kindly note that firstly you need to compress it and upload.
Or you can send the sample file to us ( [email protected] ) via email.
It would be helpful to replicate the issue and work out the solution for you ASAP.

Best Regards,
Sweety

E-iceblue support team
User avatar

sweety1
 
Posts: 539
Joined: Wed Mar 11, 2015 1:14 am

Thu Jul 16, 2015 8:03 am

Hello,

Has your issue been resolved?
If not, please kindly note that firstly you need to compress your file and upload.
Or you can send it to us ( [email protected] ) via email.
It would be helpful to replicate the issue and work out the solution for you ASAP.

Best Regards,
Sweety

E-iceblue support team
User avatar

sweety1
 
Posts: 539
Joined: Wed Mar 11, 2015 1:14 am

Return to Spire.PDF