I'm trying create an pdf file with additional comments after stream decode but create an new page. Is possible add this comment using FNC PDF library ?
<procedure TForm_SIFEN.SpeedButton2Click(Sender: TObject);
var
stream: TBytesStream;
JSONPDF, JSONPDF_CDC : TJSONObject;
JSONPDF_Array, JSONPDF_CDC_Array : TJSONArray;
p: TTMSFNCPDFLib; g: TTMSFNCGraphicsPDFEngine; pth: TTMSFNCGraphicsPath;
r: TRectF;
AfileName : WideString;
begin
if MessageBox( Handle,
'Confirma la creacion del archivo KUDE?',
'Atención!!!',
MB_YESNO +
MB_ICONQUESTION+
MB_DEFBUTTON2) = IDYES then
begin
JSONPDF := TJSONObject.Create;
JSONPDF.AddPair('type', 'Base64');
JSONPDF_CDC := TJSONObject.Create;
JSONPDF_CDC.AddPair('cdc', DM.SDS_SIFEN.FieldByName('RESPONSE_CDC').AsString);
JSONPDF_CDC_Array := TJSONArray.Create;
JSONPDF_CDC_Array.AddElement(JSONPDF_CDC);
JSONPDF.AddPair('cdcList', JSONPDF_CDC_Array);
RESTRequest2.Params[2].Value:=JSONPDF.ToString;
RESTRequest2.Execute;
Memo15.Lines.Clear;
Memo15.Lines.Add(JSONPDF.ToString);
Memo16.Lines.Add(RestResponse2.JSONText);
stream := TBytesStream.Create(TNetEncoding.Base64.DecodeStringToBytes(RestResponse2.Content));
try
stream.SaveToFile('C:\Archivos de programa\Hpti\Integrar\KD'+DM.SDS_SIFEN.FieldByName('RESPONSE_CDC').AsString+'.pdf');
ShowMessage('Fue creado el archivo C:\Archivos de programa\Hpti\Integrar\KD'+DM.SDS_SIFEN.FieldByName('RESPONSE_CDC').AsString);
// ShellExecute(Application.Handle,'', PChar('C:\Archivos de programa\Hpti\Integrar\KD'+DM.SDS_SIFEN.FieldByName('RESPONSE_CDC').AsString), nil,nil,SW_SHOW);
finally
stream.Free;
end;
end;
p := TTMSFNCPDFLib.Create;
AFileName := 'C:\Archivos de programa\Hpti\Integrar\KD'+DM.SDS_SIFEN.FieldByName('RESPONSE_CDC').AsString+'_V1';
try
p.BeginDocument(AFileName);
p.NewPage;
p.Graphics.DrawText('Hello'#13#10'World !', RectF(10, 50, 150, 100));
p.EndDocument(True);
finally
p.Free;
end;
end;