Load PDF file into NAV 2009R2 and parse into text file

Hi everybody, I would like to know if it is possible to load a pdf file (it contains a data set) into nav and parse it as if it was a text file?
Obviously, what I need to do here is load the pdf file and transform it into a text file or anything similar so I can create my data set from it.
Has anybody ever faced such similar task on NAVISION 2009 R2?
Thanks for your help
Vittorio Delmedico

Comments

  • ftorneroftornero Posts: 155Member
    You can try a product call PDFBox

    https://pdfbox.apache.org/

    Regards,
  • vittoriodvittoriod Posts: 5Member
    Thanks for the feedback, so there is no way to do that using any existing NAVISION automations or any native NAV functionalities?
    Thanks
    Vittorio Delmedico
  • ftorneroftornero Posts: 155Member
    No, at least to my knowledge.

    Other solution is Ghostscript, the last version (9.25)

    This is an example of how to use in PowerShell, from an input.pdf you get an output.txt.
    $tool = 'C:\\Program Files\\gs\\gs9.25\\bin\\gswin64c.exe'
    & $tool -q -dNOPAUSE -dCOMPLEX -dWRITESYSTEMDICT -dTextFormat=3 -sDEVICE=txtwrite -o c:\test\output.txt c:\test\input.pdf
    
  • vittoriodvittoriod Posts: 5Member
    Thanks, but this would mean that we would have to install ghostscript on all nav clients in order to execute the '.exe' file? Another question, how would you execute the code you have just attached on NAV 2009 R2 classic client? Thanks a lot
    Vittorio Delmedico
  • ftorneroftornero Posts: 155Member
    You can use something like this
    
    IF ISCLEAR(WSHShell) THEN
      CREATE(WSHShell);
    
    WSHExec := WSHShell.Exec(program);
    

    Where WSHExec is:
    Name	DataType	Subtype	Length
    WSHExec	Automation	'Windows Script Host Object Model'.WshExec	
    

    And program is:
    program := 'C:\Program Files\gs\gs9.25\bin\gswin64c.exe -q -dNOPAUSE -dCOMPLEX -dWRITESYSTEMDICT -dTextFormat=3 -sDEVICE=txtwrite -o c:\test\output.txt c:\test\input.pdf'
    
  • vittoriodvittoriod Posts: 5Member
    edited 2018-10-15
    Thank you very much so I should treat it as a normal script.. I'll try and let yo know the result
    Vittorio Delmedico
Sign In or Register to comment.