You are not logged in.
I need to export to a pdf encrypted by QuickReport: I can create the pdf file is not encrypted using ExportToFilter but do not know how to export it directly encrypted.
How to ?
Thanks,
Tiziano
Offline
This QuickReport filter is not part of our library, nor supported by us.
But SynPDF by itself (in its latest revision) is able to encrypt the generated pdf file.
See http://blog.synopse.info/post/2013/06/1 … t-security
So you will have to update the QR filter to add the encryption settings at TPdfDocument creation:
NewPdfDoc := TPdfDocument.Create(false,0,false,
TPdfEncryption.New(elRC4_128,'','toto',PDF_PERMISSION_NOCOPYNORPRINT));
Offline
procedure TForm1.test;
var
spdf : TQRSynPDFDocumentFilter;
doc: TPDFDocument;
begin
// 1) This creates a empty pdf file encrypted
Doc := TPdfDocument.Create(false,0,false,TPdfEncryption.New(elRC4_128,'','toto',PDF_PERMISSION_ALL));
// 2) This creates and saves a pdf file is not encrypted by QuicReport
spdf := TQRSynPDFDocumentFilter.Create('C:\test.pdf');
spdf.HideMenubar := true;
spdf.CompressionOn := true;
spdf.HideToolbar := true;
spdf.FontHandling := AutoEmbed;
form1.QuickRep1.ExportToFilter(spdf);
spdf.Free;
.....
?????
.....
end;
How do I connect the 1) with 2) in order to create and save a pdf file from QuickReport encrypted?
Thanks
Tiziano
Offline
The solution you have provided to me in reading this:
http://synopse.info/forum/viewtopic.php?id=138
......
try
Doc := TPdfDocument.Create(false,0,false,TPdfEncryption.New(elRC4_128,'','toto',PDF_PERMISSION_NOCOPYNORPRINT));
Doc.DefaultPaperSize := psA4;
form2.QuickRep1.prepare;
for p := 1 to form2.QuickRep1.QRPrinter.PageCount do
begin
Doc.AddPage;
pagemeta := form2.QuickRep1.QRPrinter.PageList.GetPage(p);
try
Doc.Canvas.RenderMetaFile(pagemeta,1,0,0);
finally
pagemeta.free;
end;
end;
//This saves a pdf file encrypted by QuicReport
doc.SaveToFile('prova.pdf');
finally
doc.Free;
end;
Thanks !!!
Tiziano
Last edited by stefanti (2014-08-09 10:19:43)
Offline
Last question: how do you put password permission to the opening of the pdf?
Tiz.
Offline
Doc := TPdfDocument.Create(false,0,false,TPdfEncryption.New(elRC4_128,'password.open','password.protection',PDF_PERMISSION_NOCOPYNORPRINT));
Very well!
Thanks,
Tiziano
Offline