I have a pdf that I created in Adobe Live Cycle Designer, and am filling the fields from a .NET application using aspose’s pdfForm.FillField. The first page of alignments is correct for the text boxes I am filling but the indentation for the larger multi-line boxes is printing as if it were 0. The second page of the pdf has text boxes that the formatting is not correct. Font and font size is correct, but alignment is not.
Hi Christopher,
Here is a copy of the PDF form that I am filling. All the fills in the c# code are the same, using fillfield.
Hi Christopher,
//create Form object<o:p></o:p>
Aspose.Pdf.Facades.Form pdfForm = new Aspose.Pdf.Facades.Form();
// bind the source PDF file
pdfForm.BindPdf("c:/pdftest/OrderRefillRequest.pdf");
//Fill the field multiline text
pdfForm.FillField("form1[0].#subform[2].payment[0].TextField[0]", "this is a large multiline text which will \n span two lines and cannot be displayed in one");
//save updated PDF
pdfForm.Save(“c:/pdftest/new_test_form_updated_output.pdf”);
//create PdfViewer object and bind PDF
file<o:p></o:p>
PdfViewer pdfViewer = new PdfViewer();
pdfViewer.OpenPdfFile("c:/pdftest/new_test_form_updated_output.pdf");
//set PrinterSettings and PageSettings
System.Drawing.Printing.PrinterSettings printerSetttings = new System.Drawing.Printing.PrinterSettings();
printerSetttings.Copies = 1;
printerSetttings.PrinterName = "Microsoft XPS Document Writer";
//set output file name and PrintToFile attribute
printerSetttings.PrintFileName = "C:\\pdftest\\printoutput.xps";
printerSetttings.PrintToFile = true;
//disable print page dialog
pdfViewer.PrintPageDialog = false;
//pass printer settings object to the method
pdfViewer.PrintDocumentWithSettings(printerSetttings);
pdfViewer.ClosePdfFile();
In case I am unable to understand the problem, please share some further details along with code snippet. We are sorry for your inconvenience.
That is slightly different than how I’m using it. Here is the code to create the stream and form
christopher.schraer:To fill the fields I am just referencing them by their field names.[C#]pdfForm.FillField("TextFieldDate", textBoxCurrentDate.Text);pdfForm.FillField("TextFieldDate2", textBoxCurrentDate.Text);pdfForm.FillField("TextFieldSpecialty", textBoxSpecialty.Text);...
christopher.schraer:At the end I am simply printing it out from the stream instead of saving it, since I don't want to save the file.[C#]pdfForm.Save();//Create PdfViewer objectAspose.Pdf.Kit.PdfViewer viewer = new Aspose.Pdf.Kit.PdfViewer();//Open input PDF fileviewer.OpenPdfFile(pdfStream);//Print PDF documentviewer.PrintDocument();//Close PDF fileviewer.ClosePdfFile();