Convert PDF to XML: external app, shell alternative, anything else?

TiwazTiwaz Member Posts: 98
Hello experts.
In old NAV I had a code which was used to convert PDF to XML using external app PDFX.exe and it looked something like this:

WshMode := 1;
WaitForEndOfCommand := TRUE;
CommandL := 'C:\PDFX.exe' + 'pdftoxml' + ' ' + FileNameOriginal + ' ' + 'C:\Test.pdf' + 'TestFile.xml';
IF ISCLEAR(WshShell) THEN
CREATE(WshShell);
ReturnCode := WshShell.Run(Command,WshMode,WaitForEndOfCommand);

However, now I cannot use Automation anymore so does anyone know how can I convert this PDF file?
I know I can access PDF using HYPERLINK('C:\Test.pdf') but how to go from there? Maybe some other solution?

THANKS IN ADVANCE!!!

Answers

  • ara3nara3n Member Posts: 9,256
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • TiwazTiwaz Member Posts: 98
    ara3n wrote: »

    Hey ara3n. I tried this already but when I run it, nothing happens. I'm going with something like this:
    ProcInfo := ProcInfo.ProcessStartInfo;
    ProcInfo.FileName := 'C:\WINDOWS\system32\notepad.exe';
    ProcInfo.Arguments := 'c:\test.txt';
    ProcInfo.UseShellExecute := FALSE;
    ProcInfo.RedirectStandardOutput := TRUE;
    ProcInfo.WindowStyle := 1; // Hidden
    ProcInfo.CreateNoWindow := TRUE;

    WShell:= WShell.Start(ProcInfo);
    WShell.WaitForExit;

    If it means anything, I'm running this code on my demo database locally on my computer.
  • TiwazTiwaz Member Posts: 98
    edited 2017-11-10
    hwlmxvq88xv1.png
    Little update on the issue:
    It does export the XML file but in .vec format and there is no data from my pdf document just something lie this code:
    <VECTORIALIMAGES><CLIP sid="p1_s1" x="0" y="0" width="595.32" height="841.92" idClipZone="p1_c1"><GROUP sid="p1_s2" closed="true"><M x="0" y="841.92"/><L x="595.32" y="841.92"/><L x="595.32" y="0"/><L x="0" y="0"/><L x="0" y="841.92" etc etc etc

    I realized that my externall app PDFX takes parameters as shown in the image. How can I pass some of these through code shown above? Thanks!
Sign In or Register to comment.