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

Free Support Forum - aspose.com

Word content control to pdf control

I tried to convert word document to pdf and i have content controls in my doc, when i try to print word to pdf only textbox control gets converted to pdf control and that is also improper. is this happening because i didn’t set license key? (temporary or paid)

@PrayagMisal,

Have you tried the latest (21.1) version of Aspose.Words for .NET on your end? Please also try following options:

  • PdfSaveOptions.UpdateSdtContent Property
  • PdfSaveOptions.PreserveFormFields Property

In case the problem still remains, please ZIP and upload your simplified input Word document and Aspose.Words generated PDF file showing the undesired behavior here for testing. We will then investigate the issue on our end and provide you more information.

yes, i tried and this time by applying temporary license.

check box works perfectly but, not textbox and dropdown has jerky output and i couldn’t upload the respective word file in here it has some validation that is not allowing docx files.

below is the code i tried.

demo2.pdf (48.9 KB)
test.pdf (16.3 KB)

Aspose.Words.License license = new Aspose.Words.License();
license.SetLicense("D:\\Aspose.Words.NET.lic");
Document document = new Document("D:\\SOP-JSP-IT-001F01 Computer System Risk Assessment  v1.0.docx");
Console.WriteLine("License set successfully.");
PdfSaveOptions options = new PdfSaveOptions();
options.PreserveFormFields = true;
options.UpdateSdtContent = true;
document.Save("D:\\demo1.pdf", options);

@CodeVision,

Please first compress the source Word document to ZIP format and then upload the ZIP file as this forum allows .zip file extensions. You may also upload the file to Dropbox or any other file hosting service and share the download link here for testing.

My issue got resolved. I was mistaken. I followed this link to solve it:

https://forum.aspose.com/t/preserve-form-field-c/177085

I was using content controls but, am supposed to use legacy form controls. Please close this issue and are you guys working on converting content controls to pdf controls? because, sometimes those fields gets converted to forms fields which lead me astray.

And another issue is those generated fields works properly in adobe acrobat not in browsers.

@CodeVision,

We have logged the following issue in our issue tracking system.

  • WORDSNET-21698: Convert Word Content Controls to Editable Controls in PDF

We will further look into the details of this problem and will keep you updated on the status of the linked issue. We apologize for your inconvenience.

But, the following code exports form fields to PDF which are editable when opened with Firefox web browser.

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

builder.InsertTextInput("TextInput", TextFormFieldType.Regular, "", "Hello", 0);
builder.Writeln();

builder.InsertCheckBox("CheckBox", true, true, 0);
builder.Writeln();

string[] items = { "One", "Two", "Three" };
builder.InsertComboBox("DropDown", items, 0);

PdfSaveOptions opts = new PdfSaveOptions();
opts.PreserveFormFields = true;            

doc.Save("C:\\Temp\\21.1.pdf", opts);

Can you please provide a simple source Word document and PDF file causing the problem? What web browser are you getting this problem with? Please elaborate a bit more. Thanks for your cooperation.

Yes, as you said those controls are working in firefox and internet explorer but, not in google chrome and edge.

@CodeVision,

We do not see any issues in MS Edge browser on our end. Have you tried the latest version of this browser? However, we do see some issues when viewing Aspose.Words’ generated PDF (see 21.1.pdf (17.2 KB)) with latest version (88.0.4324.104) of Google Chrome i.e. spacing between characters increases in TextInput field and drop down items are distorted/corrupted. We have logged the following issue in our issue tracking system.

  • WORDSNET-21702: Form Fields when converted to PDF don’t behave correctly in Chrome browser

You will be notified here as soon as the linked issue are resolved. Sorry for the inconvenience.

test.pdf (51.6 KB)

Please check the above file…it is the combination of both the content controls and legacy form control. however that’s not the issue therefore please pay attention from third control(legacy control) which has text ‘THis is demo’ and below two controls are check box and dropdown that are also legacy controls. rest of all are content controls. i tried this pdf in latest version of edge browser and chrome as well and result is same.

@CodeVision,

I am afraid, I do not see any problems when viewing this test.pdf with MS Edge browser. However, latest version of Google Chrome does not display some characters (g, y, +, -, numbers 0~9 etc) when entering in those controls.

Can you please elaborate the problem a bit more what problem exactly are you getting in MS Edge and Chrome browsers? Please also provide the source Word document that you used to generate above PDF from.

Detail.zip (275.8 KB)

Above I attached all the required things for testing including screenshot in edge and chrome, document and it’s respective PDF.

please let me know if I have to make changes in edge browser or something like that. Look at those screenshots I tried to type ‘Hello how are you?’ but it skips some characters. and also in drop down it has removed last characters like 3, 4, 5 appended after ‘item’.

After reading your message i thought may be it’s just happening in my pc but, then i tried in my colleague’s computer and result is still same.

@CodeVision,

We have logged this problem in our issue tracking system with ID WORDSNET-21720. We will further look into the details of this problem and will keep you updated on the status of correction. We apologize for your inconvenience.

@CodeVision,

Regarding WORDSNET-21720, this happens due to the fact that font subsets are embedded into the output PDF instead of full fonts. Not all PDF viewers can handle the case when glyphs are missing for the characters typed in the form. To overcome this issue we have an option to embed full fonts to output PDF (PdfSaveOptions.EmbedFullFonts).

Thank you so much it works as expected in all browsers now.

The issues you have found earlier (filed as WORDSNET-21698) have been fixed in this Aspose.Words for .NET 21.11 update also available on NuGet.