Skip to main content
Known Participant
October 5, 2018
Answered

Help with security issue - generate text file

  • October 5, 2018
  • 1 reply
  • 684 views

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});

This topic has been closed for replies.
Correct answer try67

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.

1 reply

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
October 5, 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.

lapnetoAuthor
Known Participant
October 23, 2018

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