Help with security issue - generate text file

Community Beginner ,
Oct 05, 2018 Oct 05, 2018

Copy link to clipboard

Copied

Hey guys,

Hope all is well.

I am facing an issue with protection and hoped someone could help.

I have the below code working fine to generate a .txt file and saving it with a specific extension (.dbk).

The issue I have is, I can only generate the file if my pdf is unprotected (i.e., I have to leave the security settings to "Any changes allowed, except extracting pages).

Is there any way I can prevent the user to be able to edit the file and, at the same time, allow him to run the below code?

All help is greatly appreciated!

var cMyC = this.getField("DecRec").value;

var cpf = this.getField("CPF").value;

var NR_CPF = cpf.slice(0,1)+cpf.slice(1,2)+cpf.slice(2,3)+cpf.slice(4,5)+cpf.slice(5,6)+cpf.slice(6,7)+cpf.slice(8,9)+cpf.slice(9,10)+cpf.slice(10,11)+cpf.slice(12,13)+cpf.slice(13,14);

var retif_sim_nao = this.getField("Tipo_Declaracao").value;

var ret_ori = "";

var save_exerc = this.getField("Combo_Exercicio").value;

save_exerc = save_exerc.slice(10,14);

var save_anobase = this.getField("Combo_Ano-Calendario").value;

save_anobase = save_anobase.slice(15,19);

var doc = this.createDataObject({cName: NR_CPF+"-IRPF-S-"+save_exerc+"-"+save_anobase+"-"+ret_ori+".dbk", cValue: cMyC});

this.exportDataObject({cName: NR_CPF+"-IRPF-S-"+save_exerc+"-"+save_anobase+"-"+ret_ori+".dbk", nLaunch:0});

TOPICS
Acrobat SDK and JavaScript

Views

103

Likes

translate

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

Most Valuable Participant , Oct 05, 2018 Oct 05, 2018
I don't think so, because creating a new attachment is a form of editing that's not allowed by any of the other policies.

Likes

translate

Translate

Translate
Most Valuable Participant ,
Oct 05, 2018 Oct 05, 2018

Copy link to clipboard

Copied

I don't think so, because creating a new attachment is a form of editing that's not allowed by any of the other policies.

Likes

translate

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 ,
Oct 23, 2018 Oct 23, 2018

Copy link to clipboard

Copied

Thanks for the usual help! As always, much appreciated!

Likes

translate

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