• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
4

Strip PDF form fields but keep content inputted into the fields?

Explorer ,
Dec 12, 2023 Dec 12, 2023

Copy link to clipboard

Copied

Hi. I'm looking for a method to;
 
1) make a PDF form with image, text and checkbox input fields, save.
2) fill in content,
3) Strip the PDF of these input fields but keep the content that has been inputted into the fields. Aka.. a text input field becomes just text.
 
I need this as I'm showing the PDF in 3rd party software that doesn't handle form fields properly. I want to be able to make a lot of PDFs with different content, strip fields, save and then read into this 3rd party software.
 
Any ideas?
TOPICS
PDF forms

Views

1.4K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Dec 13, 2023 Dec 13, 2023

"What I mean is that if I make the checkboxes non-printable, and keep them as fields, and then flatten all text and image input fields."

Otherwise you can select all checkboxes, cut them, flatten the form fields, then paste.

Votes

Translate

Translate
Community Expert ,
Dec 13, 2023 Dec 13, 2023

Copy link to clipboard

Copied

Just print to PDF when you're done filling file.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 13, 2023 Dec 13, 2023

Copy link to clipboard

Copied

Ah ok I will try that but I need to keep some of the form objects still (checkboxes), but transform the text and image fields to normal text and images.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 13, 2023 Dec 13, 2023

Copy link to clipboard

Copied

You can do that using a simple script:

this.flattenPages();

If you want it to not flatten some fields then you would need to set them first as non-printing (ie. either hidden or visible, but doesn't print), then run this command:

this.flattenPages({bNonPrint: 1});

Just be aware this process is NOT reversible, so make sure to save the flattened file under a new name, or to keep a backup of the original somewhere.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 13, 2023 Dec 13, 2023

Copy link to clipboard

Copied

Also note that if you do this you'll lose all information that's not available on the screen, such as overflowing text in a text field with a scroll-bar.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 13, 2023 Dec 13, 2023

Copy link to clipboard

Copied

ok thanks!!! will this make it possible to use the form fields (checkboxes) not flattened in the PDF after exporting? But see th eothers as just text and images?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 13, 2023 Dec 13, 2023

Copy link to clipboard

Copied

No, flatten means that you take away the interactivity and all that happens in the background. A bit like printing and scanning, accept that there will be no need for running OCR.

ABAMBO | Hard- and Software Engineer | Photographer

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 13, 2023 Dec 13, 2023

Copy link to clipboard

Copied

What I mean is that if I make the checkboxes non-printable, and keep them as fields, and then flatten all text and image input fields.. and then open the PDF in the 3rd party software where I can view the PDF with form fields or without.. can I still use the checboxes and check/uncheck?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 13, 2023 Dec 13, 2023

Copy link to clipboard

Copied

Why would you do that, as you want to flatten the file? 3rd Party software may or may not work correctly with your file.

ABAMBO | Hard- and Software Engineer | Photographer

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 13, 2023 Dec 13, 2023

Copy link to clipboard

Copied

It a tabletop roleplaying form that will show in virtual tabletop software online. The users need to be able to interact with it. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 13, 2023 Dec 13, 2023

Copy link to clipboard

Copied

If you print, you will lose checkbox interactivity.

Why not use text box instead of text fields?

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 13, 2023 Dec 13, 2023

Copy link to clipboard

Copied

When you say print.. what do you mean? I will only use it digitally on screen.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 13, 2023 Dec 13, 2023

Copy link to clipboard

Copied

Print file and select Adobe PDF as printer.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 13, 2023 Dec 13, 2023

Copy link to clipboard

Copied

@Nesa Nurani ,

I said that flattening was the digital equivalent of printing and scanning. 😉

ABAMBO | Hard- and Software Engineer | Photographer

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 13, 2023 Dec 13, 2023

Copy link to clipboard

Copied

ok.. I have dropdowns with content as well that needs to be fixed with content and not dropdown-able in the PDF but I will do some experimentation.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 13, 2023 Dec 13, 2023

Copy link to clipboard

Copied

> will this make it possible to use the form fields (checkboxes) not flattened in the PDF after exporting? But see th eothers as just text and images?

 

Correct. The unflattened fields will continue working just like before.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 13, 2023 Dec 13, 2023

Copy link to clipboard

Copied

"What I mean is that if I make the checkboxes non-printable, and keep them as fields, and then flatten all text and image input fields."

Otherwise you can select all checkboxes, cut them, flatten the form fields, then paste.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 13, 2023 Dec 13, 2023

Copy link to clipboard

Copied

There is a flattener among the (free) abracadabraTools:

https://www.abracadabrapdf.net/utilitaires/utilities-in-english/abracadabratools_en/

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 13, 2023 Dec 13, 2023

Copy link to clipboard

Copied

I have now set the checkboxes to "Visible but not printable", and objects I need to flatten to "visible".

I used the "Flatten" feature of abracadabra, and it flattened ALL objects.

I opened the Javascript debugger console and script, and entered this script:

this.flattenPages({bNonPrint: 1});

as suggested above but nothing happened when clicked the green circle button. I tried to run the script all over the javascript editor but I couldn't get the script to run. also tried to remove the "this." prefix.

What is wrong?






Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 13, 2023 Dec 13, 2023

Copy link to clipboard

Copied

To run the code select it and press Ctrl+Enter.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 13, 2023 Dec 13, 2023

Copy link to clipboard

Copied

Ok thanks I clicked Command+Enter on my Mac and it ran the script but ALL objects got flattened. Darn

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 14, 2023 Dec 14, 2023

Copy link to clipboard

Copied

I used the "Flatten" feature of abracadabra, and it flattened ALL objects.

That's why I suggested cutting, flattening, and pasting.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 14, 2023 Dec 14, 2023

Copy link to clipboard

Copied

LATEST

Sorry, my bad. It should be "nNonPrint", not "bNonPrint"...

Attached is a sample file that shows it in action.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 13, 2023 Dec 13, 2023

Copy link to clipboard

Copied

I found this page and a script named "Flatten page Content Tool" Free Acrobat Automation Tools | pdfscripting.com
This works, but can it be adjusted to only Flatten objects that are printabe by adding this commend somewhere? In this way I can choose exactly what I need flattened.

this.flattenPages({bNonPrint: 1});

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 14, 2023 Dec 14, 2023

Copy link to clipboard

Copied

Creating a PDF form with image, text, and checkbox input fields involves using specialized software or libraries capable of PDF form creation, such as Adobe Acrobat or programming libraries like PyPDF2 or PDFBox. Once the form is created, content can be inputted programmatically into these fields using the chosen tool's functionalities.

The challenge arises when needing to strip the PDF of these input fields while retaining the content within them. This typically involves programmatically removing or flattening the form fields while preserving the inputted content—transforming text input fields into plain text and retaining image content. This step is crucial for compatibility with third-party software that doesn't handle form fields effectively.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines