Show pdf file after after linking

IN that tbale: table 5455278 there is also this function where the streaming is been done:


ShowPDF()
Setup.Read;

IF  PDF.HASVALUE THEN BEGIN
  MESSAGE('HAShVALUE');
   END
  ELSE
  MESSAGE('no value');


CALCFIELDS(PDF);
IF NOT PDF.HASVALUE THEN BEGIN
  TESTFIELD(PDF);
END;
PDF.CREATEINSTREAM(InStream);

Tools.ShowPDF(InStream);
ShowPDF(InStream)
IF ISSERVICETIER THEN BEGIN
  Filename := GetTempFilename('pdf');
  DOWNLOADFROMSTREAM(InStream,'',FileManagement.Magicpath,Text010,Filename);

END ELSE BEGIN
  File.CREATETEMPFILE;
  Filename := File.NAME + '.pdf';
  File.CLOSE;

  File.CREATE(Filename);
  File.CREATEOUTSTREAM(OutStream);
  COPYSTREAM(OutStream,InStream);
  File.CLOSE;
END;

HYPERLINK(Filename);

After the function: ShowPDFCLient.ShowPDF()

it goes to a other function like this:

And this is my xml port:


Documentation()

Report - OnInitReport()

Report - OnPreReport()

Report - OnPostReport()

IF Filename <> '' THEN ImportFile
ELSE MESSAGE(NoFileText);

Report - OnCreateHyperlink(VAR URL : Text[1024])

Report - OnHyperlink(URL : Text[1024])

UploadFile(VAR FileName : Text[1024])
IF NOT ISSERVICETIER THEN
  NewFileName := CommonDialogMgt.OpenFile(Caption,FileName,4,Filefilter,0)

ELSE
  IF NOT(UPLOAD(Caption,'',Filefilter,FileName,NewFileName)) THEN
    NewFileName := '';

IF NewFileName <> '' THEN
  FileName := NewFileName;

ImportFile()
// The import function in NAV cant handle with the xmlns line in the xml file. So a work around is to strip the line with the
//xmlns in it.
dFile.TEXTMODE(FALSE);
dFile.OPEN(Filename);
dFile.CREATEINSTREAM(Stream);
InputText.READ(Stream);
dFile.CLOSE;


TextToFind :=' xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"';
TextPos := InputText.TEXTPOS(TextToFind);


WHILE TextPos <> 0 DO BEGIN
  InputText.GETSUBTEXT(SubText, 1, TextPos - 1);
  OutputText.ADDTEXT(SubText);
  InputText.GETSUBTEXT(InputText, TextPos + STRLEN(TextToFind));
  TextPos := InputText.TEXTPOS(TextToFind);

END;

OutputText.ADDTEXT(InputText);

//Begin kvk
TextToFindKVKBegin :='<Kvk>';
TextToFindKVKEnd :='</Kvk>';


Pos1 := InputText.TEXTPOS(TextToFindKVKBegin);
Pos2 := InputText.TEXTPOS(TextToFindKVKEnd);
Pos := Pos1;

WHILE Pos <> 0 DO BEGIN

InputText.GETSUBTEXT(result,Pos1+5,Pos2-(Pos1+5));
InputText.GETSUBTEXT(InputText,Pos2+6,GivenText.LENGTH);
Pos1 := InputText.TEXTPOS(TextToFindKVKBegin);
Pos2 := InputText.TEXTPOS(TextToFindKVKEnd);
Pos := Pos1;
END;

 duplicateChambreofCommerce.SETRANGE(duplicateChambreofCommerce."Chamber of Commerce no.",result);
 IF duplicateChambreofCommerce.FINDFIRST THEN
   ERROR('KVK nummer bestaat al.');




dFile.TEXTMODE(FALSE);
dFile.CREATE(Filename);
dFile.CREATEOUTSTREAM(NVOutStream);
OutputText.WRITE(NVOutStream); 
dFile.CLOSE;
  


IF ISSERVICETIER THEN BEGIN
  IF UPLOADINTOSTREAM(
                      'Select the simple.xml file',
                      '\\svdh04\data\NAV docs\webaanmelding\',
                      'XML File *.xml| *.xml',
                       Filename,
                       Stream) THEN
    MESSAGE(ImportCompleteText)
  ELSE
    EXIT;
END
ELSE BEGIN
  dFile.OPEN(Filename);
  dFile.CREATEINSTREAM(Stream);
  IF NOT XMLPORT.IMPORT(50010,Stream) THEN MESSAGE(ErrorText)
  ELSE MESSAGE(ImportCompleteText);
END;

IF NOT ISSERVICETIER THEN dFile.CLOSE;