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

PDF with javascript export pdf with flattened form fields and reset the pdf

New Here ,
Oct 27, 2021 Oct 27, 2021

Copy link to clipboard

Copied

I am using PDF XChange to create a reusable PDF document that once signed changes all the fields to readonly and then sends it as PDF to our company mail and then clears all the fields and changes them back to editable.

This already works fine but setting the fields as readonly isn't the safest way of doing things so I wondered if there is a way of exporting the document with removed/flattened form fields.

This is the current code for it:

 

 

var f = this.getField("X10");
f.readonly = true;

var subject = "X1"+" "+this.getField("X2").value+" "+this.getField("X3").value+" vom "+this.getField("X4").value;
var url = "mailto:mail1; mail2?subject="+subject+"&body=whatever";
this.submitForm({cURL: url, cSubmitAs: "PDF"});

var f = this.getField("X10");
f.readonly = false;
f.value = "";

 

TOPICS
Create PDFs , Edit and convert PDFs , 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
LEGEND ,
Oct 27, 2021 Oct 27, 2021

Copy link to clipboard

Copied

What is your question about Acrobat, please? We can't answer questions about rival products.

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
New Here ,
Oct 27, 2021 Oct 27, 2021

Copy link to clipboard

Copied

It's true I am not using acrobat, but PDF XChange, but I thought using javascript inside a pdf is the same for most of the pdf editors.

If this is not the case with acrobat I am sorry and delete the post.

 

My question is basically how to delete/flatten the form fields only for the exportet document and reuse the original form.

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 ,
Oct 27, 2021 Oct 27, 2021

Copy link to clipboard

Copied

this.flattenPages();

 

But it doesn't work with all software, starting with Acrobat Reader.

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
New Here ,
Oct 27, 2021 Oct 27, 2021

Copy link to clipboard

Copied

This works within the software I am making the formula but sadly not on any pdf reader.

Do you know of any way to export the document without the form fields so they can't be changed anymore. Essentially automatically exporting an optimized PDF with flattened form 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
Community Expert ,
Oct 28, 2021 Oct 28, 2021

Copy link to clipboard

Copied

LATEST

This can be automatised using Acrobat's Actions:

 

Capture_193.png

 

 

Capture_194.png

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