Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Currently, I have a fillable pdf form located on my C drive.

What I want to achieve is: Opening the form, let the user fill in the fields, and save the document back to my C drive.

What I have tried:

What I have tried:
I use  the "adobe PDF reader Component" to display it on my Window Form Application. Filling can be done without problem. Then I make use of the  "SaveAs" Button provided by the toolbar in Adobe reader. Upon clicking, SaveAsDialog box will be opened and asked the user for path and filename. After selecting path and naming the file, that document can be successfully saved.

Issues:
I don't want the user to choose the path and filename by himself. I want to have a button in my app, and after clicking, saving is done with hardcoded path and filename. Is that possible?

If not, are there any other ways to let user fill pdf interactively and save the result using a single button?
Posted
Updated 17-Jan-22 23:28pm

1 solution

All what you need to do is to define full file name including the path:

VB.NET
Dim pdfname As String = "D:\SomePath\SubFolder\mypdf.pdf"

C#
string pdfname = @"D:\SomePath\SubFolder\mypdf.pdf";


Now, use that variable to save your pdf file. For example: File.WriteAllBytes(string, byte[])[^]
If you're using NuGet packet to read/write pdf(s), use embeded methods, such as: Save() or SaveAs().
 
Share this answer
 
v2
Comments
Richard MacCutchan 18-Jan-22 6:36am    
+5, especially for the two language solution.
Maciej Los 18-Jan-22 8:29am    
Thank you, Richard.
Fung Chan 18-Jan-22 6:37am    
How can i get the byte array for the filled pdf if i am just having the original unfilled pdf on my pc?
Maciej Los 18-Jan-22 8:37am    
If you can open pdf (form) and fill it up programmatically... you should be able to modify your (hidden) code.
As i mentioned i have no idea about method (or NuGet packet) you use to read pdf file.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900